commit:     7b7a62d5e3f5e6e05c929f225ead22a2981c9f64
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  6 12:55:26 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct  6 12:55:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b7a62d5

toolchain.eclass: use --with-major-version-only for newer install paths

Flip over to major version install paths to reflect the
change in slotting we made between 9 and 10. We only slot
major versions now, so we should have our install paths
reflect that for:
1. principle of least surprise;
2. we want LDPATH to remain valid between upgrades (bug #865835, bug #873505).

Bug: https://bugs.gentoo.org/865835
Bug: https://bugs.gentoo.org/873505
Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/27533
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 71342765c78e..62977f16309f 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -57,6 +57,7 @@ is_crosscompile() {
        [[ ${CHOST} != ${CTARGET} ]]
 }
 
+
 # @FUNCTION: tc_version_is_at_least
 # @USAGE: ver1 [ver2]
 # @DESCRIPTION:
@@ -138,6 +139,32 @@ GCCMINOR=$(ver_cut 2 ${GCC_PV})
 # GCC micro version.
 GCCMICRO=$(ver_cut 3 ${GCC_PV})
 
+tc_use_major_version_only() {
+       local use_major_version_only=0
+
+       if ! tc_version_is_at_least 10 ; then
+               return 1
+       fi
+
+       if [[ ${GCCMAJOR} -eq 10 ]] && ver_test ${PV} -ge 10.4.1_p20220929 ; 
then
+               use_major_version_only=1
+       elif [[ ${GCCMAJOR} -eq 11 ]] && ver_test ${PV} -ge 11.3.1_p20220930 ; 
then
+               use_major_version_only=1
+       elif [[ ${GCCMAJOR} -eq 12 ]] && ver_test ${PV} -ge 12.2.1_p20221001 ; 
then
+               use_major_version_only=1
+       elif [[ ${GCCMAJOR} -eq 13 ]] && ver_test ${PV} -ge 13.0.0_pre20221002 
; then
+               use_major_version_only=1
+       elif [[ ${GCCMAJOR} -gt 13 ]] ; then
+               use_major_version_only=1
+       fi
+
+       if [[ ${use_major_version_only} -eq 1 ]] ; then
+               return 0
+       fi
+
+       return 1
+}
+
 # @ECLASS_VARIABLE: GCC_CONFIG_VER
 # @INTERNAL
 # @DESCRIPTION:
@@ -145,7 +172,11 @@ GCCMICRO=$(ver_cut 3 ${GCC_PV})
 # of binary and gcc-config names not directly tied to upstream
 # versioning. In practice it's hard to untangle from gcc/BASE-VER
 # (GCC_RELEASE_VER) value.
-GCC_CONFIG_VER=${GCC_RELEASE_VER}
+if tc_use_major_version_only ; then
+       GCC_CONFIG_VER=${GCCMAJOR}
+else
+       GCC_CONFIG_VER=${GCC_RELEASE_VER}
+fi
 
 # Pre-release support. Versioning schema:
 # 1.0.0_pre9999: live ebuild
@@ -1006,6 +1037,10 @@ toolchain_src_configure() {
                --with-pkgversion="${BRANDING_GCC_PKGVERSION}"
        )
 
+       if tc_use_major_version_only ; then
+               confgcc+=( --with-gcc-major-version-only )
+       fi
+
        # If we want hardened support with the newer PIE patchset for >=gcc 4.4
        if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; 
then
                confgcc+=( $(use_enable hardened esp) )

Reply via email to