Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 01 Jan 2018 10:13:45
Message-Id: 1514801616.63b0d66c654dce7e4a75776357cac44379eba802.blueness@gentoo
1 commit: 63b0d66c654dce7e4a75776357cac44379eba802
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 30 11:56:29 2017 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 1 10:13:36 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63b0d66c
7
8 toolchain.eclass: update to EAPI=5 standards
9
10 This eclass is inherited by ebuilds in sys-devel/{gcc,kgcc64,gcc-apple},
11 each which make use of different IUSE flags. This causes problems with
12 `use X` constructions when X is not in the IUSE flags. At EAPI=4 this
13 simply emitted a warning, while at EAPI=5 this is an error. We update
14 the eclass to make use of use_if_iuse and similar constructions where
15 necessary to bring the eclass into compliance with EAPI=5.
16
17 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
18
19 eclass/toolchain.eclass | 69 ++++++++++++++++++++++++++-----------------------
20 1 file changed, 36 insertions(+), 33 deletions(-)
21
22 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
23 index a038303ec7f..36d344012d4 100644
24 --- a/eclass/toolchain.eclass
25 +++ b/eclass/toolchain.eclass
26 @@ -496,7 +496,7 @@ toolchain_src_prepare() {
27 do_gcc_PIE_patches
28 epatch_user
29
30 - if ( tc_version_is_at_least 4.8.2 || use hardened ) && ! use vanilla ; then
31 + if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
32 make_gcc_hard
33 fi
34
35 @@ -538,7 +538,7 @@ toolchain_src_prepare() {
36 fi
37
38 # >= gcc-4.3 doesn't bundle ecj.jar, so copy it
39 - if tc_version_is_at_least 4.3 && use gcj ; then
40 + if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then
41 if tc_version_is_at_least 4.5 ; then
42 einfo "Copying ecj-4.5.jar"
43 cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
44 @@ -648,20 +648,20 @@ make_gcc_hard() {
45
46 # Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
47 if tc_version_is_at_least 6.0 ; then
48 - if use pie ; then
49 + if use_if_iuse pie ; then
50 einfo "Updating gcc to use automatic PIE building ..."
51 fi
52 - if use ssp ; then
53 + if use_if_iuse ssp ; then
54 einfo "Updating gcc to use automatic SSP building ..."
55 fi
56 - if use hardened ; then
57 + if use_if_iuse hardened ; then
58 # Will add some optimatizion as default.
59 gcc_hard_flags+=" -DEXTRA_OPTIONS"
60 # rebrand to make bug reports easier
61 BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
62 fi
63 else
64 - if use hardened ; then
65 + if use_if_iuse hardened ; then
66 # rebrand to make bug reports easier
67 BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
68 if hardened_gcc_works ; then
69 @@ -909,7 +909,7 @@ toolchain_src_configure() {
70
71 # Use the default ("release") checking because upstream usually neglects
72 # to test "disabled" so it has a history of breaking. #317217
73 - if tc_version_is_at_least 3.4 ; then
74 + if tc_version_is_at_least 3.4 && in_iuse debug ; then
75 # The "release" keyword is new to 4.0. #551636
76 local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
77 confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
78 @@ -922,7 +922,7 @@ toolchain_src_configure() {
79 )
80
81 # If we want hardened support with the newer piepatchset for >=gcc 4.4
82 - if tc_version_is_at_least 4.4 && want_minispecs ; then
83 + if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; then
84 confgcc+=( $(use_enable hardened esp) )
85 fi
86
87 @@ -934,7 +934,7 @@ toolchain_src_configure() {
88 fi
89
90 # Support to disable pch when building libstdcxx
91 - if tc_version_is_at_least 6.0 && ! use pch ; then
92 + if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
93 confgcc+=( --disable-libstdcxx-pch )
94 fi
95
96 @@ -1058,12 +1058,12 @@ toolchain_src_configure() {
97 gcc-multilib-configure
98
99 # ppc altivec support
100 - confgcc+=( $(use_enable altivec) )
101 + in_iuse altivec && confgcc+=( $(use_enable altivec) )
102
103 # gcc has fixed-point arithmetic support in 4.3 for mips targets that can
104 # significantly increase compile time by several hours. This will allow
105 # users to control this feature in the event they need the support.
106 - tc_version_is_at_least 4.3 && confgcc+=( $(use_enable fixed-point) )
107 + tc_version_is_at_least 4.3 && in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) )
108
109 case $(tc-is-softfloat) in
110 yes) confgcc+=( --with-float=soft ) ;;
111 @@ -1229,23 +1229,26 @@ toolchain_src_configure() {
112
113 # graphite was added in 4.4 but we only support it in 4.8+ due to external
114 # library issues. #448024
115 - if tc_version_is_at_least 5.0 ; then
116 + if tc_version_is_at_least 5.0 && in_iuse graphite ; then
117 confgcc+=( $(use_with graphite isl) )
118 use graphite && confgcc+=( --disable-isl-version-check )
119 - elif tc_version_is_at_least 4.8 ; then
120 + elif tc_version_is_at_least 4.8 && in_iuse graphite ; then
121 confgcc+=( $(use_with graphite cloog) )
122 use graphite && confgcc+=( --disable-isl-version-check )
123 elif tc_version_is_at_least 4.4 ; then
124 confgcc+=( --without-{cloog,ppl} )
125 fi
126
127 - if tc_version_is_at_least 4.8 ; then
128 + if tc_version_is_at_least 4.8 && in_iuse sanitize ; then
129 confgcc+=( $(use_enable sanitize libsanitizer) )
130 fi
131
132 - if tc_version_is_at_least 6.0 ; then
133 + if tc_version_is_at_least 6.0 && in_iuse pie ; then
134 + confgcc+=( $(use_enable pie default-pie) )
135 + fi
136 +
137 + if tc_version_is_at_least 6.0 && in_iuse ssp ; then
138 confgcc+=(
139 - $(use_enable pie default-pie)
140 # This defaults to -fstack-protector-strong.
141 $(use_enable ssp default-ssp)
142 )
143 @@ -1575,7 +1578,7 @@ gcc_do_make() {
144 # resulting binaries natively ^^;
145 GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
146 else
147 - if tc_version_is_at_least 3.3 && use pgo; then
148 + if tc_version_is_at_least 3.3 && use_if_iuse pgo; then
149 GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
150 else
151 GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
152 @@ -1619,7 +1622,7 @@ gcc_do_make() {
153 ${GCC_MAKE_TARGET} \
154 || die "emake failed with ${GCC_MAKE_TARGET}"
155
156 - if ! is_crosscompile && use cxx && use_if_iuse doc ; then
157 + if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then
158 if type -p doxygen > /dev/null ; then
159 if tc_version_is_at_least 4.3 ; then
160 cd "${CTARGET}"/libstdc++-v3/doc
161 @@ -1786,7 +1789,7 @@ toolchain_src_install() {
162
163 # Rather install the script, else portage with changing $FILESDIR
164 # between binary and source package borks things ....
165 - if ! is_crosscompile ; then
166 + if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
167 insinto "${DATAPATH#${EPREFIX}}"
168 newins "$(prefixify_ro "${FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
169 exeinto "${DATAPATH#${EPREFIX}}"
170 @@ -2080,7 +2083,7 @@ toolchain_pkg_postinst() {
171 eselect compiler-shadow update all
172 fi
173
174 - if ! is_crosscompile ; then
175 + if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
176 echo
177 ewarn "If you have issues with packages unable to locate libstdc++.la,"
178 ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions."
179 @@ -2245,13 +2248,13 @@ gcc-lang-supported() {
180
181 is_ada() {
182 gcc-lang-supported ada || return 1
183 - use ada
184 + use_if_iuse ada
185 }
186
187 is_cxx() {
188 gcc-lang-supported 'c++' || return 1
189 ! is_crosscompile && tc_version_is_at_least 4.8 && return 0
190 - use cxx
191 + use_if_iuse cxx
192 }
193
194 is_d() {
195 @@ -2261,27 +2264,27 @@ is_d() {
196
197 is_f77() {
198 gcc-lang-supported f77 || return 1
199 - use fortran
200 + use_if_iuse fortran
201 }
202
203 is_f95() {
204 gcc-lang-supported f95 || return 1
205 - use fortran
206 + use_if_iuse fortran
207 }
208
209 is_fortran() {
210 gcc-lang-supported fortran || return 1
211 - use fortran
212 + use_if_iuse fortran
213 }
214
215 is_gcj() {
216 gcc-lang-supported java || return 1
217 - use cxx && use_if_iuse gcj
218 + use_if_iuse cxx && use_if_iuse gcj
219 }
220
221 is_go() {
222 gcc-lang-supported go || return 1
223 - use cxx && use_if_iuse go
224 + use_if_iuse cxx && use_if_iuse go
225 }
226
227 is_jit() {
228 @@ -2291,7 +2294,7 @@ is_jit() {
229
230 is_multilib() {
231 tc_version_is_at_least 3 || return 1
232 - use multilib
233 + use_if_iuse multilib
234 }
235
236 is_objc() {
237 @@ -2301,7 +2304,7 @@ is_objc() {
238
239 is_objcxx() {
240 gcc-lang-supported 'obj-c++' || return 1
241 - use cxx && use_if_iuse objc++
242 + use_if_iuse cxx && use_if_iuse objc++
243 }
244
245 # Grab a variable from the build system (taken from linux-info.eclass)
246 @@ -2369,12 +2372,12 @@ want_minispecs() {
247 if tc_version_is_at_least 6.0 ; then
248 return 0
249 fi
250 - if tc_version_is_at_least 4.3.2 && use hardened ; then
251 + if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then
252 if ! want_pie ; then
253 ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
254 elif use vanilla ; then
255 ewarn "You will not get hardened features if you have the vanilla USE-flag."
256 - elif use nopie && use nossp ; then
257 + elif use_if_iuse nopie && use_if_iuse nossp ; then
258 ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
259 elif ! hardened_gcc_works ; then
260 ewarn "Your $(tc-arch) arch is not supported."
261 @@ -2388,11 +2391,11 @@ want_minispecs() {
262 }
263
264 want_pie() {
265 - ! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1
266 + ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1
267 [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
268 tc_version_is_at_least 4.3.2 && return 1
269 [[ -z ${PIE_VER} ]] && return 1
270 - use !nopie && return 0
271 + use_if_iuse nopie || return 0
272 return 1
273 }