1 |
commit: ba23572ded4dbb8955f7638f0314b2522c9d2f4c |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 27 23:16:52 2019 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 27 23:21:13 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba23572d |
7 |
|
8 |
toolchain.eclass: avoid in_iuse in global scope |
9 |
|
10 |
Another tiny step towards EAPI=6+ support. |
11 |
|
12 |
'in_iuse' helper is not allowed to query IUSE (even though we set |
13 |
all values locally in the eclass). |
14 |
|
15 |
Use 'TC_FEATURES' array and 'tc_has_feature' helper for equivalent |
16 |
purpose. |
17 |
|
18 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
19 |
|
20 |
eclass/toolchain.eclass | 31 ++++++++++++++++++++----------- |
21 |
1 file changed, 20 insertions(+), 11 deletions(-) |
22 |
|
23 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
24 |
index 54cc513eb36..68cf63887f2 100644 |
25 |
--- a/eclass/toolchain.eclass |
26 |
+++ b/eclass/toolchain.eclass |
27 |
@@ -138,16 +138,23 @@ else |
28 |
fi |
29 |
IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls +nptl" |
30 |
|
31 |
+TC_FEATURES=() |
32 |
+ |
33 |
+tc_has_feature() { |
34 |
+ has "$1" "${TC_FEATURES[@]}" |
35 |
+} |
36 |
+ |
37 |
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
38 |
- IUSE+=" altivec debug +cxx +fortran" |
39 |
+ IUSE+=" altivec debug +cxx +fortran" TC_FEATURES+=(fortran) |
40 |
[[ -n ${PIE_VER} ]] && IUSE+=" nopie" |
41 |
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking" |
42 |
[[ -n ${D_VER} ]] && IUSE+=" d" |
43 |
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp" |
44 |
tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc" |
45 |
- tc_version_is_between 3 7 && IUSE+=" awt gcj" |
46 |
+ tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj) |
47 |
tc_version_is_at_least 3.3 && IUSE+=" pgo" |
48 |
- tc_version_is_at_least 4.0 && IUSE+=" objc-gc" |
49 |
+ tc_version_is_at_least 4.0 && |
50 |
+ IUSE+=" objc-gc" TC_FEATURES+=(objc-gc) |
51 |
tc_version_is_between 4.0 4.9 && IUSE+=" mudflap" |
52 |
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++" |
53 |
tc_version_is_at_least 4.2 && IUSE+=" +openmp" |
54 |
@@ -156,13 +163,15 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
55 |
# Note: while <=gcc-4.7 also supported graphite, it required forked ppl |
56 |
# versions which we dropped. Since graphite was also experimental in |
57 |
# the older versions, we don't want to bother supporting it. #448024 |
58 |
- tc_version_is_at_least 4.8 && IUSE+=" graphite +sanitize" |
59 |
+ tc_version_is_at_least 4.8 && |
60 |
+ IUSE+=" graphite +sanitize" TC_FEATURES+=(graphite) |
61 |
tc_version_is_between 4.9 8 && IUSE+=" cilk" |
62 |
tc_version_is_at_least 4.9 && IUSE+=" +vtv" |
63 |
tc_version_is_at_least 5.0 && IUSE+=" jit mpx" |
64 |
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch" |
65 |
# systemtap is a gentoo-specific switch: bug #654748 |
66 |
- tc_version_is_at_least 8.0 && IUSE+=" systemtap" |
67 |
+ tc_version_is_at_least 8.0 && |
68 |
+ IUSE+=" systemtap" TC_FEATURES+=(systemtap) |
69 |
fi |
70 |
|
71 |
SLOT="${GCC_CONFIG_VER}" |
72 |
@@ -178,20 +187,20 @@ if tc_version_is_at_least 4 ; then |
73 |
GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0=" |
74 |
if tc_version_is_at_least 4.3 ; then |
75 |
RDEPEND+=" ${GMP_MPFR_DEPS}" |
76 |
- elif in_iuse fortran ; then |
77 |
+ elif tc_has_feature fortran ; then |
78 |
RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )" |
79 |
fi |
80 |
fi |
81 |
|
82 |
tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0=" |
83 |
|
84 |
-if in_iuse objc-gc ; then |
85 |
+if tc_has_feature objc-gc ; then |
86 |
if tc_version_is_at_least 7 ; then |
87 |
RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )" |
88 |
fi |
89 |
fi |
90 |
|
91 |
-if in_iuse graphite ; then |
92 |
+if tc_has_feature graphite ; then |
93 |
if tc_version_is_at_least 5.0 ; then |
94 |
RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )" |
95 |
elif tc_version_is_at_least 4.8 ; then |
96 |
@@ -212,7 +221,7 @@ DEPEND="${RDEPEND} |
97 |
>=sys-devel/autogen-5.5.4 |
98 |
)" |
99 |
|
100 |
-if in_iuse gcj ; then |
101 |
+if tc_has_feature gcj ; then |
102 |
GCJ_DEPS=">=media-libs/libart_lgpl-2.1" |
103 |
GCJ_GTK_DEPS=" |
104 |
x11-base/xorg-proto |
105 |
@@ -227,7 +236,7 @@ if in_iuse gcj ; then |
106 |
DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )" |
107 |
fi |
108 |
|
109 |
-if in_iuse systemtap ; then |
110 |
+if tc_has_feature systemtap ; then |
111 |
# gcc needs sys/sdt.h headers on target |
112 |
DEPEND+=" systemtap? ( dev-util/systemtap )" |
113 |
fi |
114 |
@@ -380,7 +389,7 @@ get_gcc_src_uri() { |
115 |
[[ -n ${D_VER} ]] && \ |
116 |
GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )" |
117 |
|
118 |
- if in_iuse gcj ; then |
119 |
+ if tc_has_feature gcj ; then |
120 |
if tc_version_is_at_least 4.5 ; then |
121 |
GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" |
122 |
elif tc_version_is_at_least 4.3 ; then |