summaryrefslogtreecommitdiff
path: root/lang/fpc/Makefile.units
blob: 7eeb7e06cb8c15cce04a957a540fb3aaac3f469c (plain) (blame)
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
BUILDNAME=	${FPC_ARCH}-${OPSYS:tl}

PLIST_SUB+=	PORTVERSION=${PORTVERSION} \
		BUILDNAME=${BUILDNAME}

PLIST=		${.CURDIR}/pkg-plist
PATCHDIR=	${.CURDIR}/files
FILESDIR=	${.CURDIR}/files
DFLY_PATCHDIR=	${.CURDIR}/dragonfly
DFLY_FILESDIR=	${.CURDIR}/dragonfly
WRKSRC=		${WRKDIR}/${FPCSRCDIR}
BUILD_WRKSRC=	${WRKDIR}/${WRKUNITDIR}
INSTALL_WRKSRC=	${WRKDIR}/${WRKUNITDIR}

OPT+=		-Ur -va
FPCDIR?=	${LOCALBASE}/lib/fpc/${PORTVERSION}
UNITPREFIX=    	unit-
UNITNAME=	${UNITPREFIX}${PKGNAMESUFFIX:S/-//}${BUILDNAME:S/^/./}${UNITEXTRACT_SUFX}
UNITDIR=	lib/fpc/${PORTVERSION}/units/${BUILDNAME}

UNITEXTRACT_SUFX=	.tar.gz
EXTRACT_AFTER_ARGS=	${EXTRACTUNITDIR}

MAKE_ARGS+=	PP="${LOCALBASE}/bin/fpc" \
		FPCFPMAKE="${LOCALBASE}/bin/fpc" \
		FPCMAKE="${LOCALBASE}/bin/fpcmake" \
		CPU_TARGET=${FPC_ARCH} \
		OS_TARGET=${OPSYS:tl} \
		COMPILER_OPTIONS="${OPT}" \
		BSDHIER=1 \
		VERBOSE=1 \
		INSTALL="${INSTALL_DATA}" \
		INSTALLEXE="${INSTALL_PROGRAM}" \
		INSTALLSCR="${INSTALL_SCRIPT}" \
		INSTALL_PREFIX="${STAGEDIR}${PREFIX}" \
		FPC_LDPATH=${FPC_LDPATH}		
ALL_TARGET=	fpc_baseinfo release

.if ${PORT_OPTIONS:MEXAMPLES} && defined(HAVE_EXAMPLES)
LATE_INSTALL_ARGS=	fpc_exampleinstall
.endif

post-extract:
	@cd ${WRKDIR}/${WRKUNITDIR} && \
		${FIND} ${WRKSRC} -type d -name .svn | ${XARGS} ${RM} -r
.if ${PKGNAMESUFFIX:M-utils}
	${REINPLACE_CMD} -e '/globalunit/ s|\.\./packages|${FPCDIR}|' \
		${WRKDIR}/${WRKUNITDIR}/Makefile
.endif
.if ${PKGNAMESUFFIX:M-ide}
	${REINPLACE_CMD} -e '/globalunit/ s|\.\./\.\./packages|${FPCDIR}|' \
		${WRKDIR}/${WRKUNITDIR}/Makefile
.endif
.if ${PKGNAMESUFFIX:N-ide:N-utils}
	${REINPLACE_CMD} -e '/globalunit/ {s|\.\.|${FPCDIR}|;}' \
		${WRKDIR}/${WRKUNITDIR}/Makefile
.endif

post-patch:
.if ${PKGNAMESUFFIX} == "-fppkg"
	@${REINPLACE_CMD} -e 's|packages_${OPSYS:tl}=fcl-net fcl-web|packages_${OPSYS:tl}=fcl-net|g' \
		${WRKDIR}/${WRKUNITDIR}/Makefile.fpc
.endif
.if ${PKGNAMESUFFIX} == "-rtl-extra"
	@${REINPLACE_CMD} -e 's|android,linux,|android,linux,freebsd,dragonfly,|g' \
		${WRKDIR}/${WRKUNITDIR}/fpmake.pp
.endif
.if ${PKGNAMESUFFIX} == "-rtl-generics"
	@${REINPLACE_CMD} -e 's|googleapi|rtl-generics|g' \
		${WRKDIR}/${WRKUNITDIR}/Makefile.fpc \
		${WRKDIR}/${WRKUNITDIR}/Makefile
.endif