From cab39eabfa4f7afdbdba4ac7c477a97fc233027d Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 26 Sep 2022 16:02:56 +0200 Subject: [PATCH] eclass/toolchain: Sync with Gentoo It's from Gentoo commit a7c27596827072f586dc07e6d53531ecb2c7cd6e. --- .../portage-stable/eclass/toolchain.eclass | 51 ++++++++++++++++--- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass b/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass index ed473e0c62..71342765c7 100644 --- a/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass +++ b/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass @@ -288,6 +288,13 @@ BDEPEND=" )" DEPEND="${RDEPEND}" +if [[ ${PN} == gcc && ${PV} == *_p* ]] ; then + # Snapshots don't contain info pages. + # If they start to, adjust gcc_cv_prog_makeinfo_modern logic in toolchain_src_configure. + # Needed unless/until https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 is fixed + BDEPEND+=" sys-apps/texinfo" +fi + if tc_has_feature gcj ; then DEPEND+=" gcj? ( @@ -324,11 +331,19 @@ if tc_has_feature zstd ; then RDEPEND+=" zstd? ( app-arch/zstd:= )" fi -if tc_has_feature valgrind; then +if tc_has_feature valgrind ; then BDEPEND+=" valgrind? ( dev-util/valgrind )" fi -if tc_version_is_at_least 12.0 ; then +# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler +# supports Ada. +if tc_has_feature ada ; then + BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] ) )" +fi + +# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler +# supports D. +if tc_has_feature d && tc_version_is_at_least 12.0 ; then # D in 12+ is self-hosting and needs D to bootstrap. # TODO: package some binary we can use, like for Ada # bug #840182 @@ -1187,8 +1202,6 @@ toolchain_src_configure() { fi done - # Convert armv6m to armv6-m - [[ ${arm_arch} == armv6m ]] && arm_arch=armv6-m # Convert armv7{a,r,m} to armv7-{a,r,m} [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-} # See if this is a valid --with-arch flag @@ -1213,6 +1226,17 @@ toolchain_src_configure() { armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;; esac fi + + # If multilib is used, make the compiler build multilibs + # for A or R and M architecture profiles. Do this only + # when no specific arch/mode/float is specified, e.g. + # for target arm-none-eabi, since doing this is + # incompatible with --with-arch/cpu/float/fpu. + if is_multilib && [[ ${arm_arch} == arm ]] && \ + tc_version_is_at_least 7.1 + then + confgcc+=( --with-multilib-list=aprofile,rmprofile ) + fi ;; mips) # Add --with-abi flags to set default ABI @@ -1408,9 +1432,22 @@ toolchain_src_configure() { ) fi - # Disable gcc info regeneration -- it ships with generated info pages - # already. Our custom version/urls/etc... trigger it. bug #464008 - export gcc_cv_prog_makeinfo_modern=no + if [[ ${PV} != *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then + # Disable gcc info regeneration -- it ships with generated info pages + # already. Our custom version/urls/etc... trigger it. bug #464008 + export gcc_cv_prog_makeinfo_modern=no + else + # Allow a fallback so we don't accidentally install no docs + # bug #834845 + ewarn "No pre-generated info pages in tarball. Allowing regeneration with texinfo..." + + if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then + # Safeguard against https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 being fixed + # without corresponding ebuild changes. + eqawarn "Snapshot release with pre-generated info pages found!" + eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo." + fi + fi # Do not let the X detection get in our way. We know things can be found # via system paths, so no need to hardcode things that'll break multilib.