1 |
The function is not called from any ebuilds in the gentoo repository. |
2 |
Inline it as "in_iuse foo && use foo" in other eclasses, or define it |
3 |
as a local function when it is called multiple times. |
4 |
|
5 |
Signed-off-by: Ulrich Müller <ulm@g.o> |
6 |
--- |
7 |
eclass/chromium-2.eclass | 4 +-- |
8 |
eclass/eutils.eclass | 3 ++ |
9 |
eclass/gnome2.eclass | 2 +- |
10 |
eclass/mate.eclass | 4 +-- |
11 |
eclass/toolchain.eclass | 77 ++++++++++++++++++++++------------------ |
12 |
5 files changed, 51 insertions(+), 39 deletions(-) |
13 |
|
14 |
diff --git a/eclass/chromium-2.eclass b/eclass/chromium-2.eclass |
15 |
index c9cfe5acebee..b3d63f302d05 100644 |
16 |
--- a/eclass/chromium-2.eclass |
17 |
+++ b/eclass/chromium-2.eclass |
18 |
@@ -1,4 +1,4 @@ |
19 |
-# Copyright 1999-2016 Gentoo Foundation |
20 |
+# Copyright 1999-2020 Gentoo Authors |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
|
23 |
# @ECLASS: chromium-2.eclass |
24 |
@@ -126,7 +126,7 @@ chromium_pkg_die() { |
25 |
fi |
26 |
|
27 |
# No ricer bugs. |
28 |
- if use_if_iuse custom-cflags; then |
29 |
+ if in_iuse custom-cflags && use custom-cflags; then |
30 |
ewarn |
31 |
ewarn "You have enabled the custom-cflags USE flag." |
32 |
ewarn "Please disable it before reporting a bug." |
33 |
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
34 |
index 0a99d00ee01a..ba6bf8178673 100644 |
35 |
--- a/eclass/eutils.eclass |
36 |
+++ b/eclass/eutils.eclass |
37 |
@@ -79,6 +79,9 @@ path_exists() { |
38 |
# |
39 |
# Note that this function should not be used in the global scope. |
40 |
use_if_iuse() { |
41 |
+ eqawarn "use_if_iuse is deprecated." |
42 |
+ eqawarn "Define it as a local function, or inline it:" |
43 |
+ eqawarn " in_iuse foo && use foo" |
44 |
in_iuse $1 || return 1 |
45 |
use $1 |
46 |
} |
47 |
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass |
48 |
index a16fc916c6d2..1a4ff451df32 100644 |
49 |
--- a/eclass/gnome2.eclass |
50 |
+++ b/eclass/gnome2.eclass |
51 |
@@ -296,7 +296,7 @@ gnome2_src_install() { |
52 |
if has ${EAPI:-0} 4; then |
53 |
if [[ "${GNOME2_LA_PUNT}" != "no" ]]; then |
54 |
ebegin "Removing .la files" |
55 |
- if ! use_if_iuse static-libs ; then |
56 |
+ if ! in_iuse static-libs || ! use static-libs ; then |
57 |
find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed" |
58 |
fi |
59 |
eend |
60 |
diff --git a/eclass/mate.eclass b/eclass/mate.eclass |
61 |
index d7dd2dbceec0..34d5e47acc22 100644 |
62 |
--- a/eclass/mate.eclass |
63 |
+++ b/eclass/mate.eclass |
64 |
@@ -1,4 +1,4 @@ |
65 |
-# Copyright 1999-2016 Gentoo Foundation |
66 |
+# Copyright 1999-2020 Gentoo Authors |
67 |
# Distributed under the terms of the GNU General Public License v2 |
68 |
|
69 |
# @ECLASS: mate.eclass |
70 |
@@ -120,7 +120,7 @@ mate_src_configure() { |
71 |
local mateconf=() |
72 |
|
73 |
# Pass --disable-static whenever possible |
74 |
- if ! use_if_iuse static-libs; then |
75 |
+ if ! in_iuse static-libs || ! use static-libs; then |
76 |
if grep -q "enable-static" "${ECONF_SOURCE:-.}"/configure; then |
77 |
mateconf+=( --disable-static ) |
78 |
fi |
79 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
80 |
index 6fb3eb941a2c..32996a2f8f71 100644 |
81 |
--- a/eclass/toolchain.eclass |
82 |
+++ b/eclass/toolchain.eclass |
83 |
@@ -398,10 +398,13 @@ SRC_URI=$(get_gcc_src_uri) |
84 |
#---->> pkg_pretend <<---- |
85 |
|
86 |
toolchain_pkg_pretend() { |
87 |
- if ! use_if_iuse cxx ; then |
88 |
- use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' |
89 |
- use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' |
90 |
- use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' |
91 |
+ if ! _tc_use_if_iuse cxx ; then |
92 |
+ _tc_use_if_iuse go && \ |
93 |
+ ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' |
94 |
+ _tc_use_if_iuse objc++ && \ |
95 |
+ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' |
96 |
+ _tc_use_if_iuse gcj && \ |
97 |
+ ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' |
98 |
fi |
99 |
|
100 |
want_minispecs |
101 |
@@ -461,7 +464,8 @@ toolchain_src_prepare() { |
102 |
*) die "Update toolchain_src_prepare() for ${EAPI}." ;; |
103 |
esac |
104 |
|
105 |
- if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then |
106 |
+ if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \ |
107 |
+ && ! use vanilla ; then |
108 |
make_gcc_hard |
109 |
fi |
110 |
|
111 |
@@ -481,7 +485,7 @@ toolchain_src_prepare() { |
112 |
fi |
113 |
|
114 |
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it |
115 |
- if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then |
116 |
+ if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then |
117 |
if tc_version_is_at_least 4.5 ; then |
118 |
einfo "Copying ecj-4.5.jar" |
119 |
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die |
120 |
@@ -578,13 +582,13 @@ make_gcc_hard() { |
121 |
|
122 |
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default |
123 |
if tc_version_is_at_least 6.0 ; then |
124 |
- if use_if_iuse pie ; then |
125 |
+ if _tc_use_if_iuse pie ; then |
126 |
einfo "Updating gcc to use automatic PIE building ..." |
127 |
fi |
128 |
- if use_if_iuse ssp ; then |
129 |
+ if _tc_use_if_iuse ssp ; then |
130 |
einfo "Updating gcc to use automatic SSP building ..." |
131 |
fi |
132 |
- if use_if_iuse hardened ; then |
133 |
+ if _tc_use_if_iuse hardened ; then |
134 |
# Will add some hardened options as default, like: |
135 |
# -fstack-clash-protection |
136 |
# -z now |
137 |
@@ -594,7 +598,7 @@ make_gcc_hard() { |
138 |
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
139 |
fi |
140 |
else |
141 |
- if use_if_iuse hardened ; then |
142 |
+ if _tc_use_if_iuse hardened ; then |
143 |
# rebrand to make bug reports easier |
144 |
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
145 |
if hardened_gcc_works ; then |
146 |
@@ -830,12 +834,12 @@ toolchain_src_configure() { |
147 |
fi |
148 |
|
149 |
# Build compiler itself using LTO |
150 |
- if tc_version_is_at_least 9.1 && use_if_iuse lto ; then |
151 |
+ if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then |
152 |
confgcc+=( --with-build-config=bootstrap-lto ) |
153 |
fi |
154 |
|
155 |
# Support to disable pch when building libstdcxx |
156 |
- if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then |
157 |
+ if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then |
158 |
confgcc+=( --disable-libstdcxx-pch ) |
159 |
fi |
160 |
|
161 |
@@ -1124,13 +1128,13 @@ toolchain_src_configure() { |
162 |
fi |
163 |
|
164 |
if tc_version_is_at_least 4.0 ; then |
165 |
- if use_if_iuse libssp ; then |
166 |
+ if _tc_use_if_iuse libssp ; then |
167 |
confgcc+=( --enable-libssp ) |
168 |
else |
169 |
if hardened_gcc_is_stable ssp; then |
170 |
export gcc_cv_libc_provides_ssp=yes |
171 |
fi |
172 |
- if use_if_iuse ssp; then |
173 |
+ if _tc_use_if_iuse ssp; then |
174 |
# On some targets USE="ssp -libssp" is an invalid |
175 |
# configuration as target libc does not provide |
176 |
# stack_chk_* functions. Do not disable libssp there. |
177 |
@@ -1569,7 +1573,7 @@ gcc_do_make() { |
178 |
# resulting binaries natively ^^; |
179 |
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all} |
180 |
else |
181 |
- if tc_version_is_at_least 3.3 && use_if_iuse pgo; then |
182 |
+ if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then |
183 |
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap} |
184 |
else |
185 |
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean} |
186 |
@@ -1623,7 +1627,7 @@ gcc_do_make() { |
187 |
emake -C gcc gnattools |
188 |
fi |
189 |
|
190 |
- if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then |
191 |
+ if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then |
192 |
if type -p doxygen > /dev/null ; then |
193 |
if tc_version_is_at_least 4.3 ; then |
194 |
cd "${CTARGET}"/libstdc++-v3/doc |
195 |
@@ -2220,44 +2224,48 @@ gcc-lang-supported() { |
196 |
has $1 ${TOOLCHAIN_ALLOWED_LANGS} |
197 |
} |
198 |
|
199 |
+_tc_use_if_iuse() { |
200 |
+ in_iuse $1 && use $1 |
201 |
+} |
202 |
+ |
203 |
is_ada() { |
204 |
gcc-lang-supported ada || return 1 |
205 |
- use_if_iuse ada |
206 |
+ _tc_use_if_iuse ada |
207 |
} |
208 |
|
209 |
is_cxx() { |
210 |
gcc-lang-supported 'c++' || return 1 |
211 |
- use_if_iuse cxx |
212 |
+ _tc_use_if_iuse cxx |
213 |
} |
214 |
|
215 |
is_d() { |
216 |
gcc-lang-supported d || return 1 |
217 |
- use_if_iuse d |
218 |
+ _tc_use_if_iuse d |
219 |
} |
220 |
|
221 |
is_f77() { |
222 |
gcc-lang-supported f77 || return 1 |
223 |
- use_if_iuse fortran |
224 |
+ _tc_use_if_iuse fortran |
225 |
} |
226 |
|
227 |
is_f95() { |
228 |
gcc-lang-supported f95 || return 1 |
229 |
- use_if_iuse fortran |
230 |
+ _tc_use_if_iuse fortran |
231 |
} |
232 |
|
233 |
is_fortran() { |
234 |
gcc-lang-supported fortran || return 1 |
235 |
- use_if_iuse fortran |
236 |
+ _tc_use_if_iuse fortran |
237 |
} |
238 |
|
239 |
is_gcj() { |
240 |
gcc-lang-supported java || return 1 |
241 |
- use_if_iuse cxx && use_if_iuse gcj |
242 |
+ _tc_use_if_iuse cxx && _tc_use_if_iuse gcj |
243 |
} |
244 |
|
245 |
is_go() { |
246 |
gcc-lang-supported go || return 1 |
247 |
- use_if_iuse cxx && use_if_iuse go |
248 |
+ _tc_use_if_iuse cxx && _tc_use_if_iuse go |
249 |
} |
250 |
|
251 |
is_jit() { |
252 |
@@ -2266,22 +2274,22 @@ is_jit() { |
253 |
# to generate code for a target. On target like avr |
254 |
# libgcclit.so can't link at all: bug #594572 |
255 |
is_crosscompile && return 1 |
256 |
- use_if_iuse jit |
257 |
+ _tc_use_if_iuse jit |
258 |
} |
259 |
|
260 |
is_multilib() { |
261 |
tc_version_is_at_least 3 || return 1 |
262 |
- use_if_iuse multilib |
263 |
+ _tc_use_if_iuse multilib |
264 |
} |
265 |
|
266 |
is_objc() { |
267 |
gcc-lang-supported objc || return 1 |
268 |
- use_if_iuse objc |
269 |
+ _tc_use_if_iuse objc |
270 |
} |
271 |
|
272 |
is_objcxx() { |
273 |
gcc-lang-supported 'obj-c++' || return 1 |
274 |
- use_if_iuse cxx && use_if_iuse objc++ |
275 |
+ _tc_use_if_iuse cxx && _tc_use_if_iuse objc++ |
276 |
} |
277 |
|
278 |
# Grab a variable from the build system (taken from linux-info.eclass) |
279 |
@@ -2306,12 +2314,12 @@ hardened_gcc_works() { |
280 |
[[ ${CTARGET} == *-freebsd* ]] && return 1 |
281 |
|
282 |
want_pie || return 1 |
283 |
- use_if_iuse nopie && return 1 |
284 |
+ _tc_use_if_iuse nopie && return 1 |
285 |
hardened_gcc_is_stable pie |
286 |
return $? |
287 |
elif [[ $1 == "ssp" ]] ; then |
288 |
[[ -n ${SPECS_VER} ]] || return 1 |
289 |
- use_if_iuse nossp && return 1 |
290 |
+ _tc_use_if_iuse nossp && return 1 |
291 |
hardened_gcc_is_stable ssp |
292 |
return $? |
293 |
else |
294 |
@@ -2349,12 +2357,12 @@ want_minispecs() { |
295 |
if tc_version_is_at_least 6.0 ; then |
296 |
return 0 |
297 |
fi |
298 |
- if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then |
299 |
+ if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then |
300 |
if ! want_pie ; then |
301 |
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild." |
302 |
elif use vanilla ; then |
303 |
ewarn "You will not get hardened features if you have the vanilla USE-flag." |
304 |
- elif use_if_iuse nopie && use_if_iuse nossp ; then |
305 |
+ elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then |
306 |
ewarn "You will not get hardened features if you have the nopie and nossp USE-flag." |
307 |
elif ! hardened_gcc_works ; then |
308 |
ewarn "Your $(tc-arch) arch is not supported." |
309 |
@@ -2368,11 +2376,12 @@ want_minispecs() { |
310 |
} |
311 |
|
312 |
want_pie() { |
313 |
- ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1 |
314 |
+ ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \ |
315 |
+ && _tc_use_if_iuse nopie && return 1 |
316 |
[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0 |
317 |
tc_version_is_at_least 4.3.2 && return 1 |
318 |
[[ -z ${PIE_VER} ]] && return 1 |
319 |
- use_if_iuse nopie || return 0 |
320 |
+ _tc_use_if_iuse nopie || return 0 |
321 |
return 1 |
322 |
} |
323 |
|
324 |
-- |
325 |
2.28.0 |