commit:     923e50e4a537bbcf714d29c091ee85b64ba54bba
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  2 10:25:45 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Dec  2 10:25:45 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=923e50e4

sys-devel/gcc: initial fork

---
 sys-devel/gcc/Manifest                          |   5 +
 sys-devel/gcc/files/gcc-configure-texinfo.patch |  16 +
 sys-devel/gcc/files/gcc-spec-env-r1.patch       |  87 +++++
 sys-devel/gcc/gcc-4.9.2-r100.ebuild             | 453 ++++++++++++++++++++++++
 4 files changed, 561 insertions(+)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
new file mode 100644
index 0000000..9761876
--- /dev/null
+++ b/sys-devel/gcc/Manifest
@@ -0,0 +1,5 @@
+DIST gcc-4.4.3-specs-0.2.0.tar.bz2 2004 SHA256 
f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 SHA512 
779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517
 WHIRLPOOL 
8a1e45aad9d306cb19de93c63b5854a97e629d90852feb6861dcfca042b6257705304fc13ad65655a4cb227d36b83fc6063648c94f270821574ee0e85307094e
+DIST gcc-4.9.2-patches-1.0.tar.bz2 18213 SHA256 
e4e9a665381beb4018779a14d5124528a9d5df0e0772f3b7639390d6bda51515 SHA512 
27deba0db6a500b160829fdcf5fc9a70be4b4fbd45c89d18dd2d0808d42803657693d0ed0f2b664e020a0d2ac39cdfe550e397eb4c2a6f64220cae1e7a16ff20
 WHIRLPOOL 
7e04ed92038f19a9b00fe0022c2c7ce3df8621fccca95cb2da37333a5edcc0857efe96aed68f5c4b51db19ecd23ec1194412f1bc24730cea30db7b342c12dfdf
+DIST gcc-4.9.2-piepatches-v0.6.1.tar.bz2 14185 SHA256 
590d11ea5723812fff3239c5eaed4b040b26a92586de0e42a84438f742eaac0b SHA512 
89560e96bc205e848936acc4d3423ff5e1ea5ee478848edfe2b992585cea0df21eb102b1f1bee55c10568d4ca54bb3f4e8ae72aa695e34a908abfda3585fb992
 WHIRLPOOL 
e6db4a2e5fdf762bd4f0fa70d630499bf6789a0c3b7ca193b455bb22f95f5f2983358ba9f28bd85b571a3a44a691ca797762302a1f2ea63ce170752f7e44128b
+DIST gcc-4.9.2-uclibc-patches-1.0.tar.bz2 2540 SHA256 
3ca63cba5edb01367352fcd558890a838630deb4c30f82f4c7e8074ad75e57fc SHA512 
69f6f80e23efee0b937fca0f2056e17b4fe643817d2394bbfd16cbb453d74c76a0bb8727815f689a795897d9cd5e06ecc74d3d9ad45175fe837ad008eee09706
 WHIRLPOOL 
3946513e83960fe891267e103e434cae0616cd45b5e7eaff5f4f671741c1445941cf80b7497231cf50f137941c01859dbbac0a95745fb7ae663a3ee512bd7162
+DIST gcc-4.9.2.tar.bz2 89939747 SHA256 
2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd SHA512 
e96cba06d572dbe7f382a2b00fd9297dcf9f9219d46a9ad0bd904dc36d5e7db3335e422640b79a27fed6fde91b0731732b94a0e2fbcd47344d6779f8ba1f4f9c
 WHIRLPOOL 
c4afdd0ec98e6f903044f1d3061fd96cf1e9bcbe2f90c388f5bc9ff8b2493b94367e84fdff7c2075ba37e2f950ecf2dba7c11786c653c2c7e86a5e8ff7d98e85

diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch 
b/sys-devel/gcc/files/gcc-configure-texinfo.patch
new file mode 100644
index 0000000..ddc098d
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch
@@ -0,0 +1,16 @@
+Chances are quite good that the installed makeinfo is sufficient.
+So ignore false positives where the makeinfo installed is so new
+that it violates the cheesy version grep.
+
+http://bugs.gentoo.org/198182
+
+--- configure
++++ configure
+@@ -3573,6 +3573,6 @@
+       :
+     else
+-      MAKEINFO="$MISSING makeinfo"
++      :
+     fi
+     ;;
+ 

diff --git a/sys-devel/gcc/files/gcc-spec-env-r1.patch 
b/sys-devel/gcc/files/gcc-spec-env-r1.patch
new file mode 100644
index 0000000..a589268
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-spec-env-r1.patch
@@ -0,0 +1,87 @@
+2013-08-22  Magnus Granberg <zo...@gentoo.org>
+
+       * gcc/gcc.c (main): Add support for external spec file via the 
GCC_SPECS env var
+       and move the process of the user specifed specs.
+
+    This allows us to easily control pie/ssp defaults with gcc-config profiles.
+    Original patch by Rob Holland
+    Extended to support multiple entries separated by ':' by Kevin F. Quinn
+    Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+    Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by 
Magnus Granberg
+
+--- gcc-4.8-20130210/gcc/gcc.c 2013-02-05 16:55:31.000000000 +0100
++++ gcc-4.8-20130210-work/gcc/gcc.c    2013-07-26 02:32:14.625089864 +0200
+@@ -6427,6 +6428,48 @@ main (int argc, char **argv)
+     do_option_spec (option_default_specs[i].name,
+                   option_default_specs[i].spec);
+ 
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined 
(WIN32))
++  /* Add specs listed in GCC_SPECS.  Note; in the process of separating
++   * each spec listed, the string is overwritten at token boundaries
++   * (':') with '\0', an effect of strtok_r().
++   */
++  specs_file = getenv ("GCC_SPECS");
++  if (specs_file && (strlen(specs_file) > 0))
++    {
++      char *spec, *saveptr;
++      for (spec=strtok_r(specs_file,":",&saveptr);
++           spec!=NULL;
++           spec=strtok_r(NULL,":",&saveptr))
++        {
++          struct user_specs *user = (struct user_specs *)
++            xmalloc (sizeof (struct user_specs));
++          user->next = (struct user_specs *) 0;
++          user->filename = spec;
++          if (user_specs_tail)
++            user_specs_tail->next = user;
++          else
++            user_specs_head = user;
++          user_specs_tail = user;
++        }
++    }
++#endif
++  /* Process any user specified specs in the order given on the command
++   *     line.  */
++  for (uptr = user_specs_head; uptr; uptr = uptr->next)
++    {
++      char *filename = find_a_file (&startfile_prefixes, uptr->filename,
++        R_OK, true);
++      read_specs (filename ? filename : uptr->filename, false, true);
++    }
++  /* Process any user self specs.  */
++  {
++    struct spec_list *sl;
++    for (sl = specs; sl; sl = sl->next)
++      if (sl->name_len == sizeof "self_spec" - 1
++          && !strcmp (sl->name, "self_spec"))
++        do_self_spec (*sl->ptr_spec);
++  }
++
+   /* Process DRIVER_SELF_SPECS, adding any new options to the end
+      of the command line.  */
+ 
+@@ -6535,24 +6578,6 @@ main (int argc, char **argv)
+                             PREFIX_PRIORITY_LAST, 0, 1);
+     }
+ 
+-  /* Process any user specified specs in the order given on the command
+-     line.  */
+-  for (uptr = user_specs_head; uptr; uptr = uptr->next)
+-    {
+-      char *filename = find_a_file (&startfile_prefixes, uptr->filename,
+-                                  R_OK, true);
+-      read_specs (filename ? filename : uptr->filename, false, true);
+-    }
+-
+-  /* Process any user self specs.  */
+-  {
+-    struct spec_list *sl;
+-    for (sl = specs; sl; sl = sl->next)
+-      if (sl->name_len == sizeof "self_spec" - 1
+-        && !strcmp (sl->name, "self_spec"))
+-      do_self_spec (*sl->ptr_spec);
+-  }
+-
+   if (compare_debug)
+     {
+       enum save_temps save;

diff --git a/sys-devel/gcc/gcc-4.9.2-r100.ebuild 
b/sys-devel/gcc/gcc-4.9.2-r100.ebuild
new file mode 100644
index 0000000..e9ad848
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.2-r100.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+EAPI=5
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.1"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="The GNU Compiler Collection"
+HOMEPAGE="http://gcc.gnu.org/";
+SRC_URI="mirror://gnu/${PN}/${P}/${P}.tar.bz2
+       
http://dev.gentoo.org/~vapier/dist/${P}-uclibc-patches-${UCLIBC_VER}.tar.bz2
+       http://dev.gentoo.org/~vapier/dist/${P}-patches-${PATCH_VER}.tar.bz2
+       http://dev.gentoo.org/~vapier/dist/${P}-piepatches-v${PIE_VER}.tar.bz2
+       
http://dev.gentoo.org/~rhill/dist/${PN}-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2";
+
+LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ 
gcc-runtime-library-exception-3.1 ) FDL-1.3+"
+SLOT="${PV%.*}"
+KEYWORDS="~amd64 ~x86"
+IUSE="altivec +cxx doc fixed-point +fortran go graphite hardened libssp
+       multilib +nls +nptl objc objc-gc objc++ +openmp +pie +sanitize +ssp
+       test vanilla"
+
+RDEPEND="
+       >=dev-libs/gmp-4.3.2
+       >=dev-libs/mpc-0.8.1
+       >=dev-libs/mpfr-2.4.2
+       sys-libs/zlib
+       virtual/libiconv
+       graphite? (
+               >=dev-libs/cloog-0.18.0
+               >=dev-libs/isl-0.11.1
+       )
+       nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+       >=sys-devel/bison-1.875
+       >=sys-devel/flex-2.5.4
+       nls? ( sys-devel/gettext )
+       test? (
+               >=dev-util/dejagnu-1.4.4
+               >=sys-devel/autogen-5.5.4
+       )
+       elibc_glibc? ( >=sys-libs/glibc-2.8 )
+       >=sys-devel/binutils-2.20"
+
+PDEPEND="elibc_glibc? ( >=sys-libs/glibc-2.8 )
+       >=sys-devel/gcc-config-1.7"
+
+REQUIRED_USE="
+       doc? ( cxx )
+       go? ( cxx )
+       hardened? ( pie ssp )
+       objc++? ( cxx )
+       pie? ( !vanilla )
+       ssp? ( !vanilla )"
+
+pkg_setup() {
+       export CTARGET=${CTARGET:-${CHOST}}
+
+       # we dont want to use the installed compiler's specs to build gcc
+       unset GCC_SPECS
+       unset LANGUAGES #265283
+}
+
+setup_multilib_osdirnames() {
+       use multilib || return 0
+
+       local config
+       local libdirs="../lib64 ../lib32"
+
+       # this only makes sense for some Linux targets
+       case ${CTARGET} in
+               x86_64*-linux*)    config="i386" ;;
+               powerpc64*-linux*) config="rs6000" ;;
+               sparc64*-linux*)   config="sparc" ;;
+               s390x*-linux*)     config="s390" ;;
+               *)                 return 0 ;;
+       esac
+       config+="/t-linux64"
+
+       local sed_args=()
+       sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
+       if [[ ${SYMLINK_LIB} == "yes" ]] ; then
+               einfo "updating multilib directories to be: ${libdirs}"
+               sed_args+=( -e 
'/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
+       else
+               einfo "using upstream multilib; disabling lib32 autodetection"
+               sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' )
+       fi
+       sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die
+}
+
+src_prepare() {
+       export BRANDING_GCC_PKGVERSION="Gentoo ${PVR}::mgorny"
+
+       if has_version '<sys-libs/glibc-2.12' ; then
+               ewarn "Your host glibc is too old; disabling automatic fortify."
+               ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 
#362315"
+               rm "${WORKDIR}"/patch/10_all_default-fortify-source.patch || die
+       fi
+
+       if ! use vanilla; then
+               BRANDING_GCC_PKGVERSION+=" p${PATCH_VER}"
+
+               einfo "Applying Gentoo patches ..."
+               epatch "${WORKDIR}"/patch/*.patch
+               einfo "Applying uClibc patches ..."
+               epatch "${WORKDIR}"/uclibc/*.patch
+
+               if use pie; then
+                       BRANDING_GCC_PKGVERSION+=", pie-${PIE_VER}"
+
+                       einfo "Applying pie patches ..."
+                       epatch "${WORKDIR}"/piepatch/*.patch
+               fi
+
+               # Hardening stuff.
+               local hard_flags=()
+               if use hardened; then
+                       
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+                       hard_flags+=( -DEFAULT_PIE_SSP )
+               else
+                       hard_flags+=( -DEFAULT_SSP )
+               fi
+
+               sed -i \
+                       -e "/^ALL_CFLAGS = /s|=|= ${hard_flags[*]} |" \
+                       -e "/^ALL_CXXFLAGS = /s|=|= ${hard_flags[*]} |" \
+                       "${S}"/gcc/Makefile.in || die
+
+               #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for 
the hardened specs.
+               [[ ${CHOST} == ${CTARGET} ]] && epatch 
"${FILESDIR}"/gcc-spec-env-r1.patch
+       fi
+
+       epatch_user
+
+       find "${S}" -name Makefile.in \
+               -exec sed -i 
'/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
+
+       setup_multilib_osdirnames
+
+       # Prevent new texinfo from breaking old versions (see #198182, #464008)
+       epatch "${FILESDIR}"/gcc-configure-texinfo.patch
+
+       einfo "Touching generated files ..."
+       ./contrib/gcc_update --touch
+}
+
+gcc-abi-map() {
+       # Convert the ABI name we use in Gentoo to what gcc uses
+       local map=()
+       case ${CTARGET} in
+               mips*)   map=("o32 32" "n32 n32" "n64 64") ;;
+               x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
+       esac
+
+       local m
+       for m in "${map[@]}" ; do
+               if [[ $1 == ${l% *} ]]; then
+                       echo "${l#* }"
+                       break
+               fi
+       done
+}
+
+src_configure() {
+       strip-flags
+       filter-flags '-mabi*' -m31 -m32 -m64
+       replace-flags -O3 -O2
+       filter-flags -frecord-gcc-switches # 490738
+       filter-flags -mno-rtm -mno-htm # 506202
+       filter-flags '-mcpu=*'
+
+       einfo "CFLAGS: ${CFLAGS}"
+       einfo "CXXFLAGS: ${CXXFLAGS}"
+       einfo "LDFLAGS: ${LDFLAGS}"
+
+       local prefix=/usr
+       local binpath=${prefix}/${CTARGET}/gcc-bin/${PV}
+       local libpath=${prefix}/lib/gcc/${CTARGET}/${PV}
+       local incpath=${libpath}/include
+       local datapath=${prefix}/share/gcc-data/${CTARGET}/${PV}
+       local stdcxx_incdir=${libpath}/include/g++-v${GCC_BRANCH_VER%%.*}
+
+       local langs=( c )
+       use cxx && langs+=( c++ )
+       use go && langs+=( go )
+       use objc && langs+=( objc )
+       use objc++ && langs+=( obj-c++ )
+       use fortran && langs+=( fortran )
+       langs=${langs[*]}
+
+       local myconf=(
+               --host=${CHOST}
+               --build=${CBUILD:-${CHOST}}
+
+               --prefix="${prefix}"
+               --bindir="${binpath}"
+               --includedir="${incpath}"
+               --datadir="${datapath}"
+               --mandir="${datapath}/man"
+               --infodir="${datapath}/info"
+               --with-gxx-include-dir="${stdcxx_incdir}"
+               --with-python-dir=${datapath#${prefix}/}/python
+
+               --enable-languages="${langs// /,}"
+               --disable-libgcj
+
+               --enable-obsolete
+               --enable-secureplt
+               --disable-werror
+               --with-system-zlib
+               --disable-libunwind-exceptions
+               --enable-checking=release
+
+               $(use_enable nls)
+               --without-included-gettext
+
+               # branding
+               --with-bugurl=https://bugs.gentoo.org/
+               --with-pkgversion="${BRANDING_GCC_PKGVERSION}"
+
+               $(use_enable hardened esp)
+               # allow gcc to search for clock funcs in the main C lib.
+               # if it can't find them, then tough cookies -- we aren't
+               # going to link in -lrt to all C++ apps.  #411681
+               $(use_enable cxx libstdcxx-time)
+
+               --enable-lto
+               --enable-shared
+               --enable-threads=posix
+
+               # ppc altivec
+               $(use_enable altivec)
+               # mips fixed-point arithmetic
+               $(use_enable fixed-point)
+
+               $(use_enable multilib)
+               $(use_enable openmp libgomp)
+               --disable-libmudflap
+               $(use_enable libssp)
+               # used only by fortran
+               $(use_enable fortran libquadmath)
+               $(use_with graphite cloog)
+               $(use_enable '!graphite' isl-version-check)
+               $(use_enable sanitize libsanitizer)
+               $(use_enable objc-gc)
+       )
+
+       # __cxa_atexit is "essential for fully standards-compliant handling of
+       # destructors", but apparently requires glibc.
+       case ${CTARGET} in
+               *-uclibc*)
+                       myconf+=(
+                               --disable-__cxa_atexit
+                               $(use_enable nptl tls)
+                       )
+                       ;;
+               *-elf|*-eabi)
+                       myconf+=( --with-newlib )
+                       ;;
+               *-gnu*)
+                       myconf+=(
+                               --enable-__cxa_atexit
+                               --enable-clocale=gnu
+                       )
+                       ;;
+               *-freebsd*)
+                       myconf+=( --enable-__cxa_atexit )
+                       ;;
+               *-solaris*)
+                       myconf+=( --enable-__cxa_atexit )
+                       ;;
+       esac
+
+       : ${TARGET_ABI:=${ABI}}
+       : ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
+       : ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
+
+       # translate our notion of multilibs into gcc's
+       local abi list
+       for abi in $(get_all_abis TARGET); do
+               local l=$(gcc-abi-map ${abi})
+               [[ -n ${l} ]] && list+=",${l}"
+       done
+       if [[ -n ${list} ]] ; then
+               case ${CTARGET} in
+               x86_64*)
+                       myconf+=( --with-multilib-list=${list:1} )
+                       ;;
+               esac
+       fi
+
+       case $(tc-is-softfloat) in
+               yes)    myconf+=( --with-float=soft ) ;;
+               softfp) myconf+=( --with-float=softfp ) ;;
+               *)
+                       # If they've explicitly opt-ed in, do hardfloat,
+                       # otherwise let the gcc default kick in.
+                       case ${CTARGET//_/-} in
+                               *-hardfloat-*|*eabihf) myconf+=( 
--with-float=hard ) ;;
+                       esac
+       esac
+
+       local with_abi_map=()
+       case $(tc-arch) in
+               arm) #264534 #414395
+                       local a arm_arch=${CTARGET%%-*}
+                       # Remove trailing endian variations first: eb el be bl 
b l
+                       for a in e{b,l} {b,l}e b l ; do
+                               if [[ ${arm_arch} == *${a} ]] ; then
+                                       arm_arch=${arm_arch%${a}}
+                                       break
+                               fi
+                       done
+                       # Convert armv7{a,r,m} to armv7-{a,r,m}
+                       [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
+                       # See if this is a valid --with-arch flag
+                       if (srcdir=${S}/gcc target=${CTARGET} 
with_arch=${arm_arch};
+                               . "${srcdir}"/config.gcc) &>/dev/null
+                       then
+                               myconf+=( --with-arch=${arm_arch} )
+                       fi
+
+                       # Make default mode thumb for microcontroller classes 
#418209
+                       [[ ${arm_arch} == *-m ]] && myconf+=( --with-mode=thumb 
)
+
+                       # Enable hardvfp
+                       if [[ $(tc-is-softfloat) == "no" && ${CTARGET} == 
armv[67]* ]]
+                       then
+                               # Follow the new arm hardfp distro standard by 
default
+                               myconf+=( --with-float=hard )
+                               case ${CTARGET} in
+                                       armv6*) myconf+=( --with-fpu=vfp ) ;;
+                                       armv7*) myconf+=( --with-fpu=vfpv3-d16 
) ;;
+                               esac
+                       fi
+                       ;;
+               mips)
+                       # Add --with-abi flags to set default ABI
+                       myconf+=( --with-abi=$(gcc-abi-map 
"${TARGET_DEFAULT_ABI}") )
+                       ;;
+               amd64)
+                       # drop the older/ABI checks once this get's merged into 
some
+                       # version of gcc upstream
+                       # translate our notion of multilibs into gcc's
+                       local abi list
+                       for abi in $(get_all_abis TARGET) ; do
+                               local l=$(gcc-abi-map ${abi})
+                               [[ -n ${l} ]] && list+=",${l}"
+                       done
+                       if [[ -n ${list} ]] ; then
+                               case ${CTARGET} in
+                               x86_64*)
+                                       myconf+=( 
--with-multilib-list=${list:1} )
+                                       ;;
+                               esac
+                       fi
+
+                       if has x32 $(get_all_abis TARGET) ; then
+                               myconf+=( --with-abi=$(gcc-abi-map 
${TARGET_DEFAULT_ABI}) )
+                       fi
+                       ;;
+               x86)
+                       # Default arch for x86 is normally i386, lets give it a 
bump
+                       # since glibc will do so based on CTARGET anyways
+                       myconf+=( --with-arch="${CTARGET%%-*}" )
+                       ;;
+               ppc)
+                       # Set up defaults based on current CFLAGS
+                       is-flagq -mfloat-gprs=double && myconf+=( 
--enable-e500-double )
+                       [[ ${CTARGET//_/-} == *-e500v2-* ]] && myconf+=( 
--enable-e500-double )
+                       ;;
+       esac
+
+       # if the target can do biarch (-m32/-m64), enable it.  overhead should
+       # be small, and should simplify building of 64bit kernels in a 32bit
+       # userland by not needing sys-devel/kgcc64.  #349405
+       case $(tc-arch) in
+               ppc|ppc64) myconf+=( --enable-targets=all ) ;;
+               sparc)     myconf+=( --enable-targets=all ) ;;
+               amd64|x86) myconf+=( --enable-targets=all ) ;;
+       esac
+
+       # On Darwin we need libdir to be set in order to get correct install 
names
+       # for things like libobjc-gnu, libgcj and libfortran.  If we enable it 
on
+       # non-Darwin we screw up the behaviour this eclass relies on.  We in
+       # particular need this over --libdir for bug #255315.
+       [[ ${CTARGET} == *-darwin* ]] && \
+               myconf+=( --enable-version-specific-runtime-libs )
+
+       # Disable gcc info regeneration #464008
+       export gcc_cv_prog_makeinfo_modern=no
+
+       # Build in a separate build tree
+       mkdir -p "${WORKDIR}"/build
+       pushd "${WORKDIR}"/build > /dev/null
+
+       # and now to do the actual configuration
+       addwrite /dev/zero
+       set -- "${S}"/configure "${myconf[@]}" ${EXTRA_ECONF}
+       echo "${@}"
+       "${@}" || die 'configure failed'
+
+       # return to whatever directory we were in before
+       popd > /dev/null
+
+
+       # TODO: crap
+
+       cat <<-EOF > envd
+       PATH="${binpath}"
+       ROOTPATH="${binpath}"
+       GCC_PATH="${binpath}"
+       LDPATH="${ldpaths}"
+       MANPATH="${datapath}/man"
+       INFOPATH="${datapath}/info"
+       STDCXX_INCDIR="${stdcxx_incdir##*/}"
+       CTARGET="${CTARGET}"
+       GCC_SPECS="${gcc_specs_file}"
+       MULTIOSDIRS="${mosdirs}"
+       EOF
+}
+
+src_compile() {
+       touch "${S}"/gcc/c-gperf.h
+
+       local prefix=/usr
+       local libpath=${prefix}/lib/gcc/${CTARGET}/${PV}
+
+       emake -C "${WORKDIR}"/build all \
+               LDFLAGS="${LDFLAGS}" \
+               STAGE1_CFLAGS="${CFLAGS}" \
+               LIBPATH="${libpath}" \
+               BOOT_CFLAGS="$(get_abi_CFLAGS "${TARGET_DEFAULT_ABI}") 
${CFLAGS}"
+
+       if use cxx && use doc; then
+               emake -C "${WORKDIR}"/build/"${CTARGET}"/libstdc++-v3/doc \
+                       doc-man-doxygen
+       fi
+}
+
+src_test() {
+       emake -k -C "${WORKDIR}"/build check
+}

Reply via email to