Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-devel/gcc-apple: gcc-apple-4.0.1_p5490-r2.ebuild gcc-apple-3.5.0_p3506-r1.ebuild ChangeLog gcc-apple-4.0.1_p5493.ebuild metadata.xml gcc-apple-4.2.1_p5574.ebuild gcc-apple-4.2.1_p5566-r2.ebuild
Date: Sun, 21 Jun 2009 10:27:59
Message-Id: E1MIKHD-0006Yc-7n@stork.gentoo.org
1 grobian 09/06/21 10:27:55
2
3 Added: gcc-apple-4.0.1_p5490-r2.ebuild
4 gcc-apple-3.5.0_p3506-r1.ebuild ChangeLog
5 gcc-apple-4.0.1_p5493.ebuild metadata.xml
6 gcc-apple-4.2.1_p5574.ebuild
7 gcc-apple-4.2.1_p5566-r2.ebuild
8 Log:
9 add sys-devel/gcc-apple from Gentoo Prefix tree
10 (Portage version: 2.1.6.13/cvs/Linux x86_64)
11
12 Revision Changes Path
13 1.1 sys-devel/gcc-apple/gcc-apple-4.0.1_p5490-r2.ebuild
14
15 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.0.1_p5490-r2.ebuild?rev=1.1&view=markup
16 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.0.1_p5490-r2.ebuild?rev=1.1&content-type=text/plain
17
18 Index: gcc-apple-4.0.1_p5490-r2.ebuild
19 ===================================================================
20 # Copyright 1999-2009 Gentoo Foundation
21 # Distributed under the terms of the GNU General Public License v2
22 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.0.1_p5490-r2.ebuild,v 1.1 2009/06/21 10:27:55 grobian Exp $
23
24 ETYPE="gcc-compiler"
25
26 inherit eutils toolchain prefix
27
28 GCC_VERS=${PV/_p*/}
29 APPLE_VERS=${PV/*_p/}
30 DESCRIPTION="Apple branch of the GNU Compiler Collection, Xcode Tools 3.1.2"
31 HOMEPAGE="http://gcc.gnu.org"
32 SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz"
33 LICENSE="APSL-2 GPL-2"
34
35 if is_crosscompile; then
36 SLOT="${CTARGET}-40"
37 else
38 SLOT="40"
39 fi
40
41 KEYWORDS="~ppc-macos ~x86-macos"
42
43 IUSE="nls objc objc++ nocxx"
44
45 RDEPEND=">=sys-libs/zlib-1.1.4
46 >=sys-libs/ncurses-5.2-r2
47 nls? ( sys-devel/gettext )"
48 DEPEND="${RDEPEND}
49 >=sys-apps/texinfo-4.2-r4
50 >=sys-devel/bison-1.875
51 ${CATEGORY}/binutils-apple"
52
53 S=${WORKDIR}/gcc-${APPLE_VERS}
54
55 # TPREFIX is the prefix of the CTARGET installation
56 export TPREFIX=${TPREFIX:-${EPREFIX}}
57
58 LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
59 if is_crosscompile ; then
60 BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
61 else
62 BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
63 fi
64 STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
65
66 src_unpack() {
67 unpack ${A}
68 cd "${S}"
69 # we use our libtool
70 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
71 gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
72 # add prefixed Frameworks to default search paths (may want to change this
73 # in a cross-compile)
74 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
75 gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
76
77 # Workaround deprecated "+Nc" syntax for GNU tail(1)
78 sed -i -e "s:tail +16c:tail -c +16:g" \
79 gcc/Makefile.in || die "sed gcc/Makefile.in failed."
80
81 epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
82
83 epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
84 eprefixify "${S}"/gcc/gcc.c
85 }
86
87 src_compile() {
88 local langs="c"
89 use nocxx || langs="${langs},c++"
90 use objc && langs="${langs},objc"
91 use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
92
93 local myconf="${myconf} \
94 --prefix=${EPREFIX}/usr \
95 --bindir=${BINPATH} \
96 --includedir=${LIBPATH}/include \
97 --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
98 --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
99 --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
100 --with-gxx-include-dir=${STDCXX_INCDIR} \
101 --host=${CHOST}
102 --enable-version-specific-runtime-libs"
103
104 if is_crosscompile ; then
105 # Straight from the GCC install doc:
106 # "GCC has code to correctly determine the correct value for target
107 # for nearly all native systems. Therefore, we highly recommend you
108 # not provide a configure target when configuring a native compiler."
109 myconf="${myconf} --target=${CTARGET}"
110
111 # Tell compiler where to find what it needs
112 myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
113
114 # Set this to something sane for both native and target
115 CFLAGS="-O2 -pipe"
116
117 local VAR="CFLAGS_"${CTARGET//-/_}
118 CXXFLAGS=${!VAR}
119 fi
120 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
121
122 # Native Language Support
123 if use nls ; then
124 myconf="${myconf} --enable-nls --without-included-gettext"
125 else
126 myconf="${myconf} --disable-nls"
127 fi
128
129 # reasonably sane globals (hopefully)
130 myconf="${myconf} \
131 --with-system-zlib \
132 --disable-checking \
133 --disable-werror"
134
135 # languages to build
136 myconf="${myconf} --enable-languages=${langs}"
137
138 # ???
139 myconf="${myconf} --enable-shared --enable-threads=posix"
140
141 # make clear we're in an offset
142 use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
143
144 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
145 # want it to use
146 myconf="${myconf} \
147 --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
148 --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
149
150 # make sure we never do multilib stuff, for that we need a different Prefix
151 [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
152 && myconf="${myconf} --disable-multilib"
153
154 # The produced libgcc_s.dylib is faulty if using a bit too much
155 # optimisation. Nail it down to something sane
156 CFLAGS="-O2 -pipe"
157 CXXFLAGS=${CFLAGS}
158
159 # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
160 # (won't hurt if already 64-bits, but is essential when coming from a
161 # multilib compiler -- the default)
162 [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
163 export CC="gcc -m64"
164
165 mkdir -p "${WORKDIR}"/build
166 cd "${WORKDIR}"/build
167 einfo "Configuring GCC with: ${myconf//--/\n\t--}"
168 "${S}"/configure ${myconf} || die "conf failed"
169 emake bootstrap || die "emake failed"
170 }
171
172 src_install() {
173 local ED=${ED-${D}}
174
175 cd "${WORKDIR}"/build
176 # -jX doesn't work
177 emake -j1 DESTDIR="${D}" install || die
178
179 # Punt some tools which are really only useful while building gcc
180 find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
181 # This one comes with binutils
182 find "${ED}" -name libiberty.a -exec rm -f "{}" \;
183
184 # Basic sanity check
185 if ! is_crosscompile ; then
186 local EXEEXT
187 eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
188 [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
189 fi
190
191 # create gcc-config entry
192 dodir /etc/env.d/gcc
193 local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
194
195 gcc_envd_file="${ED}${gcc_envd_base}"
196
197 # phase PATH/ROOTPATH out ...
198 echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
199 echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
200 echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
201
202 # we don't do multilib
203 LDPATH="${LIBPATH}"
204 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
205 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
206 echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
207 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
208 is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
209
210 # Move <cxxabi.h> to compiler-specific directories
211 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
212 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
213
214 # These should be symlinks
215 dodir /usr/bin
216 cd "${D}"${BINPATH}
217 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
218 # For some reason, g77 gets made instead of ${CTARGET}-g77...
219 # this should take care of that
220 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
221
222 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
223 ln -sf ${CTARGET}-${x} ${x}
224
225 # Create version-ed symlinks
226 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
227 /usr/bin/${CTARGET}-${x}-${GCC_VERS}
228 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
229 /usr/bin/${x}-${GCC_VERS}
230 fi
231
232 if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
233 rm -f ${CTARGET}-${x}-${GCC_VERS}
234 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
235 fi
236 done
237
238 # I do not know if this will break gcj stuff, so I'll only do it for
239 # objc for now; basically "ffi.h" is the correct file to include,
240 # but it gets installed in .../GCCVER/include and yet it does
241 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
242 # is installed in .../GCCVER/include/libffi; the following fixes
243 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@g.o>
244 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
245 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
246 rm -r "${D}"${LIBPATH}/include/libffi || die
247 fi
248
249 # Now do the fun stripping stuff
250 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
251 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
252 # gcc used to install helper binaries in lib/ but then moved to libexec/
253 [[ -d ${ED}/usr/libexec/gcc ]] && \
254 env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
255
256 # prune empty dirs left behind
257 find "${ED}" -type d | xargs rmdir >& /dev/null
258 }
259
260 pkg_postinst() {
261 # beware this also switches when it's on another branch version of GCC
262 gcc-config ${CTARGET}-${GCC_VERS}
263 }
264
265 pkg_postrm() {
266 local EROOT=${EROOT-${ROOT}}
267
268 # clean up the cruft left behind by cross-compilers
269 if is_crosscompile ; then
270 if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
271 rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
272 rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
273 rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
274 fi
275 return 0
276 fi
277 }
278
279
280
281 1.1 sys-devel/gcc-apple/gcc-apple-3.5.0_p3506-r1.ebuild
282
283 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-3.5.0_p3506-r1.ebuild?rev=1.1&view=markup
284 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-3.5.0_p3506-r1.ebuild?rev=1.1&content-type=text/plain
285
286 Index: gcc-apple-3.5.0_p3506-r1.ebuild
287 ===================================================================
288 # Copyright 1999-2009 Gentoo Foundation
289 # Distributed under the terms of the GNU General Public License v2
290 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/gcc-apple-3.5.0_p3506-r1.ebuild,v 1.1 2009/06/21 10:27:55 grobian Exp $
291
292 inherit eutils
293
294 GCC_VERS=${PV/_p*/}
295 APPLE_VERS=${PV/*_p/}
296 DESCRIPTION="Apple branch of the GNU Compiler Collection"
297 HOMEPAGE="http://gcc.gnu.org"
298 SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc_os_35-${APPLE_VERS}.tar.gz"
299
300 LICENSE="APSL-2 GPL-2"
301 SLOT="35"
302
303 KEYWORDS="~ppc-macos"
304
305 IUSE="nls fortran objc nocxx"
306
307 RDEPEND=">=sys-libs/zlib-1.1.4
308 >=sys-libs/ncurses-5.2-r2
309 nls? ( sys-devel/gettext )
310 >=sys-devel/gcc-config-1.3.12-r4"
311 DEPEND="${RDEPEND}
312 >=sys-apps/texinfo-4.2-r4
313 >=sys-devel/bison-1.875
314 sys-devel/binutils-apple"
315
316 S=${WORKDIR}/gcc_os_35-${APPLE_VERS}
317
318 src_unpack() {
319 unpack ${A}
320 cd "${S}"
321 # we use our libtool
322 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/libtool:" \
323 gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
324 # add prefixed Frameworks to default search paths
325 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
326 gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
327
328 # Workaround deprecated "+Nc" syntax for GNU tail(1)
329 sed -i -e "s:tail +16c:tail -c +16:g" \
330 gcc/Makefile.in || die "sed gcc/Makefile.in failed."
331 }
332
333 src_compile() {
334 local langs="c"
335 use nocxx || langs="${langs},c++"
336 use fortran && langs="${langs},f77"
337 use objc && langs="${langs},objc"
338
339 local myconf="${myconf} \
340 --prefix=${EPREFIX}/usr \
341 --bindir=${EPREFIX}/usr/${CHOST}/gcc-bin/${GCC_VERS} \
342 --includedir=${EPREFIX}/usr/lib/gcc/${CHOST}/${GCC_VERS}/include \
343 --datadir=${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS} \
344 --mandir=${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man \
345 --infodir=${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info \
346 --with-gxx-include-dir=${EPREFIX}/usr/lib/gcc/${CHOST}/${GCC_VERS}/include/g++-v${GCC_VERS/\.*/} \
347 --host=${CHOST} \
348 --enable-version-specific-runtime-libs"
349 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
350
351 # Straight from the GCC install doc:
352 # "GCC has code to correctly determine the correct value for target
353 # for nearly all native systems. Therefore, we highly recommend you
354 # not provide a configure target when configuring a native compiler."
355
356 # Native Language Support
357 if use nls ; then
358 myconf="${myconf} --enable-nls --without-included-gettext"
359 else
360 myconf="${myconf} --disable-nls"
361 fi
362
363 # reasonably sane globals (hopefully)
364 # --disable-libunwind-exceptions needed till unwind sections get fixed. see ps.m for details
365 myconf="${myconf} \
366 --with-system-zlib \
367 --disable-checking \
368 --disable-werror \
369 --disable-libunwind-exceptions"
370
371 # languages to build
372 myconf="${myconf} --enable-languages=${langs}"
373
374 # ???
375 myconf="${myconf} --enable-shared --enable-threads=posix"
376
377 # make clear we're in an offset
378 use prefix && myconf="${myconf} --with-local-prefix=${EPREFIX}/usr"
379
380 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
381 # want it to use
382 myconf="${myconf} \
383 --with-as=${EPREFIX}/usr/bin/as \
384 --with-ld=${EPREFIX}/usr/bin/ld"
385
386 mkdir -p "${WORKDIR}"/build
387 cd "${WORKDIR}"/build
388 einfo "Configuring GCC with: ${myconf//--/\n\t--}"
389 "${S}"/configure ${myconf} || die "conf failed"
390 make -j1 bootstrap || die "emake failed"
391 }
392
393 src_install() {
394 local ED=${ED-${D}}
395
396 cd "${WORKDIR}"/build
397 make DESTDIR="${D}" install || die
398
399 use build && rm -rf "${ED}"/usr/{man,share}
400 find "${ED}" -name libiberty.a -exec rm -f {} \;
401
402 # create gcc-config entry
403 dodir /etc/env.d/gcc
404 local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
405
406 gcc_envd_file="${ED}${gcc_envd_base}"
407
408 echo "PATH=\"${EPREFIX}/usr/${CHOST}/gcc-bin/${GCC_VERS}\"" > ${gcc_envd_file}
409 echo "ROOTPATH=\"${EPREFIX}/usr/${CHOST}/gcc-bin/${GCC_VERS}\"" >> ${gcc_envd_file}
410
411 LDPATH="${EPREFIX}/usr/lib/gcc/${CHOST}/${GCC_VERS}"
412 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
413
414 BITS=$(${ED}/usr/${CHOST}/gcc-bin/${GCC_VERS}/gcc -dumpspecs | grep -A1 multilib: | tail -n1 | grep -o 64 | head -n1)
415 [[ -z ${BITS} ]] \
416 && BITS="32" \
417 || BITS="32 ${BITS}"
418 echo "GCCBITS=\"${BITS}\"" >> ${gcc_envd_file}
419
420 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
421 echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
422 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
423 }
424
425 pkg_postinst() {
426 # beware this also switches when it's on another branch version of GCC
427 gcc-config ${CHOST}-${GCC_VERS}
428 }
429
430
431
432 1.5 sys-devel/gcc-apple/ChangeLog
433
434 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/ChangeLog?rev=1.5&view=markup
435 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/ChangeLog?rev=1.5&content-type=text/plain
436 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/ChangeLog?r1=1.4&r2=1.5
437
438
439
440
441 1.1 sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild
442
443 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild?rev=1.1&view=markup
444 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild?rev=1.1&content-type=text/plain
445
446 Index: gcc-apple-4.0.1_p5493.ebuild
447 ===================================================================
448 # Copyright 1999-2009 Gentoo Foundation
449 # Distributed under the terms of the GNU General Public License v2
450 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.0.1_p5493.ebuild,v 1.1 2009/06/21 10:27:55 grobian Exp $
451
452 ETYPE="gcc-compiler"
453
454 inherit eutils toolchain prefix
455
456 GCC_VERS=${PV/_p*/}
457 APPLE_VERS=${PV/*_p/}
458 DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 3.1.3"
459 HOMEPAGE="http://gcc.gnu.org"
460 SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz"
461 LICENSE="APSL-2 GPL-2"
462
463 if is_crosscompile; then
464 SLOT="${CTARGET}-40"
465 else
466 SLOT="40"
467 fi
468
469 KEYWORDS="~ppc-macos ~x86-macos"
470
471 IUSE="nls objc objc++ nocxx"
472
473 RDEPEND=">=sys-libs/zlib-1.1.4
474 >=sys-libs/ncurses-5.2-r2
475 nls? ( sys-devel/gettext )"
476 DEPEND="${RDEPEND}
477 >=sys-apps/texinfo-4.2-r4
478 >=sys-devel/bison-1.875
479 ${CATEGORY}/binutils-apple"
480
481 S=${WORKDIR}/gcc-${APPLE_VERS}
482
483 # TPREFIX is the prefix of the CTARGET installation
484 export TPREFIX=${TPREFIX:-${EPREFIX}}
485
486 LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
487 if is_crosscompile ; then
488 BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
489 else
490 BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
491 fi
492 STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
493
494 src_unpack() {
495 unpack ${A}
496 cd "${S}"
497 # we use our libtool
498 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
499 gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
500 # add prefixed Frameworks to default search paths (may want to change this
501 # in a cross-compile)
502 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
503 gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
504
505 # Workaround deprecated "+Nc" syntax for GNU tail(1)
506 sed -i -e "s:tail +16c:tail -c +16:g" \
507 gcc/Makefile.in || die "sed gcc/Makefile.in failed."
508
509 epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
510
511 epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
512 eprefixify "${S}"/gcc/gcc.c
513 }
514
515 src_compile() {
516 local langs="c"
517 use nocxx || langs="${langs},c++"
518 use objc && langs="${langs},objc"
519 use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
520
521 local myconf="${myconf} \
522 --prefix=${EPREFIX}/usr \
523 --bindir=${BINPATH} \
524 --includedir=${LIBPATH}/include \
525 --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
526 --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
527 --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
528 --with-gxx-include-dir=${STDCXX_INCDIR} \
529 --host=${CHOST}
530 --enable-version-specific-runtime-libs"
531
532 if is_crosscompile ; then
533 # Straight from the GCC install doc:
534 # "GCC has code to correctly determine the correct value for target
535 # for nearly all native systems. Therefore, we highly recommend you
536 # not provide a configure target when configuring a native compiler."
537 myconf="${myconf} --target=${CTARGET}"
538
539 # Tell compiler where to find what it needs
540 myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
541
542 # Set this to something sane for both native and target
543 CFLAGS="-O2 -pipe"
544
545 local VAR="CFLAGS_"${CTARGET//-/_}
546 CXXFLAGS=${!VAR}
547 fi
548 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
549
550 # Native Language Support
551 if use nls ; then
552 myconf="${myconf} --enable-nls --without-included-gettext"
553 else
554 myconf="${myconf} --disable-nls"
555 fi
556
557 # reasonably sane globals (hopefully)
558 myconf="${myconf} \
559 --with-system-zlib \
560 --disable-checking \
561 --disable-werror"
562
563 # languages to build
564 myconf="${myconf} --enable-languages=${langs}"
565
566 # ???
567 myconf="${myconf} --enable-shared --enable-threads=posix"
568
569 # make clear we're in an offset
570 use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
571
572 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
573 # want it to use
574 myconf="${myconf} \
575 --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
576 --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
577
578 # make sure we never do multilib stuff, for that we need a different Prefix
579 [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
580 && myconf="${myconf} --disable-multilib"
581
582 # The produced libgcc_s.dylib is faulty if using a bit too much
583 # optimisation. Nail it down to something sane
584 CFLAGS="-O2 -pipe"
585 CXXFLAGS=${CFLAGS}
586
587 # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
588 # (won't hurt if already 64-bits, but is essential when coming from a
589 # multilib compiler -- the default)
590 [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
591 export CC="gcc -m64"
592
593 mkdir -p "${WORKDIR}"/build
594 cd "${WORKDIR}"/build
595 einfo "Configuring GCC with: ${myconf//--/\n\t--}"
596 "${S}"/configure ${myconf} || die "conf failed"
597 emake bootstrap || die "emake failed"
598 }
599
600 src_install() {
601 local ED=${ED-${D}}
602
603 cd "${WORKDIR}"/build
604 # -jX doesn't work
605 emake -j1 DESTDIR="${D}" install || die
606
607 # Punt some tools which are really only useful while building gcc
608 find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
609 # This one comes with binutils
610 find "${ED}" -name libiberty.a -exec rm -f "{}" \;
611
612 # Basic sanity check
613 if ! is_crosscompile ; then
614 local EXEEXT
615 eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
616 [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
617 fi
618
619 # create gcc-config entry
620 dodir /etc/env.d/gcc
621 local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
622
623 gcc_envd_file="${ED}${gcc_envd_base}"
624
625 # phase PATH/ROOTPATH out ...
626 echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
627 echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
628 echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
629
630 # we don't do multilib
631 LDPATH="${LIBPATH}"
632 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
633 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
634 echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
635 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
636 is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
637
638 # Move <cxxabi.h> to compiler-specific directories
639 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
640 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
641
642 # These should be symlinks
643 dodir /usr/bin
644 cd "${D}"${BINPATH}
645 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
646 # For some reason, g77 gets made instead of ${CTARGET}-g77...
647 # this should take care of that
648 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
649
650 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
651 ln -sf ${CTARGET}-${x} ${x}
652
653 # Create version-ed symlinks
654 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
655 /usr/bin/${CTARGET}-${x}-${GCC_VERS}
656 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
657 /usr/bin/${x}-${GCC_VERS}
658 fi
659
660 if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
661 rm -f ${CTARGET}-${x}-${GCC_VERS}
662 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
663 fi
664 done
665
666 # I do not know if this will break gcj stuff, so I'll only do it for
667 # objc for now; basically "ffi.h" is the correct file to include,
668 # but it gets installed in .../GCCVER/include and yet it does
669 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
670 # is installed in .../GCCVER/include/libffi; the following fixes
671 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@g.o>
672 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
673 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
674 rm -r "${D}"${LIBPATH}/include/libffi || die
675 fi
676
677 # Now do the fun stripping stuff
678 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
679 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
680 # gcc used to install helper binaries in lib/ but then moved to libexec/
681 [[ -d ${ED}/usr/libexec/gcc ]] && \
682 env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
683
684 # prune empty dirs left behind
685 find "${ED}" -type d | xargs rmdir >& /dev/null
686 }
687
688 pkg_postinst() {
689 # beware this also switches when it's on another branch version of GCC
690 gcc-config ${CTARGET}-${GCC_VERS}
691 }
692
693 pkg_postrm() {
694 local EROOT=${EROOT-${ROOT}}
695
696 # clean up the cruft left behind by cross-compilers
697 if is_crosscompile ; then
698 if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
699 rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
700 rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
701 rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
702 fi
703 return 0
704 fi
705 }
706
707
708
709 1.6 sys-devel/gcc-apple/metadata.xml
710
711 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/metadata.xml?rev=1.6&view=markup
712 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/metadata.xml?rev=1.6&content-type=text/plain
713 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/metadata.xml?r1=1.5&r2=1.6
714
715
716
717
718 1.1 sys-devel/gcc-apple/gcc-apple-4.2.1_p5574.ebuild
719
720 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5574.ebuild?rev=1.1&view=markup
721 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5574.ebuild?rev=1.1&content-type=text/plain
722
723 Index: gcc-apple-4.2.1_p5574.ebuild
724 ===================================================================
725 # Copyright 1999-2009 Gentoo Foundation
726 # Distributed under the terms of the GNU General Public License v2
727 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5574.ebuild,v 1.1 2009/06/21 10:27:55 grobian Exp $
728
729 ETYPE="gcc-compiler"
730
731 inherit eutils toolchain flag-o-matic autotools prefix
732
733 GCC_VERS=${PV/_p*/}
734 APPLE_VERS=${PV/*_p/}
735 LIBSTDCXX_APPLE_VERSION=16
736 DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 3.1.3"
737 HOMEPAGE="http://gcc.gnu.org"
738 SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc_42-${APPLE_VERS}.tar.gz
739 http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-${LIBSTDCXX_APPLE_VERSION}.tar.gz
740 fortran? ( mirror://gnu/gcc/gcc-${GCC_VERS}/gcc-fortran-${GCC_VERS}.tar.bz2 )"
741 LICENSE="APSL-2 GPL-2"
742
743 if is_crosscompile; then
744 SLOT="${CTARGET}-42"
745 else
746 SLOT="42"
747 fi
748
749 KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
750
751 IUSE="fortran nls objc objc++ nocxx"
752
753 RDEPEND=">=sys-libs/zlib-1.1.4
754 >=sys-libs/ncurses-5.2-r2
755 nls? ( sys-devel/gettext )
756 >=sys-devel/gcc-config-1.3.12-r4
757 fortran? (
758 >=dev-libs/gmp-4.2.1
759 >=dev-libs/mpfr-2.2.0_p10
760 )"
761 DEPEND="${RDEPEND}
762 >=sys-apps/texinfo-4.2-r4
763 >=sys-devel/bison-1.875
764 ${CATEGORY}/binutils-apple
765 >=dev-libs/mpfr-2.2.0_p10"
766
767 S=${WORKDIR}/gcc_42-${APPLE_VERS}
768
769 # TPREFIX is the prefix of the CTARGET installation
770 export TPREFIX=${TPREFIX:-${EPREFIX}}
771
772 LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
773 if is_crosscompile ; then
774 BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
775 else
776 BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
777 fi
778 STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
779
780 src_unpack() {
781 unpack ${A}
782 cd "${S}"
783
784 # Support for fortran
785 if use fortran ; then
786 cd "${WORKDIR}"/gcc-${GCC_VERS}
787 # hmmm, just use rsync?
788 tar cf - * | ( cd "${S}" && tar xf - )
789 cd "${S}"
790 # from: http://r.research.att.com/tools/
791 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-gfortran.patch
792 fi
793
794 # we use our libtool
795 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
796 gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
797 # add prefixed Frameworks to default search paths (may want to change this
798 # in a cross-compile)
799 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
800 gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
801
802 # Workaround deprecated "+Nc" syntax for GNU tail(1)
803 sed -i -e "s:tail +16c:tail -c +16:g" \
804 gcc/Makefile.in || die "sed gcc/Makefile.in failed."
805
806 epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
807 epatch "${FILESDIR}"/${PN}-4.2.1_p5566-x86_64-defines.patch
808
809 # dsymutil stuff breaks on 10.4/x86, revert it
810 [[ ${CHOST} == *86*-apple-darwin8 ]] && \
811 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-dsymutil.patch
812
813 # bootstrapping might fail with host provided gcc on 10.4/x86
814 if ! is_crosscompile && ! echo "int main(){return 0;}" | gcc -o "${T}"/foo \
815 -mdynamic-no-pic -x c - >/dev/null 2>&1;
816 then
817 einfo "-mdynamic-no-pic doesn't work - disabling..."
818 echo "BOOT_CFLAGS=-g -O2" > config/mh-x86-darwin
819 XD=gcc/config/i386/x-darwin
820 awk 'BEGIN{x=1}{if ($0 ~ "use -mdynamic-no-pic to build x86")
821 {x=1-x} else if (x) print}' $XD > t && mv t $XD \
822 || die "Failed to rewrite $XD"
823 fi
824
825 epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
826 eprefixify "${S}"/gcc/gcc.c
827
828 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-texinfo.patch
829 cd "${S}"/gcc && eautoconf
830 cd "${S}"/libgomp && eautoconf
831
832 cd "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx
833 epatch "${FILESDIR}"/libstdc++-${LIBSTDCXX_APPLE_VERSION}.patch
834 }
835
836 src_compile() {
837 local langs="c"
838 use nocxx || langs="${langs},c++"
839 use objc && langs="${langs},objc"
840 use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
841 use fortran && langs="${langs},fortran"
842
843 local myconf="${myconf} \
844 --prefix=${EPREFIX}/usr \
845 --bindir=${BINPATH} \
846 --includedir=${LIBPATH}/include \
847 --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
848 --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
849 --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
850 --with-gxx-include-dir=${STDCXX_INCDIR} \
851 --host=${CHOST}
852 --enable-version-specific-runtime-libs"
853
854 if is_crosscompile ; then
855 # Straight from the GCC install doc:
856 # "GCC has code to correctly determine the correct value for target
857 # for nearly all native systems. Therefore, we highly recommend you
858 # not provide a configure target when configuring a native compiler."
859 myconf="${myconf} --target=${CTARGET}"
860
861 # Tell compiler where to find what it needs
862 myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
863
864 # Set this to something sane for both native and target
865 CFLAGS="-O2 -pipe"
866
867 local VAR="CFLAGS_"${CTARGET//-/_}
868 CXXFLAGS=${!VAR}
869 fi
870 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
871
872 # Native Language Support
873 if use nls ; then
874 myconf="${myconf} --enable-nls --without-included-gettext"
875 else
876 myconf="${myconf} --disable-nls"
877 fi
878
879 # reasonably sane globals (hopefully)
880 myconf="${myconf} \
881 --with-system-zlib \
882 --disable-checking \
883 --disable-werror"
884
885 # ???
886 myconf="${myconf} --enable-shared --enable-threads=posix"
887
888 # make clear we're in an offset
889 use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
890
891 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
892 # want it to use
893 myconf="${myconf} \
894 --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
895 --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
896
897 # make sure we never do multilib stuff, for that we need a different Prefix
898 [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
899 && myconf="${myconf} --disable-multilib"
900
901 #libstdcxx does not support this one
902 local gccconf="${myconf} --enable-languages=${langs}"
903
904 # The produced libgcc_s.dylib is faulty if using a bit too much
905 # optimisation. Nail it down to something sane
906 CFLAGS="-O2 -pipe"
907 CXXFLAGS=${CFLAGS}
908
909 # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
910 # (won't hurt if already 64-bits, but is essential when coming from a
911 # multilib compiler -- the default)
912 [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
913 export CC="gcc -m64"
914
915 mkdir -p "${WORKDIR}"/build
916 cd "${WORKDIR}"/build
917 einfo "Configuring GCC with: ${gccconf//--/\n\t--}"
918 "${S}"/configure ${gccconf} || die "conf failed"
919 emake bootstrap || die "emake failed"
920
921 local libstdcxxconf="${myconf} --disable-libstdcxx-debug"
922 mkdir -p "${WORKDIR}"/build_libstdcxx || die
923 cd "${WORKDIR}"/build_libstdcxx
924 #the build requires the gcc built before, so link to it
925 ln -s "${WORKDIR}"/build/gcc "${WORKDIR}"/build_libstdcxx/gcc || die
926 einfo "Configuring libstdcxx with: ${libstdcxxconf//--/\n\t--}"
927 "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx/configure ${libstdcxxconf} || die "conf failed"
928 emake all || die "emake failed"
929 }
930
931 src_install() {
932 local ED=${ED-${D}}
933
934 cd "${WORKDIR}"/build
935 # -jX doesn't work
936 emake -j1 DESTDIR="${D}" install || die
937
938 cd "${WORKDIR}"/build_libstdcxx
939 emake -j1 DESTDIR="${D}" install || die
940 cd "${WORKDIR}"/build
941
942 # Punt some tools which are really only useful while building gcc
943 find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
944 # This one comes with binutils
945 find "${ED}" -name libiberty.a -exec rm -f "{}" \;
946
947 # Basic sanity check
948 if ! is_crosscompile ; then
949 local EXEEXT
950 eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
951 [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
952 fi
953
954 # create gcc-config entry
955 dodir /etc/env.d/gcc
956 local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
957
958 gcc_envd_file="${ED}${gcc_envd_base}"
959
960 # phase PATH/ROOTPATH out ...
961 echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
962 echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
963 echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
964
965 # we don't do multilib
966 LDPATH="${LIBPATH}"
967 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
968 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
969 echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
970 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
971 is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
972
973 # Move <cxxabi.h> to compiler-specific directories
974 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
975 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
976
977 # These should be symlinks
978 dodir /usr/bin
979 cd "${D}"${BINPATH}
980 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
981 # For some reason, g77 gets made instead of ${CTARGET}-g77...
982 # this should take care of that
983 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
984
985 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
986 ln -sf ${CTARGET}-${x} ${x}
987
988 # Create version-ed symlinks
989 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
990 /usr/bin/${CTARGET}-${x}-${GCC_VERS}
991 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
992 /usr/bin/${x}-${GCC_VERS}
993 fi
994
995 if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
996 rm -f ${CTARGET}-${x}-${GCC_VERS}
997 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
998 fi
999 done
1000
1001 # I do not know if this will break gcj stuff, so I'll only do it for
1002 # objc for now; basically "ffi.h" is the correct file to include,
1003 # but it gets installed in .../GCCVER/include and yet it does
1004 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
1005 # is installed in .../GCCVER/include/libffi; the following fixes
1006 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@g.o>
1007 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
1008 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
1009 rm -r "${D}"${LIBPATH}/include/libffi || die
1010 fi
1011
1012 # Now do the fun stripping stuff
1013 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1014 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1015 # gcc used to install helper binaries in lib/ but then moved to libexec/
1016 [[ -d ${ED}/usr/libexec/gcc ]] && \
1017 env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
1018
1019 # prune empty dirs left behind
1020 find "${ED}" -type d | xargs rmdir >& /dev/null
1021 }
1022
1023 pkg_postinst() {
1024 # beware this also switches when it's on another branch version of GCC
1025 gcc-config ${CTARGET}-${GCC_VERS}
1026 }
1027
1028 pkg_postrm() {
1029 local EROOT=${EROOT-${ROOT}}
1030
1031 # clean up the cruft left behind by cross-compilers
1032 if is_crosscompile ; then
1033 if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
1034 rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
1035 rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
1036 rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
1037 fi
1038 return 0
1039 fi
1040 }
1041
1042
1043
1044 1.1 sys-devel/gcc-apple/gcc-apple-4.2.1_p5566-r2.ebuild
1045
1046 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5566-r2.ebuild?rev=1.1&view=markup
1047 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5566-r2.ebuild?rev=1.1&content-type=text/plain
1048
1049 Index: gcc-apple-4.2.1_p5566-r2.ebuild
1050 ===================================================================
1051 # Copyright 1999-2009 Gentoo Foundation
1052 # Distributed under the terms of the GNU General Public License v2
1053 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5566-r2.ebuild,v 1.1 2009/06/21 10:27:55 grobian Exp $
1054
1055 ETYPE="gcc-compiler"
1056
1057 inherit eutils toolchain flag-o-matic autotools prefix
1058
1059 GCC_VERS=${PV/_p*/}
1060 APPLE_VERS=${PV/*_p/}
1061 LIBSTDCXX_APPLE_VERSION=16
1062 DESCRIPTION="Apple branch of the GNU Compiler Collection, Xcode Tools 3.1.2"
1063 HOMEPAGE="http://gcc.gnu.org"
1064 SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc_42-${APPLE_VERS}.tar.gz
1065 http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-${LIBSTDCXX_APPLE_VERSION}.tar.gz
1066 fortran? ( mirror://gnu/gcc/gcc-${GCC_VERS}/gcc-fortran-${GCC_VERS}.tar.bz2 )"
1067 LICENSE="APSL-2 GPL-2"
1068
1069 if is_crosscompile; then
1070 SLOT="${CTARGET}-42"
1071 else
1072 SLOT="42"
1073 fi
1074
1075 KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
1076
1077 IUSE="fortran nls objc objc++ nocxx"
1078
1079 RDEPEND=">=sys-libs/zlib-1.1.4
1080 >=sys-libs/ncurses-5.2-r2
1081 nls? ( sys-devel/gettext )
1082 >=sys-devel/gcc-config-1.3.12-r4
1083 fortran? (
1084 >=dev-libs/gmp-4.2.1
1085 >=dev-libs/mpfr-2.2.0_p10
1086 )"
1087 DEPEND="${RDEPEND}
1088 >=sys-apps/texinfo-4.2-r4
1089 >=sys-devel/bison-1.875
1090 ${CATEGORY}/binutils-apple
1091 >=dev-libs/mpfr-2.2.0_p10"
1092
1093 S=${WORKDIR}/gcc_42-${APPLE_VERS}
1094
1095 # TPREFIX is the prefix of the CTARGET installation
1096 export TPREFIX=${TPREFIX:-${EPREFIX}}
1097
1098 LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
1099 if is_crosscompile ; then
1100 BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
1101 else
1102 BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
1103 fi
1104 STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
1105
1106 src_unpack() {
1107 unpack ${A}
1108 cd "${S}"
1109
1110 # Support for fortran
1111 if use fortran ; then
1112 cd "${WORKDIR}"/gcc-${GCC_VERS}
1113 # hmmm, just use rsync?
1114 tar cf - * | ( cd "${S}" && tar xf - )
1115 cd "${S}"
1116 # from: http://r.research.att.com/tools/
1117 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-gfortran.patch
1118 fi
1119
1120 # we use our libtool
1121 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
1122 gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
1123 # add prefixed Frameworks to default search paths (may want to change this
1124 # in a cross-compile)
1125 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
1126 gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
1127
1128 # Workaround deprecated "+Nc" syntax for GNU tail(1)
1129 sed -i -e "s:tail +16c:tail -c +16:g" \
1130 gcc/Makefile.in || die "sed gcc/Makefile.in failed."
1131
1132 epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
1133 epatch "${FILESDIR}"/${P}-x86_64-defines.patch
1134
1135 # dsymutil stuff breaks on 10.4/x86, revert it
1136 [[ ${CHOST} == *86*-apple-darwin8 ]] && \
1137 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-dsymutil.patch
1138
1139 # bootstrapping might fail with host provided gcc on 10.4/x86
1140 if ! is_crosscompile && ! echo "int main(){return 0;}" | gcc -o "${T}"/foo \
1141 -mdynamic-no-pic -x c - >/dev/null 2>&1;
1142 then
1143 einfo "-mdynamic-no-pic doesn't work - disabling..."
1144 echo "BOOT_CFLAGS=-g -O2" > config/mh-x86-darwin
1145 XD=gcc/config/i386/x-darwin
1146 awk 'BEGIN{x=1}{if ($0 ~ "use -mdynamic-no-pic to build x86")
1147 {x=1-x} else if (x) print}' $XD > t && mv t $XD \
1148 || die "Failed to rewrite $XD"
1149 fi
1150
1151 epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
1152 eprefixify "${S}"/gcc/gcc.c
1153
1154 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-texinfo.patch
1155 cd "${S}"/gcc && eautoconf
1156 cd "${S}"/libgomp && eautoconf
1157
1158 cd "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx
1159 epatch "${FILESDIR}"/libstdc++-${LIBSTDCXX_APPLE_VERSION}.patch
1160 }
1161
1162 src_compile() {
1163 local langs="c"
1164 use nocxx || langs="${langs},c++"
1165 use objc && langs="${langs},objc"
1166 use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
1167 use fortran && langs="${langs},fortran"
1168
1169 local myconf="${myconf} \
1170 --prefix=${EPREFIX}/usr \
1171 --bindir=${BINPATH} \
1172 --includedir=${LIBPATH}/include \
1173 --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
1174 --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
1175 --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
1176 --with-gxx-include-dir=${STDCXX_INCDIR} \
1177 --host=${CHOST}
1178 --enable-version-specific-runtime-libs"
1179
1180 if is_crosscompile ; then
1181 # Straight from the GCC install doc:
1182 # "GCC has code to correctly determine the correct value for target
1183 # for nearly all native systems. Therefore, we highly recommend you
1184 # not provide a configure target when configuring a native compiler."
1185 myconf="${myconf} --target=${CTARGET}"
1186
1187 # Tell compiler where to find what it needs
1188 myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
1189
1190 # Set this to something sane for both native and target
1191 CFLAGS="-O2 -pipe"
1192
1193 local VAR="CFLAGS_"${CTARGET//-/_}
1194 CXXFLAGS=${!VAR}
1195 fi
1196 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
1197
1198 # Native Language Support
1199 if use nls ; then
1200 myconf="${myconf} --enable-nls --without-included-gettext"
1201 else
1202 myconf="${myconf} --disable-nls"
1203 fi
1204
1205 # reasonably sane globals (hopefully)
1206 myconf="${myconf} \
1207 --with-system-zlib \
1208 --disable-checking \
1209 --disable-werror"
1210
1211 # ???
1212 myconf="${myconf} --enable-shared --enable-threads=posix"
1213
1214 # make clear we're in an offset
1215 use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
1216
1217 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
1218 # want it to use
1219 myconf="${myconf} \
1220 --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
1221 --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
1222
1223 # make sure we never do multilib stuff, for that we need a different Prefix
1224 [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
1225 && myconf="${myconf} --disable-multilib"
1226
1227 #libstdcxx does not support this one
1228 local gccconf="${myconf} --enable-languages=${langs}"
1229
1230 # The produced libgcc_s.dylib is faulty if using a bit too much
1231 # optimisation. Nail it down to something sane
1232 CFLAGS="-O2 -pipe"
1233 CXXFLAGS=${CFLAGS}
1234
1235 # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
1236 # (won't hurt if already 64-bits, but is essential when coming from a
1237 # multilib compiler -- the default)
1238 [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
1239 export CC="gcc -m64"
1240
1241 mkdir -p "${WORKDIR}"/build
1242 cd "${WORKDIR}"/build
1243 einfo "Configuring GCC with: ${gccconf//--/\n\t--}"
1244 "${S}"/configure ${gccconf} || die "conf failed"
1245 emake bootstrap || die "emake failed"
1246
1247 local libstdcxxconf="${myconf} --disable-libstdcxx-debug"
1248 mkdir -p "${WORKDIR}"/build_libstdcxx || die
1249 cd "${WORKDIR}"/build_libstdcxx
1250 #the build requires the gcc built before, so link to it
1251 ln -s "${WORKDIR}"/build/gcc "${WORKDIR}"/build_libstdcxx/gcc || die
1252 einfo "Configuring libstdcxx with: ${libstdcxxconf//--/\n\t--}"
1253 "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx/configure ${libstdcxxconf} || die "conf failed"
1254 emake all || die "emake failed"
1255 }
1256
1257 src_install() {
1258 local ED=${ED-${D}}
1259
1260 cd "${WORKDIR}"/build
1261 # -jX doesn't work
1262 emake -j1 DESTDIR="${D}" install || die
1263
1264 cd "${WORKDIR}"/build_libstdcxx
1265 emake -j1 DESTDIR="${D}" install || die
1266 cd "${WORKDIR}"/build
1267
1268 # Punt some tools which are really only useful while building gcc
1269 find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1270 # This one comes with binutils
1271 find "${ED}" -name libiberty.a -exec rm -f "{}" \;
1272
1273 # Basic sanity check
1274 if ! is_crosscompile ; then
1275 local EXEEXT
1276 eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1277 [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
1278 fi
1279
1280 # create gcc-config entry
1281 dodir /etc/env.d/gcc
1282 local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
1283
1284 gcc_envd_file="${ED}${gcc_envd_base}"
1285
1286 # phase PATH/ROOTPATH out ...
1287 echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
1288 echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
1289 echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
1290
1291 # we don't do multilib
1292 LDPATH="${LIBPATH}"
1293 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
1294 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
1295 echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
1296 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
1297 is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
1298
1299 # Move <cxxabi.h> to compiler-specific directories
1300 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
1301 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
1302
1303 # These should be symlinks
1304 dodir /usr/bin
1305 cd "${D}"${BINPATH}
1306 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
1307 # For some reason, g77 gets made instead of ${CTARGET}-g77...
1308 # this should take care of that
1309 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
1310
1311 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
1312 ln -sf ${CTARGET}-${x} ${x}
1313
1314 # Create version-ed symlinks
1315 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
1316 /usr/bin/${CTARGET}-${x}-${GCC_VERS}
1317 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
1318 /usr/bin/${x}-${GCC_VERS}
1319 fi
1320
1321 if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
1322 rm -f ${CTARGET}-${x}-${GCC_VERS}
1323 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
1324 fi
1325 done
1326
1327 # I do not know if this will break gcj stuff, so I'll only do it for
1328 # objc for now; basically "ffi.h" is the correct file to include,
1329 # but it gets installed in .../GCCVER/include and yet it does
1330 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
1331 # is installed in .../GCCVER/include/libffi; the following fixes
1332 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@g.o>
1333 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
1334 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
1335 rm -r "${D}"${LIBPATH}/include/libffi || die
1336 fi
1337
1338 # Now do the fun stripping stuff
1339 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1340 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1341 # gcc used to install helper binaries in lib/ but then moved to libexec/
1342 [[ -d ${ED}/usr/libexec/gcc ]] && \
1343 env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
1344
1345 # prune empty dirs left behind
1346 find "${ED}" -type d | xargs rmdir >& /dev/null
1347 }
1348
1349 pkg_postinst() {
1350 # beware this also switches when it's on another branch version of GCC
1351 gcc-config ${CTARGET}-${GCC_VERS}
1352 }
1353
1354 pkg_postrm() {
1355 local EROOT=${EROOT-${ROOT}}
1356
1357 # clean up the cruft left behind by cross-compilers
1358 if is_crosscompile ; then
1359 if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
1360 rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
1361 rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
1362 rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
1363 fi
1364 return 0
1365 fi
1366 }