--- gcc-3.2.3-r2.ebuild 2003-10-11 23:05:21.000000000 -0400 +++ gcc-3.2.3-r3.ebuild 2003-11-20 18:28:03.000000000 -0500 @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.3-r2.ebuild,v 1.6 2003/10/04 21:37:29 frogger Exp $ -IUSE="static nls bootstrap java build" +IUSE="static nls bootstrap java build uclibc" inherit eutils flag-o-matic libtool @@ -114,7 +114,7 @@ RDEPEND="virtual/glibc >=sys-devel/gcc-config-1.3.1 - >=sys-libs/zlib-1.1.4 + !uclibc? ( >=sys-libs/zlib-1.1.4 ) >=sys-apps/texinfo-4.2-r4 !build? ( >=sys-libs/ncurses-5.2-r2 )" @@ -155,14 +155,11 @@ } src_unpack() { + use uclibc && einfo "Unpacking and preparing a uclibc enabled toolchain gcc" if [ -z "${SNAPSHOT}" ] then unpack ${PN}-${MAIN_BRANCH}.tar.bz2 - - if [ -n "${PATCH_VER}" ] - then - unpack ${P}-patches-${PATCH_VER}.tar.bz2 - fi + [ -n "${PATCH_VER}" ] && unpack ${P}-patches-${PATCH_VER}.tar.bz2 else unpack gcc-${SNAPSHOT//-}.tar.bz2 fi @@ -173,19 +170,13 @@ # Fixup libtool to correctly generate .la files with portage elibtoolize --portage --shallow - echo - + einfo "Branch updates" # Branch update ... - if [ -n "${BRANCH_UPDATE}" ] - then + [ -n "${BRANCH_UPDATE}" ] && epatch ${DISTDIR}/${PN}-${MAIN_BRANCH}-branch-update-${BRANCH_UPDATE}.patch.bz2 - fi # Do bulk patches included in ${P}-patches-${PATCH_VER}.tar.bz2 - if [ -n "${PATCH_VER}" ] - then - epatch ${WORKDIR}/patch - fi + [ -n "${PATCH_VER}" ] && epatch ${WORKDIR}/patch # Update to support TLS and __thread epatch ${DISTDIR}/${P}-tls-update.patch.bz2 @@ -228,17 +219,12 @@ epatch ${FILESDIR}/3.2.1/gcc32-arm-reload1-fix.patch fi #ppc mergel miscompilation workaround - if use ppc - then - epatch ${FILESDIR}/3.2.3/gcc-3.2.3-mergel-fix.patch - fi - if use hppa - then - # There exists a bug in the ebuild patched gcc that prevents hppa from - # getting build because of default_assemble_visibility is not compiled. - # Alexander Gabert (14 Jul 2003). - epatch ${FILESDIR}/3.2.3/gcc323-hppa-default_assemble_visibility.patch - fi + use ppc && epatch ${FILESDIR}/3.2.3/gcc-3.2.3-mergel-fix.patch + + # There exists a bug in the ebuild patched gcc that prevents hppa from + # getting build because of default_assemble_visibility is not compiled. + # Alexander Gabert (14 Jul 2003). + use hppa && epatch ${FILESDIR}/3.2.3/gcc323-hppa-default_assemble_visibility.patch # Install our pre generated manpages if we do not have perl ... if [ ! -x /usr/bin/perl ] @@ -282,6 +268,48 @@ rm -f ${x}.orig done + + if [ `use uclibc` ]; then + einfo "Configuring for uclibc enviornment" + for i in ${FILESDIR}/${PV}/${PN}-{disable-mathf,include-search,libstd++-locale}.patch; do + [ -f ${i} ] && epatch ${i} + done + + # time for some build hackery, stolen from buildroot enviornment! + LIST=`grep -lr "dynamic-linker.*\.so[\.0-9]*" *` + for i in ${LIST}; do + sed -i -e 's/-dynamic-linker.*\.so[\.0-9]*}/-dynamic-linker \/usr\/${CCHOST}\/lib\/ld-uClibc.so.0}/g' $i + done + + # prevent glibc start files from leaking in + # maybe these need to be /usr/${CCHOST} instead of ${S} + cp gcc/gcc.c{,.orig} + cp gcc/Makefile.in{,orig} + cp gcc/cppdefault.h{,.orig} + sed -i \ + -e s:standard_startfile_prefix_1=\".*:standard_startfile_prefix_1=\"${S}/lib/\";:g' \ + -e s:standard_startfile_prefix_2=\".*:standard_startfile_prefix_2=\"${S}/lib/\";:g' gcc/gcc.c + + # prevent glibc include files from leaking in, grrr! + sed -i \ + -e s:^NATIVE_SYSTEM_HEADER_DIR.*:"NATIVE_SYSTEM_HEADER_DIR:=${S}/include/":g \ + -e s:^CROSS_SYSTEM_HEADER_DIR.*:"CROSS_SYSTEM_HEADER_DIR:=${S}/include/":g gcc/Makefile.in + sed -i -e s:^#define.*STANDARD_INCLUDE_DIR.*:"#define STANDARD_INCLUDE_DIR \"${S}\/include\/\"":g gcc/cppdefault.h + diff -u gcc/Makefile.in{,orig} + diff -u gcc/gcc.c{,.orig} + diff -u gcc/cppdefault.h{,.orig} + read + + # prevent system glibc files from being found by collect 2 + sed -i \ + -e 's/\/lib/${S}\/lib\//g' gcc/collect2.c \ + -e 's/\/usr/\/${S}\//g' gcc/collect2.c + + # prevent gcc from using unwind-dw2-fde-glibc code + sed -i -e 's/^#ifndef inhibit_libc/#define inhibit_libc\\n/#ifndef inhibit_libc/g' gcc/unwind-dw2-fde-glibc.c + + fi + } src_compile() { @@ -316,30 +344,42 @@ mkdir -p ${WORKDIR}/build cd ${WORKDIR}/build - einfo "Configuring GCC..." - addwrite "/dev/zero" - ${S}/configure --prefix=${LOC} \ + # we are using uclibc! hells yeah + if [ `use uclibc` ]; then + myconf="${myconf} \ + --enable-target-optspace \ + --disable-__cxa_atexit \ + --program-prefix=${ARCH}-uclibc- \ + --with-gnu-ld" + + else + myconf="${myconf} \ + --enable-threads=posix \ + --enable-long-long \ + --disable-checking \ + --enable-cstdio=stdio \ + --enable-clocale=generic \ + --enable-__cxa_atexit \ + --enable-version-specific-runtime-libs \ + --with-system-zlib" + fi + + myconf="${myconf} + --prefix=${LOC} \ --bindir=${BINPATH} \ --includedir=${LIBPATH}/include \ --datadir=${DATAPATH} \ --mandir=${DATAPATH}/man \ --infodir=${DATAPATH}/info \ - --enable-shared \ --host=${CHOST} \ --target=${CCHOST} \ - --with-system-zlib \ --enable-languages=${gcc_lang} \ - --enable-threads=posix \ - --enable-long-long \ - --disable-checking \ - --enable-cstdio=stdio \ - --enable-clocale=generic \ - --enable-__cxa_atexit \ - --enable-version-specific-runtime-libs \ --with-gxx-include-dir=${STDCXX_INCDIR} \ - --with-local-prefix=${LOC}/local \ - ${myconf} || die + --with-local-prefix=${LOC}/local" + einfo "Configuring GCC... with ${myconf}" + addwrite "/dev/zero" + ${S}/configure ${myconf} || die touch ${S}/gcc/c-gperf.h # Do not make manpages if we do not have perl ... @@ -375,12 +415,8 @@ src_install() { # Do allow symlinks in ${LOC}/lib/gcc-lib/${CHOST}/${PV}/include as # this can break the build. - for x in cd ${WORKDIR}/build/gcc/include/* - do - if [ -L ${x} ] - then - rm -f ${x} - fi + for x in cd ${WORKDIR}/build/gcc/include/* ; do + [ -L ${x} ] && rm -f ${x} done einfo "Installing GCC..." @@ -479,10 +515,8 @@ fi # This one comes with binutils - if [ -f ${D}${LOC}/lib/libiberty.a ] - then + [ -f ${D}${LOC}/lib/libiberty.a ] && rm -f ${D}${LOC}/lib/libiberty.a - fi cd ${S} if [ -z "`use build`" ]