diff options
author | Ryan Hill <dirtyepic@gentoo.org> | 2013-12-19 06:00:43 +0000 |
---|---|---|
committer | Ryan Hill <dirtyepic@gentoo.org> | 2013-12-19 06:00:43 +0000 |
commit | 1eefcfa2a432200148ae0e0ffb2b62f41de58895 (patch) | |
tree | 5294850ce48140f941aafdb4c336f548f762871d /eclass | |
parent | update to 2013.2.1 (diff) | |
download | gentoo-2-1eefcfa2a432200148ae0e0ffb2b62f41de58895.tar.gz gentoo-2-1eefcfa2a432200148ae0e0ffb2b62f41de58895.tar.bz2 gentoo-2-1eefcfa2a432200148ae0e0ffb2b62f41de58895.zip |
Refactoring: Inline gcc-compiler-configure() into gcc_do_configure(). Clean
up, sort and group options.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 6 | ||||
-rw-r--r-- | eclass/toolchain.eclass | 492 |
2 files changed, 251 insertions, 247 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 8d4705e823e6..6e4d1ff086b9 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for eclass directory # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1082 2013/12/16 14:31:04 swift Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1083 2013/12/19 06:00:43 dirtyepic Exp $ + + 19 Dec 2013; Ryan Hill <dirtyepic@gentoo.org> toolchain.eclass: + Refactoring: Inline gcc-compiler-configure() into gcc_do_configure(). Clean + up, sort and group options. 16 Dec 2013; Sven Vermeulen <swift@gentoo.org> selinux-policy-2.eclass: Added HTTPS URL to EGIT_REPO_URI to allow live ebuilds to fetch data if diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 9686db0c2643..1023975a3054 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.606 2013/11/25 03:11:57 dirtyepic Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.607 2013/12/19 06:00:43 dirtyepic Exp $ # Maintainer: Toolchain Ninjas <toolchain@gentoo.org> @@ -861,165 +861,42 @@ gcc-multilib-configure() { fi } -gcc-compiler-configure() { - gcc-multilib-configure - - if tc_version_is_at_least 4.0 ; then - if in_iuse mudflap ; then - confgcc+=( $(use_enable mudflap libmudflap) ) - else - confgcc+=( --disable-libmudflap ) - fi - - if use_if_iuse libssp ; then - confgcc+=( --enable-libssp ) - else - export gcc_cv_libc_provides_ssp=yes - confgcc+=( --disable-libssp ) - fi - - # If we want hardened support with the newer piepatchset for >=gcc 4.4 - if tc_version_is_at_least 4.4 && want_minispecs ; then - confgcc+=( $(use_enable hardened esp) ) - fi - - if tc_version_is_at_least 4.2 ; then - if in_iuse openmp ; then - # Make sure target has pthreads support. #326757 #335883 - # There shouldn't be a chicken&egg problem here as openmp won't - # build without a C library, and you can't build that w/out - # already having a compiler ... - if ! is_crosscompile || \ - $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null - then - confgcc+=( $(use_enable openmp libgomp) ) - else - # Force disable as the configure script can be dumb #359855 - confgcc+=( --disable-libgomp ) - fi - else - # For gcc variants where we don't want openmp (e.g. kgcc) - confgcc+=( --disable-libgomp ) - fi - fi - - # Stick the python scripts in their own slotted directory - # bug #279252 - # - # --with-python-dir=DIR - # Specifies where to install the Python modules used for aot-compile. DIR - # should not include the prefix used in installation. For example, if the - # Python modules are to be installed in /usr/lib/python2.5/site-packages, - # then --with-python-dir=/lib/python2.5/site-packages should be passed. - # - # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python" - if tc_version_is_at_least 4.4 ; then - confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python ) - fi - fi - - # Enable build warnings by default with cross-compilers when system - # paths are included (e.g. via -I flags). - is_crosscompile && confgcc+=( --enable-poison-system-directories ) - - # For newer versions of gcc, use the default ("release"), because no - # one (even upstream apparently) tests with it disabled. #317217 - if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then - confgcc+=( --enable-checking=${GCC_CHECKS_LIST:-release} ) - else - confgcc+=( --disable-checking ) - fi - - # GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained - # right now). Much thanks to <csm@gnu.org> for the heads up. - # Travis Tilley <lv@gentoo.org> (11 Jul 2004) - if ! is_gcj ; then - confgcc+=( --disable-libgcj ) - elif use gtk ; then - confgcc+=( --enable-java-awt=gtk ) - fi +gcc_do_configure() { + local confgcc=( --host=${CHOST} ) - # 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 - if tc_version_is_at_least 4.4 && is_cxx ; then - confgcc+=( --enable-libstdcxx-time ) + if is_crosscompile || tc-is-cross-compiler ; then + # Straight from the GCC install doc: + # "GCC has code to correctly determine the correct value for target + # for nearly all native systems. Therefore, we highly recommend you + # not provide a configure target when configuring a native compiler." + confgcc+=( --target=${CTARGET} ) fi + [[ -n ${CBUILD} ]] && confgcc+=( --build=${CBUILD} ) - # newer gcc versions like to bootstrap themselves with C++, - # so we need to manually disable it ourselves - if tc_version_is_at_least 4.7 && ! is_cxx ; then - confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx ) - fi + confgcc+=( + --prefix="${PREFIX}" + --bindir="${BINPATH}" + --includedir="${INCLUDEPATH}" + --datadir="${DATAPATH}" + --mandir="${DATAPATH}/man" + --infodir="${DATAPATH}/info" + --with-gxx-include-dir="${STDCXX_INCDIR}" + ) - # newer gcc's come with libquadmath, but only fortran uses - # it, so auto punt it when we don't care - if tc_version_is_at_least 4.6 && ! is_fortran ; then - confgcc+=( --disable-libquadmath ) + # Stick the python scripts in their own slotted directory (bug #279252) + # + # --with-python-dir=DIR + # Specifies where to install the Python modules used for aot-compile. DIR + # should not include the prefix used in installation. For example, if the + # Python modules are to be installed in /usr/lib/python2.5/site-packages, + # then --with-python-dir=/lib/python2.5/site-packages should be passed. + # + # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python" + if tc_version_is_at_least 4.4 ; then + confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python ) fi - 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 - confgcc+=( --with-arch=${arm_arch} ) - fi - - # Make default mode thumb for microcontroller classes #418209 - [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb ) - - # Enable hardvfp - if [[ $(tc-is-softfloat) == "no" ]] && \ - [[ ${CTARGET} == armv[67]* ]] && \ - tc_version_is_at_least 4.5 - then - # Follow the new arm hardfp distro standard by default - confgcc+=( --with-float=hard ) - case ${CTARGET} in - armv6*) confgcc+=( --with-fpu=vfp ) ;; - armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;; - esac - fi - ;; - mips) - # Add --with-abi flags to set default ABI - confgcc+=( --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 - if tc_version_is_at_least 4.7 && has x32 $(get_all_abis TARGET) ; then - confgcc+=( --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 - confgcc+=( --with-arch=${CTARGET%%-*} ) - ;; - hppa) - # Enable sjlj exceptions for backward compatibility on hppa - [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions ) - ;; - ppc) - # Set up defaults based on current CFLAGS - is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double ) - [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --enable-e500-double ) - ;; - esac + ### language options local GCC_LANG="c" is_cxx && GCC_LANG+=",c++" @@ -1045,99 +922,63 @@ gcc-compiler-configure() { # We do NOT want 'ADA support' in here! # is_ada && GCC_LANG+=",ada" - einfo "configuring for GCC_LANG: ${GCC_LANG}" confgcc+=( --enable-languages=${GCC_LANG} ) -} -gcc_do_configure() { - local confgcc=( - # Set configuration based on path variables - --prefix="${PREFIX}" - --bindir="${BINPATH}" - --includedir="${INCLUDEPATH}" - --datadir="${DATAPATH}" - --mandir="${DATAPATH}/man" - --infodir="${DATAPATH}/info" - --with-gxx-include-dir="${STDCXX_INCDIR}" + ### general options + + confgcc+=( + --enable-obsolete + --enable-secureplt + --disable-werror + --with-system-zlib ) - # 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* ]] && \ - confgcc+=( --enable-version-specific-runtime-libs ) - # All our cross-compile logic goes here ! woo ! - confgcc+=( --host=${CHOST} ) - if is_crosscompile || tc-is-cross-compiler ; then - # Straight from the GCC install doc: - # "GCC has code to correctly determine the correct value for target - # for nearly all native systems. Therefore, we highly recommend you - # not provide a configure target when configuring a native compiler." - confgcc+=( --target=${CTARGET} ) + if use nls ; then + confgcc+=( --enable-nls --without-included-gettext ) + else + confgcc+=( --disable-nls ) fi - [[ -n ${CBUILD} ]] && confgcc+=( --build=${CBUILD} ) - - # ppc altivec support - confgcc+=( $(use_enable altivec) ) - # gcc has fixed-point arithmetic support in 4.3 for mips targets that can - # significantly increase compile time by several hours. This will allow - # users to control this feature in the event they need the support. - tc_version_is_at_least 4.3 && confgcc+=( $(use_enable fixed-point) ) - - # graphite was added in 4.4 but we only support it in 4.6+ due to external - # library issues. 4.6/4.7 uses cloog-ppl which is a fork of CLooG with a - # PPL backend. 4.8+ uses upstream CLooG with the ISL backend. We install - # cloog-ppl into a non-standard location to prevent collisions. - if tc_version_is_at_least 4.8 ; then - confgcc+=( $(use_with graphite cloog) ) - use graphite && confgcc+=( --disable-isl-version-check ) - elif tc_version_is_at_least 4.6 ; then - confgcc+=( $(use_with graphite cloog) ) - confgcc+=( $(use_with graphite ppl) ) - use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl ) - use graphite && confgcc+=( --disable-ppl-version-check ) - elif tc_version_is_at_least 4.4 ; then - confgcc+=( --without-cloog ) - confgcc+=( --without-ppl ) - fi + tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions ) - if tc_version_is_at_least 4.6 ; then - confgcc+=( $(use_enable lto) ) - elif tc_version_is_at_least 4.5 ; then - confgcc+=( --disable-lto ) + # Use the default ("release") checking because upstream usually neglects + # to test "disabled" so it has a history of breaking. #317217 + if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then + confgcc+=( --enable-checking=${GCC_CHECKS_LIST:-release} ) + else + confgcc+=( --disable-checking ) fi - case $(tc-is-softfloat) in - yes) confgcc+=( --with-float=soft ) ;; - softfp) confgcc+=( --with-float=softfp ) ;; - *) - # If they've explicitly opt-ed in, do hardfloat, - # otherwise let the gcc default kick in. - [[ ${CTARGET//_/-} == *-hardfloat-* ]] \ - && confgcc+=( --with-float=hard ) - ;; - esac + # Branding + tc_version_is_at_least 4.3 && confgcc+=( + --with-bugurl=http://bugs.gentoo.org/ + --with-pkgversion="${BRANDING_GCC_PKGVERSION}" + ) - # Native Language Support - if use nls ; then - confgcc+=( --enable-nls --without-included-gettext ) - else - confgcc+=( --disable-nls ) + # If we want hardened support with the newer piepatchset for >=gcc 4.4 + if tc_version_is_at_least 4.4 && want_minispecs ; then + confgcc+=( $(use_enable hardened esp) ) fi - # reasonably sane globals (hopefully) - confgcc+=( - --with-system-zlib - --enable-obsolete - --disable-werror - --enable-secureplt - ) + # 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 + if tc_version_is_at_least 4.4 && is_cxx ; then + confgcc+=( --enable-libstdcxx-time ) + fi - gcc-compiler-configure || die + # newer gcc versions like to bootstrap themselves with C++, + # so we need to manually disable it ourselves + if tc_version_is_at_least 4.7 && ! is_cxx ; then + confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx ) + fi + ### Cross-compiler options if is_crosscompile ; then + # Enable build warnings by default with cross-compilers when system + # paths are included (e.g. via -I flags). + confgcc+=( --enable-poison-system-directories ) + # When building a stage1 cross-compiler (just C compiler), we have to # disable a bunch of features or gcc goes boom local needed_libc="" @@ -1197,6 +1038,7 @@ gcc_do_configure() { confgcc+=( --enable-threads=posix ) ;; esac fi + # __cxa_atexit is "essential for fully standards-compliant handling of # destructors", but apparently requires glibc. case ${CTARGET} in @@ -1227,7 +1069,91 @@ gcc_do_configure() { ;; esac - tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions ) + ### arch options + + gcc-multilib-configure + + # ppc altivec support + confgcc+=( $(use_enable altivec) ) + + # gcc has fixed-point arithmetic support in 4.3 for mips targets that can + # significantly increase compile time by several hours. This will allow + # users to control this feature in the event they need the support. + tc_version_is_at_least 4.3 && confgcc+=( $(use_enable fixed-point) ) + + case $(tc-is-softfloat) in + yes) confgcc+=( --with-float=soft ) ;; + softfp) confgcc+=( --with-float=softfp ) ;; + *) + # If they've explicitly opt-ed in, do hardfloat, + # otherwise let the gcc default kick in. + [[ ${CTARGET//_/-} == *-hardfloat-* ]] \ + && confgcc+=( --with-float=hard ) + ;; + 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 + confgcc+=( --with-arch=${arm_arch} ) + fi + + # Make default mode thumb for microcontroller classes #418209 + [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb ) + + # Enable hardvfp + if [[ $(tc-is-softfloat) == "no" ]] && \ + [[ ${CTARGET} == armv[67]* ]] && \ + tc_version_is_at_least 4.5 + then + # Follow the new arm hardfp distro standard by default + confgcc+=( --with-float=hard ) + case ${CTARGET} in + armv6*) confgcc+=( --with-fpu=vfp ) ;; + armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;; + esac + fi + ;; + mips) + # Add --with-abi flags to set default ABI + confgcc+=( --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 + if tc_version_is_at_least 4.7 && has x32 $(get_all_abis TARGET) ; then + confgcc+=( --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 + confgcc+=( --with-arch=${CTARGET%%-*} ) + ;; + hppa) + # Enable sjlj exceptions for backward compatibility on hppa + [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions ) + ;; + ppc) + # Set up defaults based on current CFLAGS + is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double ) + [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --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 @@ -1238,15 +1164,85 @@ gcc_do_configure() { amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;; esac - tc_version_is_at_least 4.3 && confgcc+=( - --with-bugurl=http://bugs.gentoo.org/ - --with-pkgversion="${BRANDING_GCC_PKGVERSION}" - ) + # 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* ]] && \ + confgcc+=( --enable-version-specific-runtime-libs ) - confgcc+=( - "$@" - ${EXTRA_ECONF} - ) + ### library options + + if ! is_gcj ; then + confgcc+=( --disable-libgcj ) + elif use gtk ; then + confgcc+=( --enable-java-awt=gtk ) + fi + + if tc_version_is_at_least 4.2 ; then + if in_iuse openmp ; then + # Make sure target has pthreads support. #326757 #335883 + # There shouldn't be a chicken & egg problem here as openmp won't + # build without a C library, and you can't build that w/out + # already having a compiler ... + if ! is_crosscompile || \ + $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null + then + confgcc+=( $(use_enable openmp libgomp) ) + else + # Force disable as the configure script can be dumb #359855 + confgcc+=( --disable-libgomp ) + fi + else + # For gcc variants where we don't want openmp (e.g. kgcc) + confgcc+=( --disable-libgomp ) + fi + fi + + if tc_version_is_at_least 4.0 ; then + if in_iuse mudflap ; then + confgcc+=( $(use_enable mudflap libmudflap) ) + else + confgcc+=( --disable-libmudflap ) + fi + + if use_if_iuse libssp ; then + confgcc+=( --enable-libssp ) + else + export gcc_cv_libc_provides_ssp=yes + confgcc+=( --disable-libssp ) + fi + + fi + + # newer gcc's come with libquadmath, but only fortran uses + # it, so auto punt it when we don't care + if tc_version_is_at_least 4.6 && ! is_fortran ; then + confgcc+=( --disable-libquadmath ) + fi + + if tc_version_is_at_least 4.6 ; then + confgcc+=( $(use_enable lto) ) + elif tc_version_is_at_least 4.5 ; then + confgcc+=( --disable-lto ) + fi + + # graphite was added in 4.4 but we only support it in 4.6+ due to external + # library issues. 4.6/4.7 uses cloog-ppl which is a fork of CLooG with a + # PPL backend. 4.8+ uses upstream CLooG with the ISL backend. We install + # cloog-ppl into a non-standard location to prevent collisions. + if tc_version_is_at_least 4.8 ; then + confgcc+=( $(use_with graphite cloog) ) + use graphite && confgcc+=( --disable-isl-version-check ) + elif tc_version_is_at_least 4.6 ; then + confgcc+=( $(use_with graphite cloog) ) + confgcc+=( $(use_with graphite ppl) ) + use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl ) + use graphite && confgcc+=( --disable-ppl-version-check ) + elif tc_version_is_at_least 4.4 ; then + confgcc+=( --without-cloog ) + confgcc+=( --without-ppl ) + fi # Disable gcc info regeneration -- it ships with generated info pages # already. Our custom version/urls/etc... trigger it. #464008 @@ -1258,13 +1254,17 @@ gcc_do_configure() { # killing the 32bit builds which want /usr/lib. export ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries=' + confgcc+=( "$@" ${EXTRA_ECONF} ) + # Nothing wrong with a good dose of verbosity echo - einfo "PREFIX: ${PREFIX}" - einfo "BINPATH: ${BINPATH}" - einfo "LIBPATH: ${LIBPATH}" - einfo "DATAPATH: ${DATAPATH}" - einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}" + einfo "PREFIX: ${PREFIX}" + einfo "BINPATH: ${BINPATH}" + einfo "LIBPATH: ${LIBPATH}" + einfo "DATAPATH: ${DATAPATH}" + einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}" + echo + einfo "Languages: ${GCC_LANG}" echo einfo "Configuring GCC with: ${confgcc[@]//--/\n\t--}" echo |