1 |
commit: 10f753d0678eced907b182c0b15b1dde6901f676 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Nov 29 14:23:40 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Nov 29 14:23:40 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=10f753d0 |
7 |
|
8 |
eclass/toolchain: sync with gx86 |
9 |
|
10 |
this should in particular fix the dangling symlinks for the versioned |
11 |
tooling variants and the numerous warnings about use_if_iuse |
12 |
|
13 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
14 |
|
15 |
eclass/toolchain.eclass | 306 +++++++++++++++--------------------------------- |
16 |
1 file changed, 97 insertions(+), 209 deletions(-) |
17 |
|
18 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
19 |
index 293158b91e..e5d4dd6ca9 100644 |
20 |
--- a/eclass/toolchain.eclass |
21 |
+++ b/eclass/toolchain.eclass |
22 |
@@ -7,7 +7,7 @@ |
23 |
DESCRIPTION="The GNU Compiler Collection" |
24 |
HOMEPAGE="https://gcc.gnu.org/" |
25 |
|
26 |
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix |
27 |
+inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix |
28 |
|
29 |
tc_is_live() { |
30 |
[[ ${PV} == *9999* ]] |
31 |
@@ -102,11 +102,7 @@ fi |
32 |
|
33 |
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr} |
34 |
|
35 |
-if tc_version_is_at_least 3.4.0 ; then |
36 |
- LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}} |
37 |
-else |
38 |
- LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}} |
39 |
-fi |
40 |
+LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}} |
41 |
INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include} |
42 |
|
43 |
if is_crosscompile ; then |
44 |
@@ -124,20 +120,7 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE |
45 |
|
46 |
#---->> LICENSE+SLOT+IUSE logic <<---- |
47 |
|
48 |
-if tc_version_is_at_least 4.6 ; then |
49 |
- LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+" |
50 |
-elif tc_version_is_at_least 4.4 ; then |
51 |
- LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2+" |
52 |
-elif tc_version_is_at_least 4.3 ; then |
53 |
- LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+" |
54 |
-elif tc_version_is_at_least 4.2 ; then |
55 |
- LICENSE="GPL-3+ LGPL-2.1+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+" |
56 |
-elif tc_version_is_at_least 3.3 ; then |
57 |
- LICENSE="GPL-2+ LGPL-2.1+ FDL-1.2+" |
58 |
-else |
59 |
- LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+" |
60 |
-fi |
61 |
- |
62 |
+LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+" |
63 |
IUSE="test vanilla +nls" |
64 |
RESTRICT="!test? ( test )" |
65 |
|
66 |
@@ -166,8 +149,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
67 |
fi |
68 |
IUSE+=" debug +cxx +nptl" TC_FEATURES+=(nptl) |
69 |
[[ -n ${PIE_VER} ]] && IUSE+=" nopie" |
70 |
- [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking" |
71 |
- [[ -n ${D_VER} ]] && IUSE+=" d" |
72 |
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp" |
73 |
# fortran support appeared in 4.1, but 4.1 needs outdated mpfr |
74 |
tc_version_is_at_least 4.2 && IUSE+=" +fortran" TC_FEATURES+=(fortran) |
75 |
@@ -176,7 +157,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
76 |
tc_version_is_at_least 3.3 && IUSE+=" pgo" |
77 |
tc_version_is_at_least 4.0 && |
78 |
IUSE+=" objc-gc" TC_FEATURES+=(objc-gc) |
79 |
- tc_version_is_between 4.0 4.9 && IUSE+=" mudflap" |
80 |
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++" |
81 |
tc_version_is_at_least 4.2 && IUSE+=" +openmp" |
82 |
tc_version_is_at_least 4.3 && IUSE+=" fixed-point" |
83 |
@@ -203,6 +183,8 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
84 |
tc_version_is_at_least 9.0 && IUSE+=" d" |
85 |
tc_version_is_at_least 9.1 && IUSE+=" lto" |
86 |
tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=(zstd) |
87 |
+ tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=(valgrind) |
88 |
+ tc_version_is_at_least 11 && IUSE+=" custom-cflags" |
89 |
fi |
90 |
|
91 |
if tc_version_is_at_least 10; then |
92 |
@@ -275,10 +257,15 @@ if tc_has_feature zstd ; then |
93 |
DEPEND+=" zstd? ( app-arch/zstd )" |
94 |
fi |
95 |
|
96 |
+if tc_has_feature valgrind; then |
97 |
+ BDEPEND+=" valgrind? ( dev-util/valgrind )" |
98 |
+fi |
99 |
+ |
100 |
case ${EAPI:-0} in |
101 |
5*|6) DEPEND+=" ${BDEPEND}" ;; |
102 |
esac |
103 |
|
104 |
+# Prefix: our version is 1.9, so can't go with gx86's 2.3 |
105 |
PDEPEND=">=sys-devel/gcc-config-1.7" |
106 |
|
107 |
#---->> S + SRC_URI essentials <<---- |
108 |
@@ -351,13 +338,6 @@ gentoo_urls() { |
109 |
# The resulting filename of this tarball will be: |
110 |
# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.bz2 |
111 |
# |
112 |
-# HTB_VER |
113 |
-# HTB_GCC_VER |
114 |
-# These variables control whether or not an ebuild supports Herman |
115 |
-# ten Brugge's bounds-checking patches. If you want to use a patch |
116 |
-# for an older gcc version with a new gcc, make sure you set |
117 |
-# HTB_GCC_VER to that version of gcc. |
118 |
-# |
119 |
# CYGWINPORTS_GITREV |
120 |
# If set, this variable signals that we should apply additional patches |
121 |
# maintained by upstream Cygwin developers at github/cygwinports/gcc, |
122 |
@@ -402,19 +382,6 @@ get_gcc_src_uri() { |
123 |
[[ -n ${SPECS_VER} ]] && \ |
124 |
GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2)" |
125 |
|
126 |
- # gcc bounds checking patch |
127 |
- if [[ -n ${HTB_VER} ]] ; then |
128 |
- local HTBFILE="bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2" |
129 |
- GCC_SRC_URI+=" |
130 |
- boundschecking? ( |
131 |
- mirror://sourceforge/boundschecking/${HTBFILE} |
132 |
- $(gentoo_urls ${HTBFILE}) |
133 |
- )" |
134 |
- fi |
135 |
- |
136 |
- [[ -n ${D_VER} ]] && \ |
137 |
- GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )" |
138 |
- |
139 |
if tc_has_feature gcj ; then |
140 |
if tc_version_is_at_least 4.5 ; then |
141 |
GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" |
142 |
@@ -436,10 +403,13 @@ SRC_URI=$(get_gcc_src_uri) |
143 |
#---->> pkg_pretend <<---- |
144 |
|
145 |
toolchain_pkg_pretend() { |
146 |
- if ! use_if_iuse cxx ; then |
147 |
- use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' |
148 |
- use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' |
149 |
- use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' |
150 |
+ if ! _tc_use_if_iuse cxx ; then |
151 |
+ _tc_use_if_iuse go && \ |
152 |
+ ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' |
153 |
+ _tc_use_if_iuse objc++ && \ |
154 |
+ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' |
155 |
+ _tc_use_if_iuse gcj && \ |
156 |
+ ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' |
157 |
fi |
158 |
|
159 |
want_minispecs |
160 |
@@ -494,20 +464,7 @@ toolchain_src_prepare() { |
161 |
export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}" |
162 |
cd "${S}" |
163 |
|
164 |
- if [[ -n ${D_VER} ]] && use d ; then |
165 |
- mv "${WORKDIR}"/d gcc/d || die |
166 |
- ebegin "Adding support for the D language" |
167 |
- ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log |
168 |
- if ! eend $? ; then |
169 |
- eerror "The D GCC package failed to apply" |
170 |
- eerror "Please include this log file when posting a bug report:" |
171 |
- eerror " ${T}/dgcc.log" |
172 |
- die "failed to include the D language" |
173 |
- fi |
174 |
- fi |
175 |
- |
176 |
do_gcc_gentoo_patches |
177 |
- do_gcc_HTB_patches |
178 |
do_gcc_PIE_patches |
179 |
do_gcc_CYGWINPORTS_patches |
180 |
|
181 |
@@ -521,18 +478,11 @@ toolchain_src_prepare() { |
182 |
*) die "Update toolchain_src_prepare() for ${EAPI}." ;; |
183 |
esac |
184 |
|
185 |
- if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then |
186 |
+ if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \ |
187 |
+ && ! use vanilla ; then |
188 |
make_gcc_hard |
189 |
fi |
190 |
|
191 |
- # install the libstdc++ python into the right location |
192 |
- # http://gcc.gnu.org/PR51368 |
193 |
- if tc_version_is_between 4.5 4.7 ; then |
194 |
- sed -i \ |
195 |
- '/^pythondir =/s:=.*:= $(datadir)/python:' \ |
196 |
- "${S}"/libstdc++-v3/python/Makefile.in || die |
197 |
- fi |
198 |
- |
199 |
# we use our libtool on Darwin |
200 |
sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \ |
201 |
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed" |
202 |
@@ -547,28 +497,17 @@ toolchain_src_prepare() { |
203 |
find "${S}" -name Makefile.in \ |
204 |
-exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} + |
205 |
|
206 |
- # No idea when this first started being fixed, but let's go with 4.3.x for now |
207 |
- if ! tc_version_is_at_least 4.3 ; then |
208 |
- fix_files="" |
209 |
- for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do |
210 |
- [[ -e ${x} ]] && fix_files="${fix_files} ${x}" |
211 |
- done |
212 |
- ht_fix_file ${fix_files} */configure *.sh */Makefile.in |
213 |
- fi |
214 |
- |
215 |
setup_multilib_osdirnames |
216 |
gcc_version_patch |
217 |
|
218 |
- if tc_version_is_at_least 4.1 ; then |
219 |
- local actual_version=$(< "${S}"/gcc/BASE-VER) |
220 |
- if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then |
221 |
- eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'" |
222 |
- die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'" |
223 |
- fi |
224 |
+ local actual_version=$(< "${S}"/gcc/BASE-VER) |
225 |
+ if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then |
226 |
+ eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'" |
227 |
+ die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'" |
228 |
fi |
229 |
|
230 |
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it |
231 |
- if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then |
232 |
+ if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then |
233 |
if tc_version_is_at_least 4.5 ; then |
234 |
einfo "Copying ecj-4.5.jar" |
235 |
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die |
236 |
@@ -578,19 +517,6 @@ toolchain_src_prepare() { |
237 |
fi |
238 |
fi |
239 |
|
240 |
- # disable --as-needed from being compiled into gcc specs |
241 |
- # natively when using a gcc version < 3.4.4 |
242 |
- # http://gcc.gnu.org/PR14992 |
243 |
- if ! tc_version_is_at_least 3.4.4 ; then |
244 |
- sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in |
245 |
- fi |
246 |
- |
247 |
- # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names |
248 |
- # in line with gcc-4. |
249 |
- if tc_version_is_between 3.3 4.0 ; then |
250 |
- do_gcc_rename_java_bins |
251 |
- fi |
252 |
- |
253 |
# Prevent libffi from being installed |
254 |
if tc_version_is_between 3.0 4.8 ; then |
255 |
sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in || die |
256 |
@@ -640,14 +566,6 @@ do_gcc_gentoo_patches() { |
257 |
fi |
258 |
} |
259 |
|
260 |
-do_gcc_HTB_patches() { |
261 |
- use_if_iuse boundschecking || return 0 |
262 |
- |
263 |
- # modify the bounds checking patch with a regression patch |
264 |
- tc_apply_patches "Bounds checking patch" "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch" |
265 |
- BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}" |
266 |
-} |
267 |
- |
268 |
do_gcc_PIE_patches() { |
269 |
want_pie || return 0 |
270 |
use vanilla && return 0 |
271 |
@@ -686,13 +604,13 @@ make_gcc_hard() { |
272 |
|
273 |
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default |
274 |
if tc_version_is_at_least 6.0 ; then |
275 |
- if use_if_iuse pie ; then |
276 |
+ if _tc_use_if_iuse pie ; then |
277 |
einfo "Updating gcc to use automatic PIE building ..." |
278 |
fi |
279 |
- if use_if_iuse ssp ; then |
280 |
+ if _tc_use_if_iuse ssp ; then |
281 |
einfo "Updating gcc to use automatic SSP building ..." |
282 |
fi |
283 |
- if use_if_iuse hardened ; then |
284 |
+ if _tc_use_if_iuse hardened ; then |
285 |
# Will add some hardened options as default, like: |
286 |
# -fstack-clash-protection |
287 |
# -z now |
288 |
@@ -702,7 +620,7 @@ make_gcc_hard() { |
289 |
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
290 |
fi |
291 |
else |
292 |
- if use_if_iuse hardened ; then |
293 |
+ if _tc_use_if_iuse hardened ; then |
294 |
# rebrand to make bug reports easier |
295 |
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
296 |
if hardened_gcc_works ; then |
297 |
@@ -813,41 +731,6 @@ gcc_version_patch() { |
298 |
sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die |
299 |
} |
300 |
|
301 |
-do_gcc_rename_java_bins() { |
302 |
- # bug #139918 - conflict between gcc and java-config-2 for ownership of |
303 |
- # /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch |
304 |
- # because patches would be large (thanks to the rename of man files), |
305 |
- # and it's clear from the sed invocations that all that changes is the |
306 |
- # rmi{c,registry} names to grmi{c,registry} names. |
307 |
- # Kevin F. Quinn 2006-07-12 |
308 |
- einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry." |
309 |
- # 1) Move the man files if present (missing prior to gcc-3.4) |
310 |
- for manfile in rmic rmiregistry ; do |
311 |
- [[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue |
312 |
- mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1 |
313 |
- done |
314 |
- # 2) Fixup references in the docs if present (mission prior to gcc-3.4) |
315 |
- for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi ; do |
316 |
- [[ -f ${S}/${jfile} ]] || continue |
317 |
- sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || |
318 |
- die "Failed to fixup file ${jfile} for rename to grmiregistry" |
319 |
- sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} || |
320 |
- die "Failed to fixup file ${jfile} for rename to grmic" |
321 |
- done |
322 |
- # 3) Fixup Makefiles to build the changed executable names |
323 |
- # These are present in all 3.x versions, and are the important bit |
324 |
- # to get gcc to build with the new names. |
325 |
- for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in ; do |
326 |
- sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || |
327 |
- die "Failed to fixup file ${jfile} for rename to grmiregistry" |
328 |
- # Careful with rmic on these files; it's also the name of a directory |
329 |
- # which should be left unchanged. Replace occurrences of 'rmic$', |
330 |
- # 'rmic_' and 'rmic '. |
331 |
- sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} || |
332 |
- die "Failed to fixup file ${jfile} for rename to grmic" |
333 |
- done |
334 |
-} |
335 |
- |
336 |
#---->> src_configure <<---- |
337 |
|
338 |
toolchain_src_configure() { |
339 |
@@ -973,12 +856,12 @@ toolchain_src_configure() { |
340 |
fi |
341 |
|
342 |
# Build compiler itself using LTO |
343 |
- if tc_version_is_at_least 9.1 && use_if_iuse lto ; then |
344 |
+ if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then |
345 |
confgcc+=( --with-build-config=bootstrap-lto ) |
346 |
fi |
347 |
|
348 |
# Support to disable pch when building libstdcxx |
349 |
- if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then |
350 |
+ if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then |
351 |
confgcc+=( --disable-libstdcxx-pch ) |
352 |
fi |
353 |
|
354 |
@@ -1051,6 +934,9 @@ toolchain_src_configure() { |
355 |
esac |
356 |
if [[ -n ${needed_libc} ]] ; then |
357 |
local confgcc_no_libc=( --disable-shared ) |
358 |
+ # requires libc: bug #734820 |
359 |
+ tc_version_is_at_least 4.6 && confgcc_no_libc+=( --disable-libquadmath ) |
360 |
+ # requires libc |
361 |
tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic ) |
362 |
if ! has_version ${CATEGORY}/${needed_libc} ; then |
363 |
confgcc+=( |
364 |
@@ -1058,6 +944,14 @@ toolchain_src_configure() { |
365 |
--disable-threads |
366 |
--without-headers |
367 |
) |
368 |
+ if [[ $needed_libc == glibc ]]; then |
369 |
+ # By default gcc looks at glibc's headers |
370 |
+ # to detect long double support. This does |
371 |
+ # not work for --disable-headers mode. |
372 |
+ # Any >=glibc-2.4 is good enough for float128. |
373 |
+ # The option appeared in gcc-4.2. |
374 |
+ confgcc+=( --with-long-double-128 ) |
375 |
+ fi |
376 |
elif has_version "${CATEGORY}/${needed_libc}[headers-only(-)]" ; then |
377 |
confgcc+=( |
378 |
"${confgcc_no_libc[@]}" |
379 |
@@ -1088,7 +982,7 @@ toolchain_src_configure() { |
380 |
# PREFIX |
381 |
confgcc+=( --with-local-prefix="${TPREFIX}/usr" ) |
382 |
|
383 |
- # enable the CommandLine SDK, Apple no longer installs stuff |
384 |
+ # enable the configured SDK, Apple no longer installs stuff |
385 |
# into /usr |
386 |
if [[ ${CTARGET} == *-darwin* && ${CTARGET##*-darwin} -gt 9 ]] |
387 |
then |
388 |
@@ -1281,13 +1175,7 @@ toolchain_src_configure() { |
389 |
fi |
390 |
|
391 |
if tc_version_is_at_least 4.0 ; then |
392 |
- if in_iuse mudflap ; then |
393 |
- confgcc+=( $(use_enable mudflap libmudflap) ) |
394 |
- else |
395 |
- confgcc+=( --disable-libmudflap ) |
396 |
- fi |
397 |
- |
398 |
- if use_if_iuse libssp ; then |
399 |
+ if _tc_use_if_iuse libssp ; then |
400 |
confgcc+=( --enable-libssp ) |
401 |
else |
402 |
# Not all libcs have ssp built in. I assume only glibc has |
403 |
@@ -1296,7 +1184,7 @@ toolchain_src_configure() { |
404 |
if hardened_gcc_is_stable ssp; then |
405 |
export gcc_cv_libc_provides_ssp=yes |
406 |
fi |
407 |
- if use_if_iuse ssp; then |
408 |
+ if _tc_use_if_iuse ssp; then |
409 |
# On some targets USE="ssp -libssp" is an invalid |
410 |
# configuration as target libc does not provide |
411 |
# stack_chk_* functions. Do not disable libssp there. |
412 |
@@ -1326,6 +1214,10 @@ toolchain_src_configure() { |
413 |
confgcc+=( $(use_enable systemtap) ) |
414 |
fi |
415 |
|
416 |
+ if in_iuse valgrind ; then |
417 |
+ confgcc+=( $(use_enable valgrind valgrind-annotations) ) |
418 |
+ fi |
419 |
+ |
420 |
if in_iuse vtv ; then |
421 |
confgcc+=( |
422 |
$(use_enable vtv vtable-verify) |
423 |
@@ -1338,12 +1230,6 @@ toolchain_src_configure() { |
424 |
confgcc+=( $(use_with zstd) ) |
425 |
fi |
426 |
|
427 |
- # newer gcc's come with libquadmath, but only fortran uses |
428 |
- # it, so auto punt it when we don't care |
429 |
- if tc_version_is_at_least 4.6 && ! is_fortran ; then |
430 |
- confgcc+=( --disable-libquadmath ) |
431 |
- fi |
432 |
- |
433 |
if tc_version_is_at_least 4.6 ; then |
434 |
confgcc+=( --enable-lto ) |
435 |
elif tc_version_is_at_least 4.5 ; then |
436 |
@@ -1555,12 +1441,18 @@ downgrade_arch_flags() { |
437 |
} |
438 |
|
439 |
gcc_do_filter_flags() { |
440 |
- # Be conservative here: |
441 |
- # - don't allow -O3 and like to over-optimize libgcc # 701786 |
442 |
- # - don't allow -O0 to generate potentially invalid startup code |
443 |
- strip-flags |
444 |
- filter-flags '-O?' |
445 |
- append-flags -O2 |
446 |
+ # Allow users to explicitly avoid flag sanitization via |
447 |
+ # USE=custom-cflags. |
448 |
+ if ! _tc_use_if_iuse custom-cflags; then |
449 |
+ # Over-zealous CFLAGS can often cause problems. What may work for one |
450 |
+ # person may not work for another. To avoid a large influx of bugs |
451 |
+ # relating to failed builds, we strip most CFLAGS out to ensure as few |
452 |
+ # problems as possible. |
453 |
+ strip-flags |
454 |
+ # Lock gcc at -O2; we want to be conservative here. |
455 |
+ filter-flags '-O?' |
456 |
+ append-flags -O2 |
457 |
+ fi |
458 |
|
459 |
# dont want to funk ourselves |
460 |
filter-flags '-mabi*' -m31 -m32 -m64 |
461 |
@@ -1689,7 +1581,7 @@ gcc-abi-map() { |
462 |
local map=() |
463 |
case ${CTARGET} in |
464 |
mips*) map=("o32 32" "n32 n32" "n64 64") ;; |
465 |
- riscv*) map=("lp64d lp64d" "lp64 lp64") ;; |
466 |
+ riscv*) map=("lp64d lp64d" "lp64 lp64" "ilp32d ilp32d" "ilp32 ilp32") ;; |
467 |
x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;; |
468 |
esac |
469 |
|
470 |
@@ -1738,7 +1630,7 @@ gcc_do_make() { |
471 |
# resulting binaries natively ^^; |
472 |
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all} |
473 |
else |
474 |
- if tc_version_is_at_least 3.3 && use_if_iuse pgo; then |
475 |
+ if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then |
476 |
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap} |
477 |
else |
478 |
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean} |
479 |
@@ -1747,8 +1639,7 @@ gcc_do_make() { |
480 |
|
481 |
# Older versions of GCC could not do profiledbootstrap in parallel due to |
482 |
# collisions with profiling info. |
483 |
- # boundschecking also seems to introduce parallel build issues. |
484 |
- if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] || use_if_iuse boundschecking ; then |
485 |
+ if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]]; then |
486 |
! tc_version_is_at_least 4.6 && export MAKEOPTS="${MAKEOPTS} -j1" |
487 |
fi |
488 |
|
489 |
@@ -1796,7 +1687,7 @@ gcc_do_make() { |
490 |
emake -C gcc gnattools |
491 |
fi |
492 |
|
493 |
- if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then |
494 |
+ if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then |
495 |
if type -p doxygen > /dev/null ; then |
496 |
if tc_version_is_at_least 4.3 ; then |
497 |
cd "${CTARGET}"/libstdc++-v3/doc |
498 |
@@ -1907,11 +1798,11 @@ toolchain_src_install() { |
499 |
if [[ -f ${CTARGET}-${x} ]] ; then |
500 |
if ! is_crosscompile ; then |
501 |
ln -sf ${CTARGET}-${x} ${x} |
502 |
- dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \ |
503 |
+ dosym ${BINPATH}/${CTARGET}-${x} \ |
504 |
/usr/bin/${x}-${GCC_CONFIG_VER} |
505 |
fi |
506 |
# Create versioned symlinks |
507 |
- dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \ |
508 |
+ dosym ${BINPATH}/${CTARGET}-${x} \ |
509 |
/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER} |
510 |
fi |
511 |
|
512 |
@@ -1968,11 +1859,6 @@ toolchain_src_install() { |
513 |
# prune empty dirs left behind |
514 |
find "${ED}" -depth -type d -delete 2>/dev/null |
515 |
|
516 |
- if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then |
517 |
- exeinto "${DATAPATH#${EPREFIX}}" |
518 |
- doexe "${FILESDIR}"/c{89,99} || die |
519 |
- fi |
520 |
- |
521 |
# libstdc++.la: Delete as it doesn't add anything useful: g++ itself |
522 |
# handles linkage correctly in the dynamic & static case. It also just |
523 |
# causes us pain: any C++ progs/libs linking with libtool will gain a |
524 |
@@ -2019,7 +1905,7 @@ toolchain_src_install() { |
525 |
chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${D}${LIBPATH}" 2>/dev/null |
526 |
|
527 |
# Installing gdb pretty-printers into gdb-specific location. |
528 |
- local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/} |
529 |
+ local py gdbdir=/usr/share/gdb/auto-load${LIBPATH} |
530 |
pushd "${D}${LIBPATH}" >/dev/null |
531 |
for py in $(find . -name '*-gdb.py') ; do |
532 |
local multidir=${py%/*} |
533 |
@@ -2062,6 +1948,12 @@ gcc_movelibs() { |
534 |
dodir "${HOSTLIBPATH#${EPREFIX}}" |
535 |
mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die |
536 |
fi |
537 |
+ # libgccjit gets installed to /usr/lib, not /usr/$(get_libdir). Probably |
538 |
+ # due to a bug in gcc build system. |
539 |
+ if is_jit ; then |
540 |
+ dodir "${LIBPATH#${EPREFIX}}" |
541 |
+ mv "${ED}"/usr/lib/libgccjit* "${D}${LIBPATH}" || die |
542 |
+ fi |
543 |
|
544 |
# For all the libs that are built for CTARGET, move them into the |
545 |
# compiler-specific CTARGET internal dir. |
546 |
@@ -2277,12 +2169,8 @@ toolchain_pkg_postinst() { |
547 |
# gcc stopped installing .la files fixer in June 2020. |
548 |
# Cleaning can be removed in June 2022. |
549 |
rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh |
550 |
+ rm -f "${EROOT%/}"/usr/sbin/fix_libtool_files.sh |
551 |
rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk |
552 |
- |
553 |
- mkdir -p "${EROOT%/}"/usr/bin |
554 |
- # Since these aren't critical files and portage sucks with |
555 |
- # handling of binpkgs, don't require these to be found |
556 |
- cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null |
557 |
fi |
558 |
} |
559 |
|
560 |
@@ -2292,11 +2180,6 @@ toolchain_pkg_postrm() { |
561 |
eselect compiler-shadow clean all |
562 |
fi |
563 |
|
564 |
- # to make our lives easier (and saner), we do the fix_libtool stuff here. |
565 |
- # rather than checking SLOT's and trying in upgrade paths, we just see if |
566 |
- # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are |
567 |
- # unmerging. if it does, that means this was a simple re-emerge. |
568 |
- |
569 |
# clean up the cruft left behind by cross-compilers |
570 |
if is_crosscompile ; then |
571 |
if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then |
572 |
@@ -2403,44 +2286,48 @@ gcc-lang-supported() { |
573 |
has $1 ${TOOLCHAIN_ALLOWED_LANGS} |
574 |
} |
575 |
|
576 |
+_tc_use_if_iuse() { |
577 |
+ in_iuse $1 && use $1 |
578 |
+} |
579 |
+ |
580 |
is_ada() { |
581 |
gcc-lang-supported ada || return 1 |
582 |
- use_if_iuse ada |
583 |
+ _tc_use_if_iuse ada |
584 |
} |
585 |
|
586 |
is_cxx() { |
587 |
gcc-lang-supported 'c++' || return 1 |
588 |
- use_if_iuse cxx |
589 |
+ _tc_use_if_iuse cxx |
590 |
} |
591 |
|
592 |
is_d() { |
593 |
gcc-lang-supported d || return 1 |
594 |
- use_if_iuse d |
595 |
+ _tc_use_if_iuse d |
596 |
} |
597 |
|
598 |
is_f77() { |
599 |
gcc-lang-supported f77 || return 1 |
600 |
- use_if_iuse fortran |
601 |
+ _tc_use_if_iuse fortran |
602 |
} |
603 |
|
604 |
is_f95() { |
605 |
gcc-lang-supported f95 || return 1 |
606 |
- use_if_iuse fortran |
607 |
+ _tc_use_if_iuse fortran |
608 |
} |
609 |
|
610 |
is_fortran() { |
611 |
gcc-lang-supported fortran || return 1 |
612 |
- use_if_iuse fortran |
613 |
+ _tc_use_if_iuse fortran |
614 |
} |
615 |
|
616 |
is_gcj() { |
617 |
gcc-lang-supported java || return 1 |
618 |
- use_if_iuse cxx && use_if_iuse gcj |
619 |
+ _tc_use_if_iuse cxx && _tc_use_if_iuse gcj |
620 |
} |
621 |
|
622 |
is_go() { |
623 |
gcc-lang-supported go || return 1 |
624 |
- use_if_iuse cxx && use_if_iuse go |
625 |
+ _tc_use_if_iuse cxx && _tc_use_if_iuse go |
626 |
} |
627 |
|
628 |
is_jit() { |
629 |
@@ -2449,22 +2336,22 @@ is_jit() { |
630 |
# to generate code for a target. On target like avr |
631 |
# libgcclit.so can't link at all: bug #594572 |
632 |
is_crosscompile && return 1 |
633 |
- use_if_iuse jit |
634 |
+ _tc_use_if_iuse jit |
635 |
} |
636 |
|
637 |
is_multilib() { |
638 |
tc_version_is_at_least 3 || return 1 |
639 |
- use_if_iuse multilib |
640 |
+ _tc_use_if_iuse multilib |
641 |
} |
642 |
|
643 |
is_objc() { |
644 |
gcc-lang-supported objc || return 1 |
645 |
- use_if_iuse objc |
646 |
+ _tc_use_if_iuse objc |
647 |
} |
648 |
|
649 |
is_objcxx() { |
650 |
gcc-lang-supported 'obj-c++' || return 1 |
651 |
- use_if_iuse cxx && use_if_iuse objc++ |
652 |
+ _tc_use_if_iuse cxx && _tc_use_if_iuse objc++ |
653 |
} |
654 |
|
655 |
# Grab a variable from the build system (taken from linux-info.eclass) |
656 |
@@ -2489,12 +2376,12 @@ hardened_gcc_works() { |
657 |
[[ ${CTARGET} == *-freebsd* ]] && return 1 |
658 |
|
659 |
want_pie || return 1 |
660 |
- use_if_iuse nopie && return 1 |
661 |
+ _tc_use_if_iuse nopie && return 1 |
662 |
hardened_gcc_is_stable pie |
663 |
return $? |
664 |
elif [[ $1 == "ssp" ]] ; then |
665 |
[[ -n ${SPECS_VER} ]] || return 1 |
666 |
- use_if_iuse nossp && return 1 |
667 |
+ _tc_use_if_iuse nossp && return 1 |
668 |
hardened_gcc_is_stable ssp |
669 |
return $? |
670 |
else |
671 |
@@ -2532,12 +2419,12 @@ want_minispecs() { |
672 |
if tc_version_is_at_least 6.0 ; then |
673 |
return 0 |
674 |
fi |
675 |
- if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then |
676 |
+ if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then |
677 |
if ! want_pie ; then |
678 |
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild." |
679 |
elif use vanilla ; then |
680 |
ewarn "You will not get hardened features if you have the vanilla USE-flag." |
681 |
- elif use_if_iuse nopie && use_if_iuse nossp ; then |
682 |
+ elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then |
683 |
ewarn "You will not get hardened features if you have the nopie and nossp USE-flag." |
684 |
elif ! hardened_gcc_works ; then |
685 |
ewarn "Your $(tc-arch) arch is not supported." |
686 |
@@ -2551,11 +2438,12 @@ want_minispecs() { |
687 |
} |
688 |
|
689 |
want_pie() { |
690 |
- ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1 |
691 |
+ ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \ |
692 |
+ && _tc_use_if_iuse nopie && return 1 |
693 |
[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0 |
694 |
tc_version_is_at_least 4.3.2 && return 1 |
695 |
[[ -z ${PIE_VER} ]] && return 1 |
696 |
- use_if_iuse nopie || return 0 |
697 |
+ _tc_use_if_iuse nopie || return 0 |
698 |
return 1 |
699 |
} |