Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: eclass/
Date: Thu, 30 May 2019 08:25:25
Message-Id: 1559204691.f5b4e670e0d7a5686f67b5bcfe4c323d6f4fe050.grobian@gentoo
1 commit: f5b4e670e0d7a5686f67b5bcfe4c323d6f4fe050
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 30 08:24:51 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Thu May 30 08:24:51 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f5b4e670
7
8 eclass: sync with gx86
9
10 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
11
12 eclass/flag-o-matic.eclass | 7 ++
13 eclass/java-utils-2.eclass | 17 ++--
14 eclass/python-utils-r1.eclass | 6 +-
15 eclass/toolchain-funcs.eclass | 11 +--
16 eclass/toolchain.eclass | 211 +++++++++++++++++++++++++++++-------------
17 5 files changed, 172 insertions(+), 80 deletions(-)
18
19 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
20 index cdd63219de..1a5d1e8099 100644
21 --- a/eclass/flag-o-matic.eclass
22 +++ b/eclass/flag-o-matic.eclass
23 @@ -69,6 +69,13 @@ setup-allowed-flags() {
24 # gcc 4.9
25 -mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha
26 )
27 +
28 + # Allow some safe individual flags. Should come along with the bug reference.
29 + ALLOWED_FLAGS+=(
30 + # Allow explicit stack realignment to run non-conformant
31 + # binaries: bug #677852
32 + -mstackrealign
33 + )
34 }
35
36 # inverted filters for hardened compiler. This is trying to unpick
37
38 diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
39 index da96e04c14..e8e8575eda 100644
40 --- a/eclass/java-utils-2.eclass
41 +++ b/eclass/java-utils-2.eclass
42 @@ -1,4 +1,4 @@
43 -# Copyright 2004-2018 Gentoo Foundation
44 +# Copyright 2004-2018 Gentoo Authors
45 # Distributed under the terms of the GNU General Public License v2
46
47 # @ECLASS: java-utils-2.eclass
48 @@ -15,7 +15,10 @@
49 # you should inherit java-pkg-2 for Java packages or java-pkg-opt-2 for packages
50 # that have optional Java support. In addition you can inherit java-ant-2 for
51 # Ant-based packages.
52 -inherit eutils versionator multilib
53 +
54 +# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses.
55 +# Keep versionator inheritance in case consumers are using it implicitly.
56 +[[ ${EAPI} == [0123456] ]] && inherit eapi7-ver eutils multilib versionator
57
58 IUSE="elibc_FreeBSD"
59
60 @@ -1518,8 +1521,8 @@ java-pkg_is-vm-version-eq() {
61
62 local vm_version="$(java-pkg_get-vm-version)"
63
64 - vm_version="$(get_version_component_range 1-2 "${vm_version}")"
65 - needed_version="$(get_version_component_range 1-2 "${needed_version}")"
66 + vm_version="$(ver_cut 1-2 "${vm_version}")"
67 + needed_version="$(ver_cut 1-2 "${needed_version}")"
68
69 if [[ -z "${vm_version}" ]]; then
70 debug-print "Could not get JDK version from DEPEND"
71 @@ -1570,7 +1573,7 @@ java-pkg_is-vm-version-ge() {
72 debug-print "Could not get JDK version from DEPEND"
73 return 1
74 else
75 - if version_is_at_least "${needed_version}" "${vm_version}"; then
76 + if ver_test "${vm_version}" -ge "${needed_version}"; then
77 debug-print "Detected a JDK(${vm_version}) >= ${needed_version}"
78 return 0
79 else
80 @@ -2033,7 +2036,9 @@ eant() {
81
82 if [[ ${cp#:} ]]; then
83 # It seems ant does not like single quotes around ${cp}
84 - antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\""
85 + # And ant 1.9.13+ also does not like double quotes around ${cp}
86 + # https://bz.apache.org/bugzilla/show_bug.cgi?id=58898
87 + antflags="${antflags} -Dgentoo.classpath=${cp#:}"
88 fi
89
90 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
91
92 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
93 index 6e9cab5360..859f4daf4a 100644
94 --- a/eclass/python-utils-r1.eclass
95 +++ b/eclass/python-utils-r1.eclass
96 @@ -44,7 +44,7 @@ _PYTHON_ALL_IMPLS=(
97 jython2_7
98 pypy pypy3
99 python2_7
100 - python3_4 python3_5 python3_6 python3_7
101 + python3_5 python3_6 python3_7
102 )
103 readonly _PYTHON_ALL_IMPLS
104
105 @@ -80,10 +80,10 @@ _python_impl_supported() {
106 # keep in sync with _PYTHON_ALL_IMPLS!
107 # (not using that list because inline patterns shall be faster)
108 case "${impl}" in
109 - python2_7|python3_[4567]|jython2_7)
110 + python2_7|python3_[567]|jython2_7)
111 return 0
112 ;;
113 - pypy1_[89]|pypy2_0|python2_[56]|python3_[123])
114 + pypy1_[89]|pypy2_0|python2_[56]|python3_[1234])
115 return 1
116 ;;
117 pypy|pypy3)
118
119 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
120 index 392cf02e27..99aac55dea 100644
121 --- a/eclass/toolchain-funcs.eclass
122 +++ b/eclass/toolchain-funcs.eclass
123 @@ -1,4 +1,4 @@
124 -# Copyright 1999-2018 Gentoo Foundation
125 +# Copyright 2002-2019 Gentoo Authors
126 # Distributed under the terms of the GNU General Public License v2
127
128 # @ECLASS: toolchain-funcs.eclass
129 @@ -218,13 +218,11 @@ tc-cpp-is-true() {
130 }
131
132 # @FUNCTION: tc-detect-is-softfloat
133 -# @RETURN:
134 -# Shell true if (positive or negative) detection was possible, shell
135 -# false otherwise. Also outputs a string when detection succeeds, see
136 -# tc-is-softfloat for the possible values.
137 +# @RETURN: Shell true if detection was possible, shell false otherwise
138 # @DESCRIPTION:
139 # Detect whether the CTARGET (or CHOST) toolchain is a softfloat based
140 -# one by examining the toolchain's output, if possible.
141 +# one by examining the toolchain's output, if possible. Outputs a value
142 +# alike tc-is-softfloat if detection was possible.
143 tc-detect-is-softfloat() {
144 # If fetching CPP falls back to the default (gcc -E) then fail
145 # detection as this may not be the correct toolchain.
146 @@ -727,6 +725,7 @@ tc-endian() {
147 mips*) echo big;;
148 powerpc*le) echo little;;
149 powerpc*) echo big;;
150 + riscv*) echo little;;
151 s390*) echo big;;
152 sh*b*) echo big;;
153 sh*) echo little;;
154
155 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
156 index 560fe96139..99b8c08d9c 100644
157 --- a/eclass/toolchain.eclass
158 +++ b/eclass/toolchain.eclass
159 @@ -2,12 +2,13 @@
160 # Distributed under the terms of the GNU General Public License v2
161
162 # Maintainer: Toolchain Ninjas <toolchain@g.o>
163 +# @SUPPORTED_EAPIS: 5 6
164
165 DESCRIPTION="The GNU Compiler Collection"
166 HOMEPAGE="https://gcc.gnu.org/"
167 RESTRICT="strip" # cross-compilers need controlled stripping
168
169 -inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix
170 +inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
171
172 if [[ ${PV} == *_pre9999* ]] ; then
173 EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
174 @@ -25,8 +26,8 @@ FEATURES=${FEATURES/multilib-strict/}
175
176 case ${EAPI:-0} in
177 0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
178 - 5*) ;;
179 - *) die "I don't speak EAPI ${EAPI}." ;;
180 + 5*|6) inherit eapi7-ver ;;
181 + *) die "I don't speak EAPI ${EAPI}." ;;
182 esac
183 EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
184 src_compile src_test src_install pkg_postinst pkg_postrm
185 @@ -52,7 +53,7 @@ is_crosscompile() {
186
187 # General purpose version check. Without a second arg matches up to minor version (x.x.x)
188 tc_version_is_at_least() {
189 - version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
190 + ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1"
191 }
192
193 # General purpose version range check
194 @@ -64,17 +65,17 @@ tc_version_is_between() {
195 GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
196 GCC_PVR=${GCC_PV}
197 [[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
198 -GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV})
199 -GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV})
200 -GCCMAJOR=$(get_version_component_range 1 ${GCC_PV})
201 -GCCMINOR=$(get_version_component_range 2 ${GCC_PV})
202 -GCCMICRO=$(get_version_component_range 3 ${GCC_PV})
203 +GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
204 +GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
205 +GCCMAJOR=$(ver_cut 1 ${GCC_PV})
206 +GCCMINOR=$(ver_cut 2 ${GCC_PV})
207 +GCCMICRO=$(ver_cut 3 ${GCC_PV})
208 [[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
209 - BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV})
210 + BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV})
211
212 # According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
213 # ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
214 -GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})}
215 +GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})}
216
217 # Pre-release support
218 if [[ ${GCC_PV} == *_pre* ]] ; then
219 @@ -130,39 +131,55 @@ else
220 LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
221 fi
222
223 -IUSE="regression-test vanilla"
224 -IUSE_DEF=( nls nptl )
225 +if tc_version_is_at_least 8.3; then
226 + GCC_EBUILD_TEST_FLAG='test'
227 +else
228 + # Don't force USE regression-test->test change on every
229 + # gcc ebuild just yet. Let's do the change when >=gcc-8.3
230 + # is commonly used as a main compiler.
231 + GCC_EBUILD_TEST_FLAG='regression-test'
232 +fi
233 +IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls +nptl"
234 +
235 +TC_FEATURES=()
236 +
237 +tc_has_feature() {
238 + has "$1" "${TC_FEATURES[@]}"
239 +}
240
241 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
242 - IUSE+=" altivec debug"
243 - IUSE_DEF+=( cxx fortran )
244 + IUSE+=" altivec debug +cxx +fortran" TC_FEATURES+=(fortran)
245 [[ -n ${PIE_VER} ]] && IUSE+=" nopie"
246 [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
247 [[ -n ${D_VER} ]] && IUSE+=" d"
248 [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
249 tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
250 - tc_version_is_between 3 7 && IUSE+=" awt gcj"
251 + tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
252 tc_version_is_at_least 3.3 && IUSE+=" pgo"
253 - tc_version_is_at_least 4.0 && IUSE+=" objc-gc"
254 + tc_version_is_at_least 4.0 &&
255 + IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
256 tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
257 tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
258 - tc_version_is_at_least 4.2 && IUSE_DEF+=( openmp )
259 + tc_version_is_at_least 4.2 && IUSE+=" +openmp"
260 tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
261 tc_version_is_at_least 4.7 && IUSE+=" go"
262 # Note: while <=gcc-4.7 also supported graphite, it required forked ppl
263 # versions which we dropped. Since graphite was also experimental in
264 # the older versions, we don't want to bother supporting it. #448024
265 - tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
266 + tc_version_is_at_least 4.8 &&
267 + IUSE+=" graphite +sanitize" TC_FEATURES+=(graphite)
268 tc_version_is_between 4.9 8 && IUSE+=" cilk"
269 tc_version_is_at_least 4.9 && IUSE+=" +vtv"
270 - tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
271 + tc_version_is_at_least 5.0 && IUSE+=" jit"
272 + tc_version_is_between 5.0 9 && IUSE+=" mpx"
273 tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
274 # systemtap is a gentoo-specific switch: bug #654748
275 - tc_version_is_at_least 8.0 && IUSE+=" systemtap"
276 + tc_version_is_at_least 8.0 &&
277 + IUSE+=" systemtap" TC_FEATURES+=(systemtap)
278 + tc_version_is_at_least 9.0 && IUSE+=" d"
279 + tc_version_is_at_least 9.1 && IUSE+=" lto"
280 fi
281
282 -IUSE+=" ${IUSE_DEF[*]/#/+}"
283 -
284 SLOT="${GCC_CONFIG_VER}"
285
286 #---->> DEPEND <<----
287 @@ -176,20 +193,20 @@ if tc_version_is_at_least 4 ; then
288 GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
289 if tc_version_is_at_least 4.3 ; then
290 RDEPEND+=" ${GMP_MPFR_DEPS}"
291 - elif in_iuse fortran ; then
292 + elif tc_has_feature fortran ; then
293 RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
294 fi
295 fi
296
297 tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
298
299 -if in_iuse objc-gc ; then
300 +if tc_has_feature objc-gc ; then
301 if tc_version_is_at_least 7 ; then
302 RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
303 fi
304 fi
305
306 -if in_iuse graphite ; then
307 +if tc_has_feature graphite ; then
308 if tc_version_is_at_least 5.0 ; then
309 RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )"
310 elif tc_version_is_at_least 4.8 ; then
311 @@ -205,12 +222,12 @@ DEPEND="${RDEPEND}
312 >=sys-devel/bison-1.875
313 >=sys-devel/flex-2.5.4
314 nls? ( sys-devel/gettext )
315 - regression-test? (
316 + ${GCC_EBUILD_TEST_FLAG}? (
317 >=dev-util/dejagnu-1.4.4
318 >=sys-devel/autogen-5.5.4
319 )"
320
321 -if in_iuse gcj ; then
322 +if tc_has_feature gcj ; then
323 GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
324 GCJ_GTK_DEPS="
325 x11-base/xorg-proto
326 @@ -225,7 +242,7 @@ if in_iuse gcj ; then
327 DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
328 fi
329
330 -if in_iuse systemtap ; then
331 +if tc_has_feature systemtap ; then
332 # gcc needs sys/sdt.h headers on target
333 DEPEND+=" systemtap? ( dev-util/systemtap )"
334 fi
335 @@ -378,7 +395,7 @@ get_gcc_src_uri() {
336 [[ -n ${D_VER} ]] && \
337 GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
338
339 - if in_iuse gcj ; then
340 + if tc_has_feature gcj ; then
341 if tc_version_is_at_least 4.5 ; then
342 GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
343 elif tc_version_is_at_least 4.3 ; then
344 @@ -533,7 +550,12 @@ toolchain_src_prepare() {
345 do_gcc_HTB_patches
346 do_gcc_PIE_patches
347 do_gcc_CYGWINPORTS_patches
348 - epatch_user
349 +
350 + case ${EAPI:-0} in
351 + 5*) epatch_user;;
352 + 6) eapply_user ;;
353 + *) die "Update toolchain_src_prepare() for ${EAPI}." ;;
354 + esac
355
356 if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
357 make_gcc_hard
358 @@ -998,6 +1020,11 @@ toolchain_src_configure() {
359 confgcc+=( --enable-libstdcxx-time )
360 fi
361
362 + # Build compiler using LTO
363 + if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
364 + confgcc+=( --with-build-config=bootstrap-lto )
365 + fi
366 +
367 # Support to disable pch when building libstdcxx
368 if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
369 confgcc+=( --disable-libstdcxx-pch )
370 @@ -1042,7 +1069,7 @@ toolchain_src_configure() {
371 # Undoing it here.
372 confgcc+=( --disable-libstdcxx-time )
373 ;;
374 - *-gentoo-freebsd*) needed_libc=freebsd-lib;;
375 + *-gentoo-freebsd*) needed_libc=freebsd-lib;;
376 *-gnu*) needed_libc=glibc;;
377 *-klibc) needed_libc=klibc;;
378 *-musl*) needed_libc=musl;;
379 @@ -1053,7 +1080,7 @@ toolchain_src_configure() {
380 then #291870
381 confgcc+=( --disable-shared )
382 fi
383 - needed_libc=uclibc
384 + needed_libc=uclibc-ng
385 ;;
386 *-cygwin) needed_libc=cygwin;;
387 x86_64-*-mingw*|\
388 @@ -1123,6 +1150,9 @@ toolchain_src_configure() {
389 *-elf|*-eabi)
390 confgcc+=( --with-newlib )
391 ;;
392 + *-musl*)
393 + confgcc+=( --enable-__cxa_atexit )
394 + ;;
395 *-gnu*)
396 confgcc+=(
397 --enable-__cxa_atexit
398 @@ -1224,6 +1254,10 @@ toolchain_src_configure() {
399 is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
400 [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --enable-e500-double )
401 ;;
402 + riscv)
403 + # Add --with-abi flags to set default ABI
404 + confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
405 + ;;
406 esac
407
408 # if the target can do biarch (-m32/-m64), enable it. overhead should
409 @@ -1246,10 +1280,12 @@ toolchain_src_configure() {
410
411 ### library options
412
413 - if ! is_gcj ; then
414 - confgcc+=( --disable-libgcj )
415 - elif use awt ; then
416 - confgcc+=( --enable-java-awt=gtk )
417 + if tc_version_is_between 3.0 7.0 ; then
418 + if ! is_gcj ; then
419 + confgcc+=( --disable-libgcj )
420 + elif use awt ; then
421 + confgcc+=( --enable-java-awt=gtk )
422 + fi
423 fi
424
425 if tc_version_is_at_least 4.2 ; then
426 @@ -1317,7 +1353,8 @@ toolchain_src_configure() {
427 if in_iuse vtv ; then
428 confgcc+=(
429 $(use_enable vtv vtable-verify)
430 - $(use_enable vtv libvtv)
431 + # See Note [implicitly enabled flags]
432 + $(usex vtv '' --disable-libvtv)
433 )
434 fi
435
436 @@ -1346,7 +1383,8 @@ toolchain_src_configure() {
437 fi
438
439 if tc_version_is_at_least 4.8 && in_iuse sanitize ; then
440 - confgcc+=( $(use_enable sanitize libsanitizer) )
441 + # See Note [implicitly enabled flags]
442 + confgcc+=( $(usex sanitize '' --disable-libsanitizer) )
443 fi
444
445 if tc_version_is_at_least 6.0 && in_iuse pie ; then
446 @@ -1393,7 +1431,7 @@ toolchain_src_configure() {
447 addwrite /dev/zero
448 echo "${S}"/configure "${confgcc[@]}"
449 # Older gcc versions did not detect bash and re-exec itself, so force the
450 - # use of bash. Newer ones will auto-detect, but this is not harmeful.
451 + # use of bash. Newer ones will auto-detect, but this is not harmful.
452 CONFIG_SHELL="${EPREFIX}/bin/bash" \
453 bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
454
455 @@ -1550,6 +1588,12 @@ gcc_do_filter_flags() {
456 filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
457 filter-flags -f{no-,}stack-protector{,-all}
458 filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
459 + # and warning options
460 + filter-flags -Wextra -Wstack-protector
461 + fi
462 + if ! tc_version_is_at_least 4.1 ; then
463 + filter-flags -fdiagnostics-show-option
464 + filter-flags -Wstack-protector
465 fi
466
467 if tc_version_is_at_least 3.4 ; then
468 @@ -1646,6 +1690,7 @@ gcc-abi-map() {
469 local map=()
470 case ${CTARGET} in
471 mips*) map=("o32 32" "n32 n32" "n64 64") ;;
472 + riscv*) map=("lp64d lp64d" "lp64 lp64") ;;
473 x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
474 esac
475
476 @@ -1665,6 +1710,11 @@ toolchain_src_compile() {
477 [[ ! -x /usr/bin/perl ]] \
478 && find "${WORKDIR}"/build -name '*.[17]' -exec touch {} +
479
480 + # Older gcc versions did not detect bash and re-exec itself, so force the
481 + # use of bash. Newer ones will auto-detect, but this is not harmful.
482 + # This needs to be set for compile as well, as it's used in libtool
483 + # generation, which will break install otherwise (at least in 3.3.6): #664486
484 + CONFIG_SHELL="${EPREFIX}/bin/bash" \
485 gcc_do_make ${GCC_MAKE_TARGET}
486 }
487
488 @@ -1758,9 +1808,10 @@ gcc_do_make() {
489 #---->> src_test <<----
490
491 toolchain_src_test() {
492 - if use regression-test ; then
493 + if use ${GCC_EBUILD_TEST_FLAG} ; then
494 cd "${WORKDIR}"/build
495 - emake -k check
496 + # enable verbose test run and result logging
497 + emake -k check RUNTESTFLAGS='-a -v'
498 fi
499 }
500
501 @@ -1853,22 +1904,28 @@ toolchain_src_install() {
502 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
503 fi
504 done
505 - # Rename the main go binaries as we don't want to clobber dev-lang/go
506 - # when gcc-config runs. #567806
507 - if tc_version_is_at_least 5 && is_go ; then
508 - for x in go gofmt; do
509 - mv ${x} ${x}-${GCCMAJOR} || die
510 - done
511 +
512 + # When gcc builds a crosscompiler it does not install unprefixed tools.
513 + # When cross-building gcc does install native tools.
514 + if ! is_crosscompile; then
515 + # Rename the main go binaries as we don't want to clobber dev-lang/go
516 + # when gcc-config runs. #567806
517 + if tc_version_is_at_least 5 && is_go ; then
518 + for x in go gofmt; do
519 + mv ${x} ${x}-${GCCMAJOR} || die
520 + done
521 + fi
522 fi
523
524 - # Now do the fun stripping stuff
525 - env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
526 - is_crosscompile && \
527 - env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}"
528 - env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
529 - # gcc used to install helper binaries in lib/ but then moved to libexec/
530 - [[ -d ${D}${PREFIX}/libexec/gcc ]] && \
531 - env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
532 + # TODO: implement stripping (we use RESTRICT=strip)
533 + # As gcc installs object files both build against ${CHOST} and ${CTARGET}
534 + # we will ned to run stripping using different tools:
535 + # Using ${CHOST} tools:
536 + # - "${D}${BINPATH}"
537 + # - (for is_crosscompile) "${D}${HOSTLIBPATH}"
538 + # - "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
539 + # Using ${CTARGET} tools:
540 + # - "${D}${LIBPATH}"
541
542 cd "${S}"
543 if is_crosscompile; then
544 @@ -1881,18 +1938,20 @@ toolchain_src_install() {
545 cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
546 fi
547 fi
548 - has noinfo ${FEATURES} \
549 - && rm -r "${D}${DATAPATH}"/info \
550 - || prepinfo "${DATAPATH#${EPREFIX}}"
551 - has noman ${FEATURES} \
552 - && rm -r "${D}${DATAPATH}"/man \
553 - || prepman "${DATAPATH#${EPREFIX}}"
554 fi
555 +
556 + # portage regenerates 'dir' files on it's own: bug #672408
557 + # Drop 'dir' files to avoid collisions.
558 + if [[ -f "${D}${DATAPATH}"/info/dir ]]; then
559 + einfo "Deleting '${D}${DATAPATH}/info/dir'"
560 + rm "${D}${DATAPATH}"/info/dir || die
561 + fi
562 +
563 # prune empty dirs left behind
564 find "${ED}" -depth -type d -delete 2>/dev/null
565
566 # install testsuite results
567 - if use regression-test; then
568 + if use ${GCC_EBUILD_TEST_FLAG}; then
569 docinto testsuite
570 find "${WORKDIR}"/build -type f -name "*.sum" -exec dodoc {} +
571 find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -exec dodoc {} +
572 @@ -2220,7 +2279,7 @@ toolchain_pkg_postinst() {
573 cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null
574 fi
575
576 - if use regression-test ; then
577 + if use ${GCC_EBUILD_TEST_FLAG} ; then
578 elog "Testsuite results have been installed into /usr/share/doc/${PF}/testsuite"
579 echo
580 fi
581 @@ -2319,7 +2378,7 @@ should_we_gcc_config() {
582 # for being in the same SLOT, make sure we run gcc-config.
583 local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
584
585 - local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
586 + local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
587
588 if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
589 return 0
590 @@ -2402,6 +2461,10 @@ is_go() {
591
592 is_jit() {
593 gcc-lang-supported jit || return 1
594 + # cross-compiler does not really support jit as it has
595 + # to generate code for a target. On target like avr
596 + # libgcclit.so can't link at all: bug #594572
597 + is_crosscompile && return 1
598 use_if_iuse jit
599 }
600
601 @@ -2527,3 +2590,21 @@ toolchain_death_notice() {
602 popd >/dev/null
603 fi
604 }
605 +
606 +# Note [implicitly enabled flags]
607 +# -------------------------------
608 +# Usually configure-based packages handle explicit feature requests
609 +# like
610 +# ./configure --enable-foo
611 +# as explicit request to check for support of 'foo' and bail out at
612 +# configure time.
613 +#
614 +# GCC does not follow this pattern and instead overrides autodetection
615 +# of the feature and enables it unconditionally.
616 +# See bugs:
617 +# https://gcc.gnu.org/PR85663 (libsanitizer on mips)
618 +# https://bugs.gentoo.org/661252 (libvtv on powerpc64)
619 +#
620 +# Thus safer way to enable/disable the feature is to rely on implicit
621 +# enabled-by-default state:
622 +# econf $(usex foo '' --disable-foo)