eclass/toolchain: Sync with Gentoo

It's from Gentoo commit 9c4f5b81368474b9bb7fb8245945c7faba3cc3e5.
This commit is contained in:
Flatcar Buildbot 2025-03-17 07:09:43 +00:00 committed by Krzesimir Nowak
parent 49274e2642
commit 954865a94e

View File

@ -340,6 +340,7 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" TC_FEATURES+=( rust )
tc_version_is_at_least 14.2.1_p20241026 ${PV} && IUSE+=" time64"
tc_version_is_at_least 15.0.0_pre20241124 ${PV} && IUSE+=" libgdiagnostics"
tc_version_is_at_least 15.0.1_pre20250316 ${PV} && IUSE+=" cobol"
fi
if tc_version_is_at_least 10; then
@ -428,15 +429,15 @@ if [[ ${PN} != gnat-gpl ]] && tc_has_feature ada ; then
)
"
else
BDEPEND+="
ada? (
|| (
sys-devel/gcc:${SLOT}[ada]
<sys-devel/gcc-${SLOT}[ada]
<dev-lang/ada-bootstrap-${SLOT}
)
)
"
BDEPEND+="
ada? (
|| (
sys-devel/gcc:${SLOT}[ada]
<sys-devel/gcc-${SLOT}[ada]
<dev-lang/ada-bootstrap-${SLOT}
)
)
"
fi
fi
@ -1255,6 +1256,7 @@ toolchain_src_configure() {
is_f77 && GCC_LANG+=",f77"
is_f95 && GCC_LANG+=",f95"
is_ada && GCC_LANG+=",ada"
is_cobol && GCC_LANG+=",cobol"
is_modula2 && GCC_LANG+=",m2"
is_rust && GCC_LANG+=",rust"
@ -1831,6 +1833,11 @@ toolchain_src_configure() {
fi
fi
if [[ ${CTARGET} != *-darwin* ]] && tc_version_is_at_least 14.1 ; then
# This allows passing -stdlib-=libc++ at runtime.
confgcc+=( --with-gxx-libcxx-include-dir="${ESYSROOT}"/usr/include/c++/v1 )
fi
# TODO: Ignore RCs here (but TOOLCHAIN_IS_RC isn't yet an eclass var)
if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then
# Safeguard against https://gcc.gnu.org/PR106899 being fixed
@ -2104,7 +2111,7 @@ gcc_do_filter_flags() {
# https://gcc.gnu.org/PR100431
filter-flags -Werror=format-security
if ver_test -lt 10.1 ; then
if ver_test -lt 11.1 ; then
filter-flags '-fdiagnostics-urls=*'
filter-flags '-Wstringop-overread'
fi
@ -2600,7 +2607,7 @@ toolchain_src_install() {
cd "${D}"${BINPATH} || die
# Ugh: we really need to auto-detect this list.
# It's constantly out of date.
for x in cpp gcc gccrs g++ c++ gcov gdc g77 gfortran gccgo gnat* ; do
for x in cpp gcc gccrs g++ c++ gcobol gcov gdc g77 gfortran gccgo gnat* ; do
# For some reason, g77 gets made instead of ${CTARGET}-g77...
# this should take care of that
if [[ -f ${x} ]] ; then
@ -2639,6 +2646,13 @@ toolchain_src_install() {
fi
fi
# Hack for C++ modules
if ! is_crosscompile && tc_version_is_at_least 15.0.1_pre20250316 ${PV}; then
# PR19266 (bug #948394)
sed -i -e "s,\.\./lib/gcc/${CHOST}/${GCCMAJOR}/include/,include/," \
"${ED}"/usr/lib/gcc/${CHOST}/${GCCMAJOR}/libstdc++.modules.json || die
fi
# As gcc installs object files built against both ${CHOST} and ${CTARGET}
# ideally we will need to strip them using different tools:
# Using ${CHOST} tools:
@ -3142,6 +3156,11 @@ is_objcxx() {
_tc_use_if_iuse cxx && _tc_use_if_iuse objc++
}
is_cobol() {
gcc-lang-supported cobol || return 1
_tc_use_if_iuse cobol
}
is_modula2() {
gcc-lang-supported m2 || return 1
_tc_use_if_iuse cxx && _tc_use_if_iuse modula2