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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
|
# $NetBSD: Makefile,v 1.20 2014/05/15 09:50:44 marino Exp $
#
PKGNAME= gcc-aux-${SNAPSHOT}
DISTNAME= gcc-${GCC_VERSION}
PKGREVISION= 2
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
DISTFILES= ${DISTNAME}.tar.bz2
MAINTAINER= draco@marino.st
HOMEPAGE= http://www.dragonlace.net/
COMMENT= GNAT Ada compiler based on GCC ${GCC_BRANCH}
LICENSE= gnu-gpl-v3 AND gnu-lgpl-v3
LANGS= c ada c++
USE_TOOLS+= gmake sed:run perl makeinfo bzip2 patch pod2man tar
APPLY_DIFFS= core ada cxx
.include "Makefile.version"
.include "Makefile.testsuite"
.include "../../mk/bsd.prefs.mk"
.include "options.mk"
# Requires bootstrap compiler, which is only available for on selected systems
# Disable SunOS for now until multilib version can be built and tested.
ONLY_FOR_PLATFORM= DragonFly-*-* \
FreeBSD-*-i386 \
FreeBSD-*-x86_64 \
NetBSD-[5-9]*-i386 \
NetBSD-[5-9]*-x86_64 \
SunOS-5.1[1-9]*-i386 \
SunOS-5.1[1-9]*-x86_64
#ONLY_FOR_PLATFORM+= OpenBSD-*-amd64 MirBSD-*-amd64
GARCH= ${MACHINE_ARCH:S/amd64/x86_64/}
BLD_TARGET= ${GARCH}-aux-${LOWER_OPSYS}${OS_VERSION}
OS_LABEL4VERS= [${OPSYS}${GARCH:M*64:S/amd_//:S/x86_//}]
FULL_GNATGCC= NOT SET
FULL_PATH= /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/gcc-aux/bin:${PREFIX}/sbin:${PREFIX}/bin
.if ${OPSYS} == DragonFly
BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.dragonfly.36A.tar.bz2
.endif
.if ${OPSYS} == FreeBSD
MODERN_BINUTILS= yes
. if !empty(OS_VERSION:M[678].*)
BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.freebsd.84.tar.bz2
. else
BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.freebsd.100B.tar.bz2
. endif
.endif
.if ${OPSYS} == NetBSD
.if !empty(OS_VERSION:M6.99.*)
NSUFF= 7.0_DEV
.else
NSUFF= ${OS_VERSION}
.endif
.if ${GARCH} == i386
NELF= elf
.endif
XLDF= -lm
MODERN_BINUTILS= yes
BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.netbsd.614.tar.bz2
BLD_TARGET= ${MACHINE_ARCH}-aux-netbsd${NELF}${NSUFF}
.endif
.if ${OPSYS} == SunOS
SOL_OSV!= expr substr ${OS_VERSION} 3 2
BLD_TARGET= ${MACHINE_ARCH}-aux-${LOWER_OPSYS}2.${SOL_OSV}
BOOTSTRAP_COMPILER= ada-bootstrap.x86_64.solaris.511.tar.bz2
. if ${ABI} == 64
EXTRA_CONFARGS+= --enable-multilib
. else
COMPILER_ABI_SWITCH= -m32
. endif
MY_CONFIGURE_ENV+= OBJDUMP=${PREFIX}/bin/gobjdump
MODERN_BINUTILS=x yes
NATIVE_LINKER!= which ld
.endif
.if ${OPSYS} == OpenBSD || ${OPSYS} == MirBSD
OPENMIR= yes
MODERN_BINUTILS= yes
EXTRA_CONFARGS+= --disable-libstdcxx-pch
EXTRA_CONFARGS+= --disable-tls
EXTRA_CONFARGS+= --enable-cpp
EXTRA_CONFARGS+= --enable-wchar_t
BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.openbsd.55.tar.bz2
.endif
.if defined(MODERN_BINUTILS)
BUILDLINK_DEPMETHOD.binutils= full
.include "../../devel/binutils/buildlink3.mk"
EXTRA_CONFARGS+= --with-gnu-as --with-as=${PREFIX}/bin/gas
MY_CONFIGURE_ENV+= AR=${PREFIX}/bin/gar
MY_CONFIGURE_ENV+= AS=${PREFIX}/bin/gas
MY_CONFIGURE_ENV+= NM=${PREFIX}/bin/gnm
MY_CONFIGURE_ENV+= RANLIB=${PREFIX}/bin/granlib
. if defined(NATIVE_LINKER)
EXTRA_CONFARGS+= --without-gnu-ld --with-ld=${NATIVE_LINKER}
. else
EXTRA_CONFARGS+= --with-gnu-ld --with-ld=${PREFIX}/bin/gld.gold
MY_CONFIGURE_ENV+= LD=${PREFIX}/bin/gld.gold
. endif
.else
EXTRA_CONFARGS+= --with-gnu-ld --with-ld=/usr/bin/ld
EXTRA_CONFARGS+= --with-gnu-as --with-as=/usr/bin/as
.endif
# define some important directories and files
WRKSRC= ${WRKDIR}/gcc-${GCC_VERSION}
BUILDDIR= ${WRKDIR}/build
NEWBSDIR= ${WRKDIR}/newbs/bootstrap
SYSLIBDIR= ${WRKDIR}/lib
CFG_SCRIPT= ${WRKSRC}/configure
REVFILE= ${WRKSRC}/gcc/REVISION
BOOTSTRAP_PREFIX= ${WRKDIR}/bootstrap
PKG_PREFIX= ${PREFIX}/gcc-aux
BSFILENAME= ada-bootstrap.${GARCH}.${LOWER_OPSYS}.${OS_VERSION:C/[A-Z_.-]//g}.tar
# testing if gcc-aux is already installed - if so, use this compiler along with
# its gnatlink, gnatbind, and gnatmake rather than the older bootstrap versions
.if exists(${LOCALBASE}/gcc-aux/bin/ada)
FULL_GNATGCC=${LOCALBASE}/gcc-aux/bin/ada
FULL_GNATGXX=${LOCALBASE}/gcc-aux/bin/g++
.endif
.if ${FULL_GNATGCC} == "NOT SET"
# here we know we need to install the bootstrap compiler
. if defined(BOOTSTRAP_TRIPLET)
FULL_GNATGCC=${BOOTSTRAP_PREFIX}/bin/gnatgcc
. else
FULL_GNATGCC=${BOOTSTRAP_PREFIX}/bin/gcc ${COMPILER_ABI_SWITCH}
FULL_GNATGXX=${BOOTSTRAP_PREFIX}/bin/g++ ${COMPILER_ABI_SWITCH}
. endif
DISTFILES+= ${BOOTSTRAP_COMPILER}
SITES.${BOOTSTRAP_COMPILER}= http://downloads.dragonlace.net/src/
FULL_PATH=${BOOTSTRAP_PREFIX}/bin:/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin
.endif
# for port maintenance, invoke "make mdi PLUS_BOOTSTRAPS=1"
.if defined(PLUS_BOOTSTRAPS)
MASTER_SITES= http://downloads.dragonlace.net/src/ \
${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
DISTFILES= \
${DISTNAME}.tar.bz2 \
ada-bootstrap.i386.dragonfly.36A.tar.bz2 \
ada-bootstrap.i386.freebsd.84.tar.bz2 \
ada-bootstrap.i386.freebsd.100B.tar.bz2 \
ada-bootstrap.i386.netbsd.614.tar.bz2 \
ada-bootstrap.x86_64.dragonfly.36A.tar.bz2 \
ada-bootstrap.x86_64.freebsd.84.tar.bz2 \
ada-bootstrap.x86_64.freebsd.100B.tar.bz2 \
ada-bootstrap.x86_64.netbsd.614.tar.bz2 \
ada-bootstrap.x86_64.openbsd.55.tar.bz2 \
ada-bootstrap.x86_64.solaris.511.tar.bz2
.endif
# establish ada-aware compiler for use
MY_CONFIGURE_ENV+= CC=${FULL_GNATGCC:Q}
MY_CONFIGURE_ENV+= CXX=${FULL_GNATGXX:Q}
MY_CONFIGURE_ENV+= PATH=${FULL_PATH}
MY_CONFIGURE_ENV+= LDFLAGS="${XLDF} ${COMPILER_RPATH_FLAG}${PREFIX}/lib"
MY_MAKE_ENV+= PATH=${FULL_PATH}
MY_MAKE_ENV+= LD_LIBRARY_PATH=${BUILDDIR}/gcc${EXTRA_LLP}
# ${WRKSRC}/fixincludes/ looks for sed and compiles the path to sed into
# a binary so we need to make sure we give it the installed sed and not
# the tool wrapped one.
MY_MAKE_ENV+= ac_cv_path_SED=${TOOLS_SED}
MY_MAKE_ENV+= lt_cv_path_SED=${TOOLS_SED}
# The standard configuration options
CONFIGURE_ARGS= --enable-languages=${LANGS:Q}
CONFIGURE_ARGS+= --build=${BLD_TARGET}
CONFIGURE_ARGS+= --prefix=${PKG_PREFIX:Q}
CONFIGURE_ARGS+= --enable-threads=posix
CONFIGURE_ARGS+= --enable-checking=release
CONFIGURE_ARGS+= --disable-libmudflap
CONFIGURE_ARGS+= --disable-libgomp
CONFIGURE_ARGS+= --disable-libssp
CONFIGURE_ARGS+= ${EXTRA_CONFARGS}
# Automatic package list generation
GENERATE_PLIST= cd ${DESTDIR}${PREFIX};
GENERATE_PLIST+= ${FIND} * \( -type f -or -type l \) | ${SORT} -dr;
post-extract:
# Personalize GNAT for each different machine
@${ECHO} "-=> GCC AUX ${OS_LABEL4VERS}" > ${REVFILE}
# Create new directories in preparation of applying diff files
${MKDIR} ${WRKSRC}/libstdc++-v3/config/locale/dragonfly
${MKDIR} ${WRKSRC}/libstdc++-v3/config/os/bsd/dragonfly
# Apply required composite diff files
.for suffix in ${APPLY_DIFFS}
@${ECHO} "Applying composite patch diff-${suffix}"
${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-${suffix}
.endfor
(cd ${WRKSRC}/libstdc++-v3/testsuite && ${PERL5} -i \
-pe 's|\*-\*-freebsd\*|*-*-dragonfly* *-*-freebsd*|' ${CXXTS4DF})
(cd ${WRKSRC}/libstdc++-v3/testsuite/22_locale && ${PERL5} -i \
-pe 's|ISO-8859|ISO8859|g;' \
-pe 's|ja_JP.eucjp|ja_JP.eucJP|g;' \
-pe 's|en_HK|zh_HK|g;' \
-pe 's|en_PH|en_NZ|g;' \
-pe 's|se_NO|no_NO|g;' \
-pe 's|es_MX|es_ES|g;' \
-pe 's|ru_RU.UTF8|ru_RU.UTF-8|g' ${LOCALE22FIX})
.if defined(STATIC_BUILD) || !empty(PKG_OPTIONS:Mbootstrap)
. if ${OPSYS} != SunOS
# Ensure GNAT tools are built statically
${PERL5} -pi -e 's/^GCC_LINK_FLAGS=.*/GCC_LINK_FLAGS=-static/' \
${WRKSRC}/gcc/ada/gcc-interface/Makefile.in
. endif
.else
. if defined(OPENMIR)
# OpenBSD has no system libraries ending in ".so" so the pkgsrc linker
# fails to link things like "-lutil -lm". Work around this oddity.
${MKDIR} ${SYSLIBDIR}
. for sl in c m z util pthread
${LN} -s `ls /usr/lib/lib${sl}.so* | head -1` ${SYSLIBDIR}/lib${sl}.so
. endfor
${PERL5} -i.bak -pe 's|\$$\(MISCLIB\)|-L${SYSLIBDIR} \$$(MISCLIB)|g;' \
-pe 's|\$$\(THREADSLIB\)|-L${SYSLIBDIR} \$$(THREADSLIB)|g' \
${WRKSRC}/gcc/ada/gcc-interface/Makefile.in
${PERL5} -i.bak -pe 's|-lm|-L${SYSLIBDIR} -lm|g' \
${WRKSRC}/libquadmath/Makefile.in \
${WRKSRC}/libgfortran/Makefile.in
${PERL5} -i.bak -pe 's|-lpthread|-L${SYSLIBDIR} -lpthread|g;' \
-pe 's|\@XCFLAGS\@|-L${SYSLIBDIR} \@XCFLAGS\@|g;' \
${WRKSRC}/libcilkrts/Makefile.in \
${WRKSRC}/libitm/Makefile.in
. endif
.endif
.if !exists(${LOCALBASE}/gcc-aux/bin/ada) && ${OPSYS} == SunOS
# In case /usr/pkg/bin/gas doesn't exist, establish fallback
${LN} -s ${PREFIX}/bin/gas ${BOOTSTRAP_PREFIX}/bin/as
.endif
# Illumos /usr/ccs binaries are symlinked to /usr/bin
# elfdump was present on OmniOS but not in Joyent dev area
${PERL5} -i -pe 's|/usr/ccs/bin|/usr/bin|g;' \
-pe 's|readelf -s|greadelf -s|' ${WRKSRC}/contrib/make_sunver.pl
# Update LINK_SPEC to add gcc-aux lib runpath in every binary
@${ECHO} "Configuring LINK_SPEC runpath"
${PERL5} -pi -e 's;\@PREFIX\@;${PREFIX};' \
${WRKSRC}/gcc/config/dragonfly.h \
${WRKSRC}/gcc/config/i386/freebsd.h \
${WRKSRC}/gcc/config/i386/netbsd-elf.h
.if defined(BOOTSTRAP_TRIPLET)
# Bootstrap compiler has statically linked z, gmp, mpc, mpfr and iconv
# The only shared lib is libc.so.7, so it should work for a long time.
# No longer used, only here to support future SunOS bootstrap generation
${MKDIR} ${BOOTSTRAP_PREFIX}
${MV} ${BOOTSTRAP_PREFIX}/../bin ${BOOTSTRAP_PREFIX}
${MV} ${BOOTSTRAP_PREFIX}/../lib ${BOOTSTRAP_PREFIX}
${MV} ${BOOTSTRAP_PREFIX}/../libexec ${BOOTSTRAP_PREFIX}
${RM} -rf ${BOOTSTRAP_PREFIX}/lib/gcc/${BOOTSTRAP_TRIPLET}/include-fixed
.endif
do-configure:
${MKDIR} ${BUILDDIR}
cd ${BUILDDIR} && ${SETENV} ${MY_CONFIGURE_ENV} \
${CFG_SCRIPT} ${CONFIGURE_ARGS}
do-build:
# The unlimited stacksize is for NetBSD64
cd ${BUILDDIR} && \
${ULIMIT_CMD_stacksize} && \
${SETENV} ${MY_MAKE_ENV} ${GMAKE} -j${MAKE_JOBS:U1:Q} all
.if !empty(PKG_OPTIONS:Mtestsuite) && empty(PKG_OPTIONS:Mbootstrap)
do-test: build test-ada test-fortran test-objc test-cxx test-c
test-ada:
.if (${OPSYS} == NetBSD) && (${MACHINE_ARCH} == x86_64)
# NetBSD has an extremely small default stacksize of 2MB, which is
# insufficient for the gnat.dg testsuite.
# specifically: entry_queues test on AMD64
# Unlimiting stack resources on i386-netbsdelf* will result in
# failure of gnat.dg/task_stack_align.adb execution test.
cd ${BUILDDIR} && \
${ULIMIT_CMD_stacksize} && \
${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-ada
.else
cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} DEJAGNU_TIMEOUT=30 \
${GMAKE} -sk check-ada
.endif
test-fortran:
.if !empty(PKG_OPTIONS:Mfortran)
cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-fortran
.endif
test-objc:
.if !empty(PKG_OPTIONS:Mobjc)
cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-objc
.endif
test-cxx:
# libstdc++ always ends with error status, so ignore it
cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk \
check-c++ || ${TRUE}
test-c:
cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-c
.endif
do-install:
cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} install-strip \
DESTDIR=${DESTDIR}
${MV} ${DESTDIR}${PKG_PREFIX}/share ${WRKDIR}/moved_share
.if !empty(PKG_OPTIONS:Mbootstrap)
create-bootstrap: stage-install
${MKDIR} ${NEWBSDIR}
${CP} -RpP ${DESTDIR}${PKG_PREFIX}/bin ${NEWBSDIR}/
${CP} -RpP ${DESTDIR}${PKG_PREFIX}/lib ${NEWBSDIR}/
${CP} -RpP ${DESTDIR}${PKG_PREFIX}/include ${NEWBSDIR}/
${CP} -RpP ${DESTDIR}${PKG_PREFIX}/libexec ${NEWBSDIR}/
${RM} ${NEWBSDIR}/bin/${GARCH}*
${RM} -rf ${NEWBSDIR}/lib/gcc/${BLD_TARGET}/${GCC_VERSION}/include-fixed
(cd ${NEWBSDIR}/.. ; \
${TAR} -cf ${BSFILENAME} bootstrap; ${BZIP2} ${BSFILENAME})
.endif
.include "../../mk/bsd.pkg.mk"
|