1 |
commit: 0ef588b1aae7bcdf9fd93630dfd5f9bddf527fe3 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 24 17:13:26 2019 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 24 17:14:39 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=0ef588b1 |
7 |
|
8 |
toolchain.eclass: bring into sync with upstream |
9 |
|
10 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
11 |
|
12 |
eclass/toolchain.eclass | 226 ++++++++++++++++++++++++++++++++---------------- |
13 |
1 file changed, 150 insertions(+), 76 deletions(-) |
14 |
|
15 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
16 |
index 0163767..5411381 100644 |
17 |
--- a/eclass/toolchain.eclass |
18 |
+++ b/eclass/toolchain.eclass |
19 |
@@ -2,12 +2,13 @@ |
20 |
# Distributed under the terms of the GNU General Public License v2 |
21 |
|
22 |
# Maintainer: Toolchain Ninjas <toolchain@g.o> |
23 |
+# @SUPPORTED_EAPIS: 5 |
24 |
|
25 |
DESCRIPTION="The GNU Compiler Collection" |
26 |
HOMEPAGE="https://gcc.gnu.org/" |
27 |
RESTRICT="strip" # cross-compilers need controlled stripping |
28 |
|
29 |
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix |
30 |
+inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix |
31 |
|
32 |
if [[ ${PV} == *_pre9999* ]] ; then |
33 |
EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git" |
34 |
@@ -25,8 +26,8 @@ FEATURES=${FEATURES/multilib-strict/} |
35 |
|
36 |
case ${EAPI:-0} in |
37 |
0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;; |
38 |
- 5*) ;; |
39 |
- *) die "I don't speak EAPI ${EAPI}." ;; |
40 |
+ 5*) inherit eapi7-ver ;; |
41 |
+ *) die "I don't speak EAPI ${EAPI}." ;; |
42 |
esac |
43 |
EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \ |
44 |
src_compile src_test src_install pkg_postinst pkg_postrm |
45 |
@@ -49,7 +50,7 @@ is_crosscompile() { |
46 |
|
47 |
# General purpose version check. Without a second arg matches up to minor version (x.x.x) |
48 |
tc_version_is_at_least() { |
49 |
- version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}" |
50 |
+ ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1" |
51 |
} |
52 |
|
53 |
# General purpose version range check |
54 |
@@ -61,17 +62,17 @@ tc_version_is_between() { |
55 |
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}} |
56 |
GCC_PVR=${GCC_PV} |
57 |
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR} |
58 |
-GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV}) |
59 |
-GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV}) |
60 |
-GCCMAJOR=$(get_version_component_range 1 ${GCC_PV}) |
61 |
-GCCMINOR=$(get_version_component_range 2 ${GCC_PV}) |
62 |
-GCCMICRO=$(get_version_component_range 3 ${GCC_PV}) |
63 |
+GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV}) |
64 |
+GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV}) |
65 |
+GCCMAJOR=$(ver_cut 1 ${GCC_PV}) |
66 |
+GCCMINOR=$(ver_cut 2 ${GCC_PV}) |
67 |
+GCCMICRO=$(ver_cut 3 ${GCC_PV}) |
68 |
[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \ |
69 |
- BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV}) |
70 |
+ BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV}) |
71 |
|
72 |
# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex. |
73 |
# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? |
74 |
-GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})} |
75 |
+GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})} |
76 |
|
77 |
# Pre-release support |
78 |
if [[ ${GCC_PV} == *_pre* ]] ; then |
79 |
@@ -127,12 +128,18 @@ else |
80 |
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+" |
81 |
fi |
82 |
|
83 |
-IUSE="regression-test vanilla" |
84 |
-IUSE_DEF=( nls nptl ) |
85 |
+if tc_version_is_at_least 8.3; then |
86 |
+ GCC_EBUILD_TEST_FLAG='test' |
87 |
+else |
88 |
+ # Don't force USE regression-test->test change on every |
89 |
+ # gcc ebuild just yet. Let's do the change when >=gcc-8.3 |
90 |
+ # is commonly used as a main compiler. |
91 |
+ GCC_EBUILD_TEST_FLAG='regression-test' |
92 |
+fi |
93 |
+IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls +nptl" |
94 |
|
95 |
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
96 |
- IUSE+=" altivec debug" |
97 |
- IUSE_DEF+=( cxx fortran ) |
98 |
+ IUSE+=" altivec debug +cxx +fortran" |
99 |
[[ -n ${PIE_VER} ]] && IUSE+=" nopie" |
100 |
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking" |
101 |
[[ -n ${D_VER} ]] && IUSE+=" d" |
102 |
@@ -143,13 +150,13 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
103 |
tc_version_is_at_least 4.0 && IUSE+=" objc-gc" |
104 |
tc_version_is_between 4.0 4.9 && IUSE+=" mudflap" |
105 |
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++" |
106 |
- tc_version_is_at_least 4.2 && IUSE_DEF+=( openmp ) |
107 |
+ tc_version_is_at_least 4.2 && IUSE+=" +openmp" |
108 |
tc_version_is_at_least 4.3 && IUSE+=" fixed-point" |
109 |
tc_version_is_at_least 4.7 && IUSE+=" go" |
110 |
# Note: while <=gcc-4.7 also supported graphite, it required forked ppl |
111 |
# versions which we dropped. Since graphite was also experimental in |
112 |
# the older versions, we don't want to bother supporting it. #448024 |
113 |
- tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize ) |
114 |
+ tc_version_is_at_least 4.8 && IUSE+=" graphite +sanitize" |
115 |
tc_version_is_between 4.9 8 && IUSE+=" cilk" |
116 |
tc_version_is_at_least 4.9 && IUSE+=" +vtv" |
117 |
tc_version_is_at_least 5.0 && IUSE+=" jit mpx" |
118 |
@@ -158,8 +165,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
119 |
tc_version_is_at_least 8.0 && IUSE+=" systemtap" |
120 |
fi |
121 |
|
122 |
-IUSE+=" ${IUSE_DEF[*]/#/+}" |
123 |
- |
124 |
SLOT="${GCC_CONFIG_VER}" |
125 |
|
126 |
#---->> DEPEND <<---- |
127 |
@@ -202,7 +207,7 @@ DEPEND="${RDEPEND} |
128 |
>=sys-devel/bison-1.875 |
129 |
>=sys-devel/flex-2.5.4 |
130 |
nls? ( sys-devel/gettext ) |
131 |
- regression-test? ( |
132 |
+ ${GCC_EBUILD_TEST_FLAG}? ( |
133 |
>=dev-util/dejagnu-1.4.4 |
134 |
>=sys-devel/autogen-5.5.4 |
135 |
)" |
136 |
@@ -309,6 +314,14 @@ gentoo_urls() { |
137 |
# ten Brugge's bounds-checking patches. If you want to use a patch |
138 |
# for an older gcc version with a new gcc, make sure you set |
139 |
# HTB_GCC_VER to that version of gcc. |
140 |
+# |
141 |
+# CYGWINPORTS_GITREV |
142 |
+# If set, this variable signals that we should apply additional patches |
143 |
+# maintained by upstream Cygwin developers at github/cygwinports/gcc, |
144 |
+# using the specified git commit id there. The list of patches to |
145 |
+# apply is extracted from gcc.cygport, maintained there as well. |
146 |
+# This is done for compilers running on Cygwin, not for cross compilers |
147 |
+# with a Cygwin target. |
148 |
get_gcc_src_uri() { |
149 |
export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} |
150 |
export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} |
151 |
@@ -375,6 +388,11 @@ get_gcc_src_uri() { |
152 |
fi |
153 |
fi |
154 |
|
155 |
+ # Cygwin patches from https://github.com/cygwinports/gcc |
156 |
+ [[ -n ${CYGWINPORTS_GITREV} ]] && \ |
157 |
+ GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.tar.gz |
158 |
+ -> gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )" |
159 |
+ |
160 |
echo "${GCC_SRC_URI}" |
161 |
} |
162 |
|
163 |
@@ -481,6 +499,8 @@ gcc_quick_unpack() { |
164 |
|
165 |
use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2" |
166 |
|
167 |
+ [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz" |
168 |
+ |
169 |
popd > /dev/null |
170 |
} |
171 |
|
172 |
@@ -505,6 +525,7 @@ toolchain_src_prepare() { |
173 |
fi |
174 |
do_gcc_HTB_patches |
175 |
do_gcc_PIE_patches |
176 |
+ do_gcc_CYGWINPORTS_patches |
177 |
epatch_user |
178 |
|
179 |
if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then |
180 |
@@ -645,6 +666,18 @@ do_gcc_PIE_patches() { |
181 |
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}" |
182 |
} |
183 |
|
184 |
+do_gcc_CYGWINPORTS_patches() { |
185 |
+ [[ -n ${CYGWINPORTS_GITREV} ]] || return 0 |
186 |
+ use elibc_Cygwin || return 0 |
187 |
+ |
188 |
+ local -a patches |
189 |
+ local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}" |
190 |
+ readarray -t patches < <(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport) |
191 |
+ for p in ${patches[*]}; do |
192 |
+ epatch "${d}/${p}" |
193 |
+ done |
194 |
+} |
195 |
+ |
196 |
# configure to build with the hardened GCC specs as the default |
197 |
make_gcc_hard() { |
198 |
|
199 |
@@ -999,7 +1032,7 @@ toolchain_src_configure() { |
200 |
then #291870 |
201 |
confgcc+=( --disable-shared ) |
202 |
fi |
203 |
- needed_libc=uclibc |
204 |
+ needed_libc=uclibc-ng |
205 |
;; |
206 |
*-cygwin) needed_libc=cygwin;; |
207 |
x86_64-*-mingw*|\ |
208 |
@@ -1034,7 +1067,7 @@ toolchain_src_configure() { |
209 |
confgcc+=( --enable-shared ) |
210 |
fi |
211 |
case ${CHOST} in |
212 |
- mingw*|*-mingw*|*-cygwin) |
213 |
+ mingw*|*-mingw*) |
214 |
confgcc+=( --enable-threads=win32 ) ;; |
215 |
*) |
216 |
confgcc+=( --enable-threads=posix ) ;; |
217 |
@@ -1178,10 +1211,12 @@ toolchain_src_configure() { |
218 |
|
219 |
### library options |
220 |
|
221 |
- if ! is_gcj ; then |
222 |
- confgcc+=( --disable-libgcj ) |
223 |
- elif use awt ; then |
224 |
- confgcc+=( --enable-java-awt=gtk ) |
225 |
+ if tc_version_is_between 3.0 7.0 ; then |
226 |
+ if ! is_gcj ; then |
227 |
+ confgcc+=( --disable-libgcj ) |
228 |
+ elif use awt ; then |
229 |
+ confgcc+=( --enable-java-awt=gtk ) |
230 |
+ fi |
231 |
fi |
232 |
|
233 |
if tc_version_is_at_least 4.2 ; then |
234 |
@@ -1246,7 +1281,8 @@ toolchain_src_configure() { |
235 |
if in_iuse vtv ; then |
236 |
confgcc+=( |
237 |
$(use_enable vtv vtable-verify) |
238 |
- $(use_enable vtv libvtv) |
239 |
+ # See Note [implicitly enabled flags] |
240 |
+ $(usex vtv '' --disable-libvtv) |
241 |
) |
242 |
fi |
243 |
|
244 |
@@ -1275,7 +1311,8 @@ toolchain_src_configure() { |
245 |
fi |
246 |
|
247 |
if tc_version_is_at_least 4.8 && in_iuse sanitize ; then |
248 |
- confgcc+=( $(use_enable sanitize libsanitizer) ) |
249 |
+ # See Note [implicitly enabled flags] |
250 |
+ confgcc+=( $(usex sanitize '' --disable-libsanitizer) ) |
251 |
fi |
252 |
|
253 |
if tc_version_is_at_least 6.0 && in_iuse pie ; then |
254 |
@@ -1322,7 +1359,7 @@ toolchain_src_configure() { |
255 |
addwrite /dev/zero |
256 |
echo "${S}"/configure "${confgcc[@]}" |
257 |
# Older gcc versions did not detect bash and re-exec itself, so force the |
258 |
- # use of bash. Newer ones will auto-detect, but this is not harmeful. |
259 |
+ # use of bash. Newer ones will auto-detect, but this is not harmful. |
260 |
CONFIG_SHELL="${EPREFIX}/bin/bash" \ |
261 |
bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure" |
262 |
|
263 |
@@ -1479,6 +1516,12 @@ gcc_do_filter_flags() { |
264 |
filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs |
265 |
filter-flags -f{no-,}stack-protector{,-all} |
266 |
filter-flags -fvisibility-inlines-hidden -fvisibility=hidden |
267 |
+ # and warning options |
268 |
+ filter-flags -Wextra -Wstack-protector |
269 |
+ fi |
270 |
+ if ! tc_version_is_at_least 4.1 ; then |
271 |
+ filter-flags -fdiagnostics-show-option |
272 |
+ filter-flags -Wstack-protector |
273 |
fi |
274 |
|
275 |
if tc_version_is_at_least 3.4 ; then |
276 |
@@ -1594,6 +1637,11 @@ toolchain_src_compile() { |
277 |
[[ ! -x /usr/bin/perl ]] \ |
278 |
&& find "${WORKDIR}"/build -name '*.[17]' -exec touch {} + |
279 |
|
280 |
+ # Older gcc versions did not detect bash and re-exec itself, so force the |
281 |
+ # use of bash. Newer ones will auto-detect, but this is not harmful. |
282 |
+ # This needs to be set for compile as well, as it's used in libtool |
283 |
+ # generation, which will break install otherwise (at least in 3.3.6): #664486 |
284 |
+ CONFIG_SHELL="${EPREFIX}/bin/bash" \ |
285 |
gcc_do_make ${GCC_MAKE_TARGET} |
286 |
} |
287 |
|
288 |
@@ -1684,7 +1732,7 @@ gcc_do_make() { |
289 |
#---->> src_test <<---- |
290 |
|
291 |
toolchain_src_test() { |
292 |
- if use regression-test ; then |
293 |
+ if use ${GCC_EBUILD_TEST_FLAG} ; then |
294 |
cd "${WORKDIR}"/build |
295 |
emake -k check |
296 |
fi |
297 |
@@ -1723,9 +1771,9 @@ toolchain_src_install() { |
298 |
S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die |
299 |
|
300 |
# Punt some tools which are really only useful while building gcc |
301 |
- find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \; |
302 |
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; |
303 |
# This one comes with binutils |
304 |
- find "${D}" -name libiberty.a -delete |
305 |
+ find "${ED}" -name libiberty.a -delete |
306 |
|
307 |
# Move the libraries to the proper location |
308 |
gcc_movelibs |
309 |
@@ -1734,7 +1782,7 @@ toolchain_src_install() { |
310 |
if ! is_crosscompile ; then |
311 |
local EXEEXT |
312 |
eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log) |
313 |
- [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}" |
314 |
+ [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}" |
315 |
fi |
316 |
|
317 |
dodir /etc/env.d/gcc |
318 |
@@ -1777,46 +1825,54 @@ toolchain_src_install() { |
319 |
ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER} |
320 |
fi |
321 |
done |
322 |
- # Rename the main go binaries as we don't want to clobber dev-lang/go |
323 |
- # when gcc-config runs. #567806 |
324 |
- if tc_version_is_at_least 5 && is_go ; then |
325 |
- for x in go gofmt; do |
326 |
- mv ${x} ${x}-${GCCMAJOR} || die |
327 |
- done |
328 |
+ |
329 |
+ # When gcc builds a crosscompiler it does not install unprefixed tools. |
330 |
+ # When cross-building gcc does install native tools. |
331 |
+ if ! is_crosscompile; then |
332 |
+ # Rename the main go binaries as we don't want to clobber dev-lang/go |
333 |
+ # when gcc-config runs. #567806 |
334 |
+ if tc_version_is_at_least 5 && is_go ; then |
335 |
+ for x in go gofmt; do |
336 |
+ mv ${x} ${x}-${GCCMAJOR} || die |
337 |
+ done |
338 |
+ fi |
339 |
fi |
340 |
|
341 |
- # Now do the fun stripping stuff |
342 |
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}" |
343 |
- is_crosscompile && \ |
344 |
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}" |
345 |
- env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}" |
346 |
- # gcc used to install helper binaries in lib/ but then moved to libexec/ |
347 |
- [[ -d ${D}${PREFIX}/libexec/gcc ]] && \ |
348 |
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}" |
349 |
+ # TODO: implement stripping (we use RESTRICT=strip) |
350 |
+ # As gcc installs object files both build against ${CHOST} and ${CTARGET} |
351 |
+ # we will ned to run stripping using different tools: |
352 |
+ # Using ${CHOST} tools: |
353 |
+ # - "${D}${BINPATH}" |
354 |
+ # - (for is_crosscompile) "${D}${HOSTLIBPATH}" |
355 |
+ # - "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}" |
356 |
+ # Using ${CTARGET} tools: |
357 |
+ # - "${D}${LIBPATH}" |
358 |
|
359 |
cd "${S}" |
360 |
if is_crosscompile; then |
361 |
- rm -rf "${ED}"usr/share/{man,info} |
362 |
+ rm -rf "${ED}"/usr/share/{man,info} |
363 |
rm -rf "${D}"${DATAPATH}/{man,info} |
364 |
else |
365 |
if tc_version_is_at_least 3.0 ; then |
366 |
local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man) |
367 |
if [[ -d ${cxx_mandir} ]] ; then |
368 |
- cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/ |
369 |
+ cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/ |
370 |
fi |
371 |
fi |
372 |
- has noinfo ${FEATURES} \ |
373 |
- && rm -r "${D}${DATAPATH}"/info \ |
374 |
- || prepinfo "${DATAPATH#${EPREFIX}}" |
375 |
- has noman ${FEATURES} \ |
376 |
- && rm -r "${D}${DATAPATH}"/man \ |
377 |
- || prepman "${DATAPATH#${EPREFIX}}" |
378 |
fi |
379 |
+ |
380 |
+ # portage regenerates 'dir' files on it's own: bug #672408 |
381 |
+ # Drop 'dir' files to avoid collisions. |
382 |
+ if [[ -f "${D}${DATAPATH}"/info/dir ]]; then |
383 |
+ einfo "Deleting '${D}${DATAPATH}/info/dir'" |
384 |
+ rm "${D}${DATAPATH}"/info/dir || die |
385 |
+ fi |
386 |
+ |
387 |
# prune empty dirs left behind |
388 |
- find "${D}" -depth -type d -delete 2>/dev/null |
389 |
+ find "${ED}" -depth -type d -delete 2>/dev/null |
390 |
|
391 |
# install testsuite results |
392 |
- if use regression-test; then |
393 |
+ if use ${GCC_EBUILD_TEST_FLAG}; then |
394 |
docinto testsuite |
395 |
find "${WORKDIR}"/build -type f -name "*.sum" -exec dodoc {} + |
396 |
find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -exec dodoc {} + |
397 |
@@ -1853,7 +1909,7 @@ toolchain_src_install() { |
398 |
# libvtv.la: gcc itself handles linkage correctly. |
399 |
# lib*san.la: Sanitizer linkage is handled internally by gcc, and they |
400 |
# do not support static linking. #487550 #546700 |
401 |
- find "${D}/${LIBPATH}" \ |
402 |
+ find "${D}${LIBPATH}" \ |
403 |
'(' \ |
404 |
-name libstdc++.la -o \ |
405 |
-name libstdc++fs.la -o \ |
406 |
@@ -1919,7 +1975,7 @@ gcc_movelibs() { |
407 |
# code to run on the target. |
408 |
if tc_version_is_at_least 5 && is_crosscompile ; then |
409 |
dodir "${HOSTLIBPATH#${EPREFIX}}" |
410 |
- mv "${ED}"usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die |
411 |
+ mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die |
412 |
fi |
413 |
|
414 |
# For all the libs that are built for CTARGET, move them into the |
415 |
@@ -1969,7 +2025,7 @@ gcc_movelibs() { |
416 |
for FROMDIR in ${removedirs} ; do |
417 |
rmdir "${D}"${FROMDIR} >& /dev/null |
418 |
done |
419 |
- find -depth "${D}" -type d -exec rmdir {} + >& /dev/null |
420 |
+ find -depth "${ED}" -type d -exec rmdir {} + >& /dev/null |
421 |
} |
422 |
|
423 |
# make sure the libtool archives have libdir set to where they actually |
424 |
@@ -2116,7 +2172,7 @@ gcc_slot_java() { |
425 |
|
426 |
toolchain_pkg_postinst() { |
427 |
do_gcc_config |
428 |
- if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
429 |
+ if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
430 |
eselect compiler-shadow update all |
431 |
fi |
432 |
|
433 |
@@ -2131,20 +2187,20 @@ toolchain_pkg_postinst() { |
434 |
echo |
435 |
|
436 |
# Clean up old paths |
437 |
- rm -f "${EROOT}"*/rcscripts/awk/fixlafiles.awk "${EROOT}"sbin/fix_libtool_files.sh |
438 |
- rmdir "${EROOT}"*/rcscripts{/awk,} 2>/dev/null |
439 |
+ rm -f "${EROOT%/}"/*/rcscripts/awk/fixlafiles.awk "${EROOT%/}"/sbin/fix_libtool_files.sh |
440 |
+ rmdir "${EROOT%/}"/*/rcscripts{/awk,} 2>/dev/null |
441 |
|
442 |
- mkdir -p "${EROOT}"usr/{share/gcc-data,sbin,bin} |
443 |
+ mkdir -p "${EROOT%/}"/usr/{share/gcc-data,sbin,bin} |
444 |
# DATAPATH has EPREFIX already, use ROOT with it |
445 |
- cp "${ROOT}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die |
446 |
- cp "${ROOT}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die |
447 |
+ cp "${ROOT%/}${DATAPATH}"/fixlafiles.awk "${EROOT%/}"/usr/share/gcc-data/ || die |
448 |
+ cp "${ROOT%/}${DATAPATH}"/fix_libtool_files.sh "${EROOT%/}"/usr/sbin/ || die |
449 |
|
450 |
# Since these aren't critical files and portage sucks with |
451 |
# handling of binpkgs, don't require these to be found |
452 |
- cp "${ROOT}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null |
453 |
+ cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null |
454 |
fi |
455 |
|
456 |
- if use regression-test ; then |
457 |
+ if use ${GCC_EBUILD_TEST_FLAG} ; then |
458 |
elog "Testsuite results have been installed into /usr/share/doc/${PF}/testsuite" |
459 |
echo |
460 |
fi |
461 |
@@ -2157,7 +2213,7 @@ toolchain_pkg_postinst() { |
462 |
} |
463 |
|
464 |
toolchain_pkg_postrm() { |
465 |
- if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
466 |
+ if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then |
467 |
eselect compiler-shadow clean all |
468 |
fi |
469 |
|
470 |
@@ -2168,16 +2224,16 @@ toolchain_pkg_postrm() { |
471 |
|
472 |
# clean up the cruft left behind by cross-compilers |
473 |
if is_crosscompile ; then |
474 |
- if [[ -z $(ls "${EROOT}"etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then |
475 |
- rm -f "${EROOT}"etc/env.d/gcc/config-${CTARGET} |
476 |
- rm -f "${EROOT}"etc/env.d/??gcc-${CTARGET} |
477 |
- rm -f "${EROOT}"usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64} |
478 |
+ if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then |
479 |
+ rm -f "${EROOT%/}"/etc/env.d/gcc/config-${CTARGET} |
480 |
+ rm -f "${EROOT%/}"/etc/env.d/??gcc-${CTARGET} |
481 |
+ rm -f "${EROOT%/}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64} |
482 |
fi |
483 |
return 0 |
484 |
fi |
485 |
|
486 |
# ROOT isnt handled by the script |
487 |
- [[ ${ROOT} != "/" ]] && return 0 |
488 |
+ [[ ${ROOT%/} ]] && return 0 |
489 |
|
490 |
if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then |
491 |
# make sure the profile is sane during same-slot upgrade #289403 |
492 |
@@ -2210,7 +2266,7 @@ do_gcc_config() { |
493 |
[[ -n ${current_specs} ]] && use_specs=-${current_specs} |
494 |
|
495 |
if [[ -n ${use_specs} ]] && \ |
496 |
- [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]] |
497 |
+ [[ ! -e ${EROOT%/}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]] |
498 |
then |
499 |
ewarn "The currently selected specs-specific gcc config," |
500 |
ewarn "${current_specs}, doesn't exist anymore. This is usually" |
501 |
@@ -2243,7 +2299,7 @@ should_we_gcc_config() { |
502 |
# for being in the same SLOT, make sure we run gcc-config. |
503 |
local curr_config_ver=$(gcc-config -S ${curr_config} | awk '{print $2}') |
504 |
|
505 |
- local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) |
506 |
+ local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver}) |
507 |
|
508 |
if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then |
509 |
return 0 |
510 |
@@ -2455,3 +2511,21 @@ toolchain_death_notice() { |
511 |
popd >/dev/null |
512 |
fi |
513 |
} |
514 |
+ |
515 |
+# Note [implicitly enabled flags] |
516 |
+# ------------------------------- |
517 |
+# Usually configure-based packages handle explicit feature requests |
518 |
+# like |
519 |
+# ./configure --enable-foo |
520 |
+# as explicit request to check for support of 'foo' and bail out at |
521 |
+# configure time. |
522 |
+# |
523 |
+# GCC does not follow this pattern and instead overrides autodetection |
524 |
+# of the feature and enables it unconditionally. |
525 |
+# See bugs: |
526 |
+# https://gcc.gnu.org/PR85663 (libsanitizer on mips) |
527 |
+# https://bugs.gentoo.org/661252 (libvtv on powerpc64) |
528 |
+# |
529 |
+# Thus safer way to enable/disable the feature is to rely on implicit |
530 |
+# enabled-by-default state: |
531 |
+# econf $(usex foo '' --disable-foo) |