eclass/toolchain: Sync with Gentoo

It's from Gentoo commit 288bc9aff2e91f6a443e8c09f080ffc9f633b07e.
This commit is contained in:
Flatcar Buildbot 2023-01-02 07:56:47 +00:00 committed by Krzesimir Nowak
parent a4f1ac3612
commit 8b9603e59b

View File

@ -280,6 +280,7 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 12 && IUSE+=" ieee-long-double" 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-znow"
tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection" 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"
fi fi
if tc_version_is_at_least 10; then if tc_version_is_at_least 10; then
@ -819,6 +820,10 @@ make_gcc_hard() {
# * -z now # * -z now
# See gcc *_all_extra-options.patch patches. # See gcc *_all_extra-options.patch patches.
gcc_hard_flags+=" -DEXTRA_OPTIONS" gcc_hard_flags+=" -DEXTRA_OPTIONS"
# Default to -D_FORTIFY_SOURCE=3 instead of -D_FORTIFY_SOURCE=2
gcc_hard_flags+=" -DGENTOO_FORTIFY_SOURCE_LEVEL=3"
# Add -D_GLIBCXX_ASSERTIONS
gcc_hard_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS"
if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
gcc_hard_flags+=" -DEXTRA_OPTIONS_CF" gcc_hard_flags+=" -DEXTRA_OPTIONS_CF"
@ -1020,8 +1025,8 @@ toolchain_src_configure() {
is_fortran && GCC_LANG+=",fortran" is_fortran && GCC_LANG+=",fortran"
is_f77 && GCC_LANG+=",f77" is_f77 && GCC_LANG+=",f77"
is_f95 && GCC_LANG+=",f95" is_f95 && GCC_LANG+=",f95"
is_ada && GCC_LANG+=",ada" is_ada && GCC_LANG+=",ada"
is_rust && GCC_LANG+=",rust"
confgcc+=( --enable-languages=${GCC_LANG} ) confgcc+=( --enable-languages=${GCC_LANG} )
@ -2108,7 +2113,7 @@ toolchain_src_install() {
cd "${D}"${BINPATH} || die cd "${D}"${BINPATH} || die
# Ugh: we really need to auto-detect this list. # Ugh: we really need to auto-detect this list.
# It's constantly out of date. # It's constantly out of date.
for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo gnat* ; do for x in cpp gcc gccrs g++ c++ gcov g77 gcj gcjh gfortran gccgo gnat* ; do
# For some reason, g77 gets made instead of ${CTARGET}-g77... # For some reason, g77 gets made instead of ${CTARGET}-g77...
# this should take care of that # this should take care of that
if [[ -f ${x} ]] ; then if [[ -f ${x} ]] ; then
@ -2689,6 +2694,11 @@ is_objcxx() {
_tc_use_if_iuse cxx && _tc_use_if_iuse objc++ _tc_use_if_iuse cxx && _tc_use_if_iuse objc++
} }
is_rust() {
gcc-lang-supported rust || return 1
_tc_use_if_iuse rust
}
# Grab a variable from the build system (taken from linux-info.eclass) # Grab a variable from the build system (taken from linux-info.eclass)
get_make_var() { get_make_var() {
local var=$1 makefile=${2:-${WORKDIR}/build/Makefile} local var=$1 makefile=${2:-${WORKDIR}/build/Makefile}