1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
11 DESCRIPTION
="Apple branch of the GNU Compiler Collection"
12 HOMEPAGE
="http://gcc.gnu.org"
13 SRC_URI
="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc_os_35-${APPLE_VERS}.tar.gz"
15 LICENSE
="APSL-2 GPL-2"
20 IUSE
="nls fortran objc nocxx"
22 RDEPEND
=">=sys-libs/zlib-1.1.4
23 >=sys-libs/ncurses-5.2-r2
24 nls? ( sys-devel/gettext )
25 >=sys-devel/gcc-config-1.3.12-r4"
27 >=sys-apps/texinfo-4.2-r4
28 >=sys-devel/bison-1.875
29 sys-devel/binutils-apple"
31 S
=${WORKDIR}/gcc_os_35-
${APPLE_VERS}
37 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/libtool:" \
38 gcc
/config
/darwin.h || die
"sed gcc/config/darwin.h failed"
39 # add prefixed Frameworks to default search paths
40 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
41 gcc
/config
/darwin-c.c || die
"sed gcc/config/darwin-c.c failed"
43 # Workaround deprecated "+Nc" syntax for GNU tail(1)
44 sed -i -e "s:tail +16c:tail -c +16:g" \
45 gcc
/Makefile.
in || die
"sed gcc/Makefile.in failed."
50 use nocxx || langs
="${langs},c++"
51 use fortran
&& langs
="${langs},f77"
52 use objc
&& langs
="${langs},objc"
54 local myconf
="${myconf} \
55 --prefix=${EPREFIX}/usr \
56 --bindir=${EPREFIX}/usr/${CHOST}/gcc-bin/${GCC_VERS} \
57 --includedir=${EPREFIX}/usr/lib/gcc/${CHOST}/${GCC_VERS}/include \
58 --datadir=${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS} \
59 --mandir=${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man \
60 --infodir=${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info \
61 --with-gxx-include-dir=${EPREFIX}/usr/lib/gcc/${CHOST}/${GCC_VERS}/include/g++-v${GCC_VERS/\.*/} \
63 --enable-version-specific-runtime-libs"
64 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
66 # Straight from the GCC install doc:
67 # "GCC has code to correctly determine the correct value
for target
68 # for nearly all native systems. Therefore, we highly recommend you
69 # not provide a configure target when configuring a native compiler."
71 # Native Language Support
73 myconf
="${myconf} --enable-nls --without-included-gettext"
75 myconf
="${myconf} --disable-nls"
78 # reasonably sane globals (hopefully)
79 # --disable-libunwind-exceptions needed till unwind sections get fixed. see ps.m for details
84 --disable-libunwind-exceptions"
87 myconf
="${myconf} --enable-languages=${langs}"
90 myconf
="${myconf} --enable-shared --enable-threads=posix"
92 # make clear we're in an offset
93 if [[ ${EPREFIX%/} != "" ]] ; then
94 myconf
="${myconf} --with-local-prefix=${EPREFIX}/usr"
97 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
100 --with-as=${EPREFIX}/usr/bin/as \
101 --with-ld=${EPREFIX}/usr/bin/ld"
103 mkdir
-p "${WORKDIR}"/build
104 cd "${WORKDIR}"/build
105 einfo
"Configuring GCC with: ${myconf//--/\n\t--}"
106 "${S}"/configure
${myconf} || die
"conf failed"
107 make -j1 bootstrap || die
"emake failed"
111 cd "${WORKDIR}"/build
112 make DESTDIR
="${D}" install || die
114 use build
&& rm -rf "${ED}"/usr
/{man
,share
}
115 find "${ED}" -name libiberty.a
-exec rm -f {} \
;
117 # create gcc-config entry
119 local gcc_envd_base
="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
121 gcc_envd_file
="${ED}${gcc_envd_base}"
123 echo "PATH=\"${EPREFIX}/usr/${CHOST}/gcc-bin/${GCC_VERS}\"" > ${gcc_envd_file}
124 echo "ROOTPATH
=\"${EPREFIX}/usr/${CHOST}/gcc-bin/${GCC_VERS}\"" >> ${gcc_envd_file}
126 LDPATH
="${EPREFIX}/usr/lib/gcc/${CHOST}/${GCC_VERS}"
127 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
129 BITS
=$
(${ED}/usr/${CHOST}/gcc-bin/${GCC_VERS}/gcc
-dumpspecs |
grep -A1 multilib
: |
tail -n1 |
grep -o 64 |
head -n1)
133 echo "GCCBITS=\"${BITS}\"" >> ${gcc_envd_file}
135 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
136 echo "INFOPATH
=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
137 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
141 # beware this also switches when it's on another branch version of GCC
142 gcc-config
${CHOST}-${GCC_VERS}