commit:     0bf8c2d99027d3173fc0ead689be6ce9347d9d9d
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  5 15:49:18 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Nov  5 15:49:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=0bf8c2d9

sys-devel/gcc-config-2.7-r1: add patch for order of GCC libs

This ensures that most recent GCC libs are used for the backup GCC
libaries.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 ...5.1-r4.ebuild => binutils-config-5.1-r5.ebuild} |  0
 sys-devel/binutils-config/files/ldwrapper.c        |  1 +
 .../files/gcc-config-2.7-gcc-libs-ordered.patch    | 24 ++++++++++++++++++++++
 ...-config-2.7.ebuild => gcc-config-2.7-r1.ebuild} |  1 +
 sys-devel/gcc/gcc-12.2.0.ebuild                    |  3 ++-
 5 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r4.ebuild 
b/sys-devel/binutils-config/binutils-config-5.1-r5.ebuild
similarity index 100%
rename from sys-devel/binutils-config/binutils-config-5.1-r4.ebuild
rename to sys-devel/binutils-config/binutils-config-5.1-r5.ebuild

diff --git a/sys-devel/binutils-config/files/ldwrapper.c 
b/sys-devel/binutils-config/files/ldwrapper.c
index 6bcb2a5e72..1b5fa19ad3 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -461,6 +461,7 @@ main(int argc, char *argv[])
        if (!is_cross) {
                if (is_darwin) {
                        /* FIXME: no support for cross-compiling *to* Darwin */
+                       newargv[k++] = "-L" EPREFIX "/usr/" CHOST "/lib/gcc";
                        newargv[k++] = "-L" EPREFIX "/usr/lib";
                        newargv[k++] = "-L" EPREFIX "/lib";
 

diff --git a/sys-devel/gcc-config/files/gcc-config-2.7-gcc-libs-ordered.patch 
b/sys-devel/gcc-config/files/gcc-config-2.7-gcc-libs-ordered.patch
new file mode 100644
index 0000000000..e15e83015f
--- /dev/null
+++ b/sys-devel/gcc-config/files/gcc-config-2.7-gcc-libs-ordered.patch
@@ -0,0 +1,24 @@
+prefix_copy_gcc_libs: try and get latest libs copied last
+
+Try to get the most recent GCC libs copied to the shared place.  We need
+the latest because they should be backwards compatible, thus also work
+with older binaries.
+
+--- gcc-config-2.7/gcc-config
++++ gcc-config-2.7/gcc-config
+@@ -619,8 +619,13 @@
+               rmdir "${sourcedir}"
+       }
+ 
+-      # We don't rely on iteration order here.
+-      local GCC_PROFILES=$(LC_ALL="C" ls ${GCC_ENV_D}/${CHOST}-*)
++      # We want the latest version to provide the final link to an object,
++      # for gcc's libs should be backwards compatible, so use sort -V to
++      # get that ordering -- take into account that sort may not support
++      # -V (yet).  Then it is better to just do whatever order ls reports.
++      local srt='sort --version-sort'
++      sort --help | grep -q -- --version-sort || srt='cat'
++      local GCC_PROFILES=$(LC_ALL="C" ls ${GCC_ENV_D}/${CHOST}-* | ${srt})
+ 
+       local targetdirs= GCC_PATH= LDPATH=
+       for x in ${GCC_PROFILES} ; do

diff --git a/sys-devel/gcc-config/gcc-config-2.7.ebuild 
b/sys-devel/gcc-config/gcc-config-2.7-r1.ebuild
similarity index 97%
rename from sys-devel/gcc-config/gcc-config-2.7.ebuild
rename to sys-devel/gcc-config/gcc-config-2.7-r1.ebuild
index a1ecb1a2b2..94cc8b75cf 100644
--- a/sys-devel/gcc-config/gcc-config-2.7.ebuild
+++ b/sys-devel/gcc-config/gcc-config-2.7-r1.ebuild
@@ -23,6 +23,7 @@ RDEPEND=">=sys-apps/gentoo-functions-0.10"
 PATCHES=(
        "${FILESDIR}"/${PN}-1.8-copy-gcc-libs-darwin.patch
        "${FILESDIR}"/${PN}-1.9-cygwin.patch
+       "${FILESDIR}"/${PN}-2.7-gcc-libs-ordered.patch
 )
 
 _emake() {

diff --git a/sys-devel/gcc/gcc-12.2.0.ebuild b/sys-devel/gcc/gcc-12.2.0.ebuild
index 1cb1b0da53..59b639d041 100644
--- a/sys-devel/gcc/gcc-12.2.0.ebuild
+++ b/sys-devel/gcc/gcc-12.2.0.ebuild
@@ -13,8 +13,9 @@ inherit toolchain
 
 # Don't keyword live ebuilds
 if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
-# fails to compile on Solaris and macOS, need to check why
+       # fails to compile on Solaris and macOS, need to check why
        : KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos 
~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+       KEYWORDS="~x64-macos"
 fi
 
 # use alternate source for Apple M1 (also works for x86_64)

Reply via email to