summaryrefslogtreecommitdiffstats
path: root/devel/boehm-gc/Makefile
blob: 00478d0f2f59da0a0581abcd247b77289340a136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Created by: Mike McGaughey <mmcg@cs.monash.edu.au>
# $FreeBSD$

PORTNAME=	gc
PORTVERSION=	7.4.2
PORTREVISION=	1
CATEGORIES=	devel
MASTER_SITES=	http://www.hboehm.info/gc/gc_source/
PKGNAMEPREFIX=	boehm-
.ifdef GC_VARIANT
PKGNAMESUFFIX=	-${GC_VARIANT}
.endif

MAINTAINER=	cjpugmed@gmail.com
COMMENT=	Garbage collection and memory leak detection for C and C++

LICENSE=	BDWGC
LICENSE_NAME=	Boehm-Demers-Weiser Garbage Collector License
LICENSE_TEXT=	License can be found at http://www.hboehm.info/gc/license.txt
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

BUILD_DEPENDS=	${LOCALBASE}/lib/libatomic_ops.a:${PORTSDIR}/devel/libatomic_ops

GNU_CONFIGURE=	yes
USES=		libtool pathfix pkgconfig
USE_AUTOTOOLS=	aclocal autoconf libtoolize
USE_LDCONFIG=	yes
INSTALL_TARGET=	install-strip
CONFIGURE_ARGS=	--enable-cplusplus --disable-static
MAKE_JOBS_UNSAFE=	yes

WRKSRC=		${WRKDIR}/${DISTNAME:C/[a-z]$//}

OPTIONS_DEFINE=	DEBUG

.ifdef GC_VARIANT
INSTLIBS=	cord gc gccpp
PLIST=		${NONEXISTENT}
PLIST_FILES=	${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so.${SOVER},g} \
		${INSTLIBS:S,^,lib/lib,g:S,$,-${GC_VARIANT}.so,g} \
		libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
RUN_DEPENDS+=	${LOCALBASE}/include/gc/gc.h:${PORTSDIR}/devel/boehm-gc
SOVER=		1
. if ${GC_VARIANT} == "redirect"
CONFIGURE_ARGS+=--disable-threads --enable-redirect-malloc
. endif
. if ${GC_VARIANT} == "threaded"
CONFIGURE_ARGS+=--enable-threads=posix --disable-redirect-malloc
OPTIONS_DEFINE+=PARALLEL_MARK
PARALLEL_MARK_DESC=	Parallel-thread marking (faster for SMP)
. endif
.else
CONFIGURE_ARGS+=--disable-threads --disable-redirect-malloc
OPTIONS_DEFINE+=DOCS
PORTDOCS=	*
.endif

.include <bsd.port.pre.mk>

NOT_FOR_ARCHS=	ia64

# no rule to get .lo from .S in subdirectory
pre-build:
	${LN} -sf ${WRKSRC}/src/sparc_mach_dep.S ${WRKSRC}

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=--enable-gc-debug
PKGNAMESUFFIX:=	${PKGNAMESUFFIX}+fulldebug
.endif

.if defined(GC_VARIANT) && ${GC_VARIANT} == "threaded"
. if ${PORT_OPTIONS:MPARALLEL_MARK}
CONFIGURE_ARGS+=--enable-parallel-mark
. endif
.endif

.ifdef GC_VARIANT
post-patch:
	@${REINPLACE_CMD} -e \
		's,libgc\.la,libgc-${GC_VARIANT}.la,g ; \
		s,libgccpp\.la,libgccpp-${GC_VARIANT}.la,g ; \
		s,libcord\.la,libcord-${GC_VARIANT}.la,g' ${WRKSRC}/Makefile.in
	@${REINPLACE_CMD} -e \
		's,-lgc,-lgc-${GC_VARIANT},' ${WRKSRC}/bdw-gc.pc.in

do-install:
.for LIB in ${INSTLIBS}
	${INSTALL_DATA} ${WRKSRC}/.libs/lib${LIB}-${GC_VARIANT}.so.${SOVER} \
		${STAGEDIR}${PREFIX}/lib/lib${LIB}-${GC_VARIANT}.so.${SOVER}
	${LN} -sf lib${LIB}-${GC_VARIANT}.so.${SOVER} \
		${STAGEDIR}${PREFIX}/lib/lib${LIB}-${GC_VARIANT}.so
.endfor
	${INSTALL_DATA} ${WRKSRC}/bdw-gc.pc \
		${STAGEDIR}${PREFIX}/libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
.else # ! GC_VARIANT

post-patch:
	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/doc/gc.man
	@${REINPLACE_CMD} \
		-e "s|(datadir)/@PACKAGE@|(datadir)/doc/@PACKAGE@|" \
		${WRKSRC}/Makefile.in

post-install:
	${INSTALL_MAN} ${WRKSRC}/doc/gc.man ${STAGEDIR}${MAN3PREFIX}/man/man3/gc.3
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	(cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})

.endif

# Get rid of .la and static library files
#
post-configure:
	@${REINPLACE_CMD} -E -e \
	'/Install the pseudo-library/,/staticlibs=/s,^,#,' ${WRKSRC}/libtool

regression-test: build
	cd ${WRKSRC} && ${MAKE} check

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud