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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
PORTNAME= fpc
PORTVERSION= 3.2.2
PORTREVISION= 5
CATEGORIES= lang
MASTER_SITES= SF/freepascal/Source/${PORTVERSION}:source \
https://downloads.freepascal.org/${PORTNAME}/dist/${PORTVERSION}/source/:source \
http://leaf.dragonflybsd.org/~marino/dports-src/:DragonFlybootstrap \
LOCAL/acm/freepascal/:bootstrap \
LOCAL/acm/freepascal/:man
DISTFILES= ${DISTNAME:S/$/.source/}${EXTRACT_SUFX}:source
DIST_SUBDIR= freepascal
MAINTAINER= acm@FreeBSD.org
COMMENT= Free Pascal compiler with Turbo and Delphi compatibility
WWW= https://www.freepascal.org/
CONFLICTS= fpc-devel
RUN_DEPENDS= ${LOCALBASE}/bin/as:devel/binutils
ONLY_FOR_ARCHS= amd64 i386
USES+= gmake iconv
USE_BINUTILS= yes
BOOTVER= ${PORTVERSION}
MANVER= ${PORTVERSION}
FPC_LDPATH?= "${LOCALBASE}/bin/ld.bfd"
FPCSRCDIR= ${PORTNAME}-${PORTVERSION}
.include <bsd.port.pre.mk>
.if ${ARCH} == "i386"
PPNAME= ppc386
FPC_ARCH= i386
#OPT= "-dFPC_USE_LIBC"
PLIST_SUB+= FPC_I386="" \
FPC_AMD64="@comment "
.elif ${ARCH} == "amd64"
PPNAME= ppcx64
FPC_ARCH= x86_64
#OPT= "-dFPC_USE_LIBC"
PLIST_SUB+= FPC_I386="@comment " \
FPC_AMD64=""
.endif
.if ${OPSYS} == FreeBSD
PLIST_SUB+= FREEBSD=""
.else
PLIST_SUB+= FREEBSD="@comment "
.endif
SUB_FILES= pkg-message
BUILDNAME= ${FPC_ARCH}-${OPSYS:tl}
PLIST_SUB+= PORTVERSION=${PORTVERSION} \
BUILDNAME=${BUILDNAME}
DISTFILES+= ${BOOTDIR}.tar.gz:${OPSYS:MDragonFly}bootstrap \
fpc-${MANVER}.man.tar.gz:man
NEWFPCMAKE= ${WRKDIR}/${FPCSRCDIR}/utils/fpcm/bin/${BUILDNAME}/fpcmake
MAKE_ARGS+= FPCMAKE=${NEWFPCMAKE} \
FPCTARGET=${BUILDNAME} \
ARCH=${FPC_ARCH} \
OPT="${OPT}" \
BSDHIER=1 \
INSTALL="${INSTALL_DATA} -p" \
INSTALLEXE="${INSTALL_PROGRAM}" \
INSTALLSCR="${INSTALL_SCRIPT}" \
INSTALL_PREFIX=${STAGEDIR}${PREFIX} \
FPC_LDPATH=${FPC_LDPATH}
NEWPPC= PP=${WRKSRC}/compiler/${PPNAME}
NEWFPC= FPC=${WRKSRC}/compiler/${PPNAME}
BOOTDIR= ${PPNAME}-${BOOTVER}-${OPSYS:tl}
BOOTPPC= PP=${WRKDIR}/${BOOTDIR}
do-extract:
# unpack binary distribution
@${MKDIR} ${WRKDIR}
@${TAR} -xzf ${_DISTDIR}/${BOOTDIR}.tar.gz \
--directory ${WRKDIR} && ${CHMOD} +x ${WRKDIR}/${BOOTDIR}
# unpack man files
@${TAR} -xzf ${_DISTDIR}/fpc-${MANVER}.man.tar.gz --directory ${WRKDIR}
# unpack source distribution
@(cd ${WRKDIR} && ${GZIP_CMD} -dc \
${_DISTDIR}/${DISTNAME:S/$/.source/}${EXTRACT_SUFX} | \
${TAR} -xf -)
post-patch:
.if ${OPSYS} == FreeBSD
@${REINPLACE_CMD} -i "" -e 's|900044|${OSVERSION}|g' \
${WRKSRC}/rtl/freebsd/${FPC_ARCH}/*.as \
${WRKSRC}/rtl/freebsd/${FPC_ARCH}/*.inc
.else
@${REINPLACE_CMD} -i "" -e 's|400000|${DFLYVERSION}|g' \
${WRKSRC}/rtl/dragonfly/${FPC_ARCH}/*.as
.endif
.if empty(ICONV_LIB)
@${REINPLACE_CMD} -e "s|s<>'c'|(s<>'c') and (s<>'iconv')|" \
-e "s|%%FPC_LDPATH%%|${FPC_LDPATH}|g" \
${WRKDIR}/${FPCSRCDIR}/compiler/systems/t_bsd.pas
@${REINPLACE_CMD} -e 's|defined(bsd) and not ||' \
${WRKDIR}/${FPCSRCDIR}/rtl/unix/cwstring.pp
.endif
@${REINPLACE_CMD} -e '/samplecfg/ {s/INSTALLEXE/INSTALLSCR/;}' \
${WRKDIR}/${FPCSRCDIR}/compiler/Makefile
@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' \
${WRKDIR}/${FPCSRCDIR}/packages/fpmkunit/src/fpmkunit.pp
# enable units
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/a52/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/dts/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|freebsd,||g' \
${WRKSRC}/packages/fpgtk/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|iphonesim|freebsd,iphonesim|g' \
${WRKSRC}/packages/gnome1/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|iphonesim|freebsd,iphonesim|g' \
${WRKSRC}/packages/gtk1/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|iphonesim|freebsd,iphonesim|g' \
${WRKSRC}/packages/imlib/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/ldap/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/libsee/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/lua/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/mad/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/modplug/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/newt/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/oggvorbis/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/openal/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/opencl/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/proj4/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|os2|freebsd,os2|g' \
${WRKSRC}/packages/rexx/fpmake.pp
@${REINPLACE_CMD} -i "" -e 's|linux|freebsd,linux|g' \
${WRKSRC}/packages/zorba/fpmake.pp
do-build:
# build fpc compiler
@${ECHO_MSG} "##### STARTING COMPILER #####"
(cd ${WRKDIR}/${FPCSRCDIR}/compiler && ${SETENV} ${MAKE_ENV} \
${MAKE_CMD} cycle ${MAKE_ARGS} ${BOOTPPC})
@${ECHO_MSG} "##### COMPLETE COMPILER #####"
# build units
@${ECHO_MSG} "##### STARTING UNITS #####"
(cd ${WRKDIR}/${FPCSRCDIR} && ${SETENV} ${MAKE_ENV} \
${MAKE_CMD} build ${MAKE_ARGS} ${BOOTPPC})
@${ECHO_MSG} "##### COMPLETE UNITS #####"
do-install:
# Installing fpc compiler
(cd ${WRKDIR}/${FPCSRCDIR} && ${SETENV} ${MAKE_ENV} \
${MAKE_CMD} install ${MAKE_ARGS} ${BOOTPPC})
# Installing manpages
${INSTALL_MAN} ${WRKDIR}/man/man1/* ${STAGEDIR}${MAN1PREFIX}/man/man1
${INSTALL_MAN} ${WRKDIR}/man/man5/* ${STAGEDIR}${MAN1PREFIX}/man/man5
# symlinking compiler
(cd ${STAGEDIR}${PREFIX}/bin && ${LN} -sf ../lib/fpc/${PORTVERSION}/${PPNAME})
# creating sample configuration file
${SH} "${STAGEDIR}${PREFIX}/lib/fpc/${PORTVERSION}/samplecfg" \
"${STAGEDIR}${PREFIX}/lib/fpc/${PORTVERSION}" \
"${STAGEDIR}${PREFIX}/etc"
@${REINPLACE_CMD} -i "" -e 's|${STAGEDIR}||' \
-e 's|^#-Fl/lib;/usr/lib|-Fl${LOCALBASE}/lib;${LOCALBASE}/lib/qt5;${LOCALBASE}/lib/qt6|g' \
${STAGEDIR}${PREFIX}/etc/fpc.cfg.sample
.include <bsd.port.post.mk>
|