From ba23572ded4dbb8955f7638f0314b2522c9d2f4c Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 27 Feb 2019 23:16:52 +0000 Subject: toolchain.eclass: avoid in_iuse in global scope Another tiny step towards EAPI=6+ support. 'in_iuse' helper is not allowed to query IUSE (even though we set all values locally in the eclass). Use 'TC_FEATURES' array and 'tc_has_feature' helper for equivalent purpose. Signed-off-by: Sergei Trofimovich --- eclass/toolchain.eclass | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 54cc513eb36e..68cf63887f22 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -138,16 +138,23 @@ else fi IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls +nptl" +TC_FEATURES=() + +tc_has_feature() { + has "$1" "${TC_FEATURES[@]}" +} + if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then - IUSE+=" altivec debug +cxx +fortran" + IUSE+=" altivec debug +cxx +fortran" TC_FEATURES+=(fortran) [[ -n ${PIE_VER} ]] && IUSE+=" nopie" [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking" [[ -n ${D_VER} ]] && IUSE+=" d" [[ -n ${SPECS_VER} ]] && IUSE+=" nossp" tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc" - tc_version_is_between 3 7 && IUSE+=" awt gcj" + tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj) tc_version_is_at_least 3.3 && IUSE+=" pgo" - tc_version_is_at_least 4.0 && IUSE+=" objc-gc" + tc_version_is_at_least 4.0 && + IUSE+=" objc-gc" TC_FEATURES+=(objc-gc) tc_version_is_between 4.0 4.9 && IUSE+=" mudflap" tc_version_is_at_least 4.1 && IUSE+=" libssp objc++" tc_version_is_at_least 4.2 && IUSE+=" +openmp" @@ -156,13 +163,15 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then # Note: while <=gcc-4.7 also supported graphite, it required forked ppl # versions which we dropped. Since graphite was also experimental in # the older versions, we don't want to bother supporting it. #448024 - tc_version_is_at_least 4.8 && IUSE+=" graphite +sanitize" + tc_version_is_at_least 4.8 && + IUSE+=" graphite +sanitize" TC_FEATURES+=(graphite) tc_version_is_between 4.9 8 && IUSE+=" cilk" tc_version_is_at_least 4.9 && IUSE+=" +vtv" tc_version_is_at_least 5.0 && IUSE+=" jit mpx" tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch" # systemtap is a gentoo-specific switch: bug #654748 - tc_version_is_at_least 8.0 && IUSE+=" systemtap" + tc_version_is_at_least 8.0 && + IUSE+=" systemtap" TC_FEATURES+=(systemtap) fi SLOT="${GCC_CONFIG_VER}" @@ -178,20 +187,20 @@ if tc_version_is_at_least 4 ; then GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0=" if tc_version_is_at_least 4.3 ; then RDEPEND+=" ${GMP_MPFR_DEPS}" - elif in_iuse fortran ; then + elif tc_has_feature fortran ; then RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )" fi fi tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0=" -if in_iuse objc-gc ; then +if tc_has_feature 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_has_feature graphite ; then if tc_version_is_at_least 5.0 ; then RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )" elif tc_version_is_at_least 4.8 ; then @@ -212,7 +221,7 @@ DEPEND="${RDEPEND} >=sys-devel/autogen-5.5.4 )" -if in_iuse gcj ; then +if tc_has_feature gcj ; then GCJ_DEPS=">=media-libs/libart_lgpl-2.1" GCJ_GTK_DEPS=" x11-base/xorg-proto @@ -227,7 +236,7 @@ if in_iuse gcj ; then DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )" fi -if in_iuse systemtap ; then +if tc_has_feature systemtap ; then # gcc needs sys/sdt.h headers on target DEPEND+=" systemtap? ( dev-util/systemtap )" fi @@ -380,7 +389,7 @@ get_gcc_src_uri() { [[ -n ${D_VER} ]] && \ GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )" - if in_iuse gcj ; then + if tc_has_feature gcj ; then if tc_version_is_at_least 4.5 ; then GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" elif tc_version_is_at_least 4.3 ; then -- cgit v1.2.3-65-gdbad