x11-libs/libast: import
[portage-prefix-bleeding-edge-ebuilds.git] / sys-devel / gcc-apple / gcc-apple-3.5.0_p3506-r1.ebuild
blob5bc200f52aa19d30ace5515206cb9b861700f436
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
5 EAPI="prefix"
7 inherit eutils
9 GCC_VERS=${PV/_p*/}
10 APPLE_VERS=${PV/*_p/}
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"
16 SLOT="35"
18 KEYWORDS="~ppc-macos"
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"
26 DEPEND="${RDEPEND}
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}
33 src_unpack() {
34 unpack ${A}
35 cd "${S}"
36 # we use our libtool
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."
48 src_compile() {
49 local langs="c"
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/\.*/} \
62 --host=${CHOST} \
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
72 if use nls ; then
73 myconf="${myconf} --enable-nls --without-included-gettext"
74 else
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
80 myconf="${myconf} \
81 --with-system-zlib \
82 --disable-checking \
83 --disable-werror \
84 --disable-libunwind-exceptions"
86 # languages to build
87 myconf="${myconf} --enable-languages=${langs}"
89 # ???
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
98 # want it to use
99 myconf="${myconf} \
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"
110 src_install() {
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
118 dodir /etc/env.d/gcc
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)
130 [[ -z ${BITS} ]] \
131 && BITS="32" \
132 || BITS="32 ${BITS}"
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}
140 pkg_postinst() {
141 # beware this also switches when it's on another branch version of GCC
142 gcc-config ${CHOST}-${GCC_VERS}