eclass/toolchain: Sync with Gentoo

It's from Gentoo commit 70f21b8bd7fd130067ab5d4798371ae0ef7c6ea6.
This commit is contained in:
Flatcar Buildbot 2023-04-24 07:14:32 +00:00 committed by Krzesimir Nowak
parent db7f7f45bc
commit abd765baf5

View File

@ -280,7 +280,8 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 12 && IUSE+=" ieee-long-double"
tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-znow"
tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection"
tc_version_is_at_least 13.0.0_pre20221211 ${PV} && IUSE+=" rust"
tc_version_is_at_least 13.0.0_pre20221218 ${PV} && IUSE+=" modula2"
tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust"
fi
if tc_version_is_at_least 10; then
@ -1045,6 +1046,7 @@ toolchain_src_configure() {
is_f77 && GCC_LANG+=",f77"
is_f95 && GCC_LANG+=",f95"
is_ada && GCC_LANG+=",ada"
is_modula2 && GCC_LANG+=",m2"
is_rust && GCC_LANG+=",rust"
confgcc+=( --enable-languages=${GCC_LANG} )
@ -1066,12 +1068,24 @@ toolchain_src_configure() {
confgcc+=( --disable-libunwind-exceptions )
# Use the default ("release") checking because upstream usually neglects
# to test "disabled" so it has a history of breaking. bug #317217
if in_iuse debug ; then
# The "release" keyword is new to 4.0. bug #551636
local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
# Non-released versions get extra checks, follow configure.ac's default to for those
# unless USE=debug. Note that snapshots on stable branches don't count as "non-released"
# for these purposes.
if grep -q "experimental" gcc/DEV-PHASE ; then
# - USE=debug for pre-releases: yes,extra,rtl
# - USE=-debug for pre-releases: yes,extra (following upstream default)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes,extra,rtl yes,extra)}" )
else
# - Use the default ("release") checking because upstream usually neglects
# to test "disabled" so it has a history of breaking. bug #317217.
# - The "release" keyword is new to 4.0. bug #551636.
# - After discussing in #gcc, we concluded that =yes,extra,rtl makes
# more sense when a user explicitly requests USE=debug. If rtl is too slow,
# we can change this to yes,extra.
local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes,extra,rtl ${off})}" )
fi
fi
# Branding
@ -2732,6 +2746,11 @@ is_objcxx() {
_tc_use_if_iuse cxx && _tc_use_if_iuse objc++
}
is_modula2() {
gcc-lang-supported m2 || return 1
_tc_use_if_iuse cxx && _tc_use_if_iuse modula2
}
is_rust() {
gcc-lang-supported rust || return 1
_tc_use_if_iuse rust