commit:     890fb26a2be03155a494ee32d5ad10642f478864
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 12 18:43:30 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Dec 12 18:43:30 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=890fb26a

eclass: sync toolchain.eclass by hsk17, bug #639882

 eclass/toolchain.eclass | 67 ++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 53 insertions(+), 14 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 130feea359..9dcfcf1d88 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,6 +1,5 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Id$
 
 # Maintainer: Toolchain Ninjas <[email protected]>
 
@@ -94,8 +93,6 @@ if [[ ${SNAPSHOT} == [56789].0-* ]] ; then
        SNAPSHOT=${SNAPSHOT/.0}
 fi
 
-export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
-
 PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
 
 if tc_version_is_at_least 3.4.0 ; then
@@ -145,6 +142,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
        [[ -n ${D_VER}   ]] && IUSE+=" d"
        [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
        tc_version_is_at_least 3 && IUSE+=" doc gcj awt hardened multilib objc"
+       tc_version_is_at_least 3.3 && IUSE+=" pgo"
        tc_version_is_at_least 4.0 && IUSE+=" objc-gc"
        tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
        tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
@@ -157,7 +155,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
        tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
        tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv"
        tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
-       tc_version_is_at_least 6.0 && IUSE+=" pie ssp +pch"
+       tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
 fi
 
 IUSE+=" ${IUSE_DEF[*]/#/+}"
@@ -182,6 +180,12 @@ fi
 
 tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0"
 
+if in_iuse objc-gc ; then
+       if tc_version_is_at_least 7 ; then
+               RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
+       fi
+fi
+
 if in_iuse graphite ; then
        if tc_version_is_at_least 5.0 ; then
                RDEPEND+=" graphite? ( >=dev-libs/isl-0.14 )"
@@ -237,7 +241,8 @@ S=$(
 
 gentoo_urls() {
        local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI
-       HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI"
+       HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI
+       HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
        devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/}
        echo mirror://gentoo/$1 ${devspace//URI/$1}
 }
@@ -317,7 +322,11 @@ get_gcc_src_uri() {
        elif [[ -n ${SNAPSHOT} ]] ; then
                
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2";
        else
-               
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
+               if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 
|| tc_version_is_at_least 7.2 ; then
+                       
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
+               else
+                       
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
+               fi
                # we want all branch updates to be against the main release
                [[ -n ${BRANCH_UPDATE} ]] && \
                        GCC_SRC_URI+=" $(gentoo_urls 
gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)"
@@ -434,7 +443,11 @@ gcc_quick_unpack() {
        elif [[ -n ${SNAPSHOT} ]] ; then
                unpack gcc-${SNAPSHOT}.tar.bz2
        elif [[ ${PV} != *9999* ]] ; then
-               unpack gcc-${GCC_RELEASE_VER}.tar.bz2
+               if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 
|| tc_version_is_at_least 7.2 ; then
+                       unpack gcc-${GCC_RELEASE_VER}.tar.xz
+               else
+                       unpack gcc-${GCC_RELEASE_VER}.tar.bz2
+               fi
                # We want branch updates to be against a release tarball
                if [[ -n ${BRANCH_UPDATE} ]] ; then
                        pushd "${S}" > /dev/null
@@ -594,14 +607,14 @@ toolchain_src_prepare() {
        einfo "Fixing misc issues in configure files"
        for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name 
configure)) ; do
                ebegin "  Updating ${f/${S}\/} [LANG]"
-               patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& 
"${T}"/configure-patch.log \
+               patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& 
"${T}"/configure-patch.log \
                        || eerror "Please file a bug about this"
                eend $?
        done
        sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
 
        # Prevent new texinfo from breaking old versions (see #198182, #464008)
-       tc_version_is_at_least 4.1 && epatch 
"${GCC_FILESDIR}"/gcc-configure-texinfo.patch
+       tc_version_is_at_least 4.1 && epatch 
"${FILESDIR}"/gcc-configure-texinfo.patch
 
        if [[ -x contrib/gcc_update ]] ; then
                einfo "Touching generated files"
@@ -668,6 +681,14 @@ do_gcc_CYGWINPORTS_patches() {
 make_gcc_hard() {
 
        local gcc_hard_flags=""
+
+       # If we use gcc-6 or newer with pie enable to compile older gcc we need 
to pass -no-pie
+       # to stage1; bug 618908
+       if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; 
then
+               einfo "Disabling PIE in stage1 (only) ..."
+               sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in 
|| die
+       fi
+
        # Gcc >= 6.X we can use configurations options to turn pie/ssp on as 
default
        if tc_version_is_at_least 6.0 ; then
                if use pie ; then
@@ -1524,7 +1545,8 @@ gcc_do_filter_flags() {
                FFLAGS=${CFLAGS}
                FCFLAGS=${CFLAGS}
 
-               local VAR="CFLAGS_"${CTARGET//-/_}
+               # "hppa2.0-unknown-linux-gnu" -> hppa2_0_unknown_linux_gnu
+               local VAR="CFLAGS_"${CTARGET//[-.]/_}
                CXXFLAGS=${!VAR}
        fi
 
@@ -1616,7 +1638,11 @@ gcc_do_make() {
                # resulting binaries natively ^^;
                GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
        else
-               GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+               if tc_version_is_at_least 3.3 && use pgo; then
+                       GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
+               else
+                       GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+               fi
        fi
 
        # Older versions of GCC could not do profiledbootstrap in parallel due 
to
@@ -1826,10 +1852,10 @@ toolchain_src_install() {
        # between binary and source package borks things ....
        if ! is_crosscompile ; then
                insinto "${DATAPATH#${EPREFIX}}"
-               newins "$(prefixify_ro 
"${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
+               newins "$(prefixify_ro 
"${FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
                exeinto "${DATAPATH#${EPREFIX}}"
-               doexe "$(prefixify_ro "${GCC_FILESDIR}"/fix_libtool_files.sh)" 
|| die
-               doexe "${GCC_FILESDIR}"/c{89,99} || die
+               doexe "$(prefixify_ro "${FILESDIR}"/fix_libtool_files.sh)" || 
die
+               doexe "${FILESDIR}"/c{89,99} || die
        fi
 
        # libstdc++.la: Delete as it doesn't add anything useful: g++ itself
@@ -1896,6 +1922,12 @@ toolchain_src_install() {
                pax-mark -r 
"${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
                pax-mark -r 
"${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
        fi
+
+       # Disable MPROTECT so java works. #574808
+       if is_gcj ; then
+               pax-mark -m 
"${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/ecj1"
+               pax-mark -m 
"${D}${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}/gij"
+       fi
 }
 
 # Move around the libs to the right location.  For some reason,
@@ -2108,6 +2140,9 @@ gcc_slot_java() {
 
 toolchain_pkg_postinst() {
        do_gcc_config
+       if [[ ${ROOT} == / && -f 
${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+               eselect compiler-shadow update all
+       fi
 
        if ! is_crosscompile ; then
                echo
@@ -2146,6 +2181,10 @@ toolchain_pkg_postinst() {
 }
 
 toolchain_pkg_postrm() {
+       if [[ ${ROOT} == / && -f 
${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+               eselect compiler-shadow clean all
+       fi
+
        # to make our lives easier (and saner), we do the fix_libtool stuff 
here.
        # rather than checking SLOT's and trying in upgrade paths, we just see 
if
        # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we 
are

Reply via email to