commit:     cac0e35d84c5c8460b2c11ef4aa36ff3004d234c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 23 00:39:16 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 23 00:41:07 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cac0e35d

sys-libs/compiler-rt: only override compiler for USE=clang if not using Clang

When USE=clang, we used to force CC=${CHOST}-clang, CXX=${CHOST}-clang++,
but this prevents overriding with a certain version of Clang.

In my case, a world upgrade went awry where Clang got upgraded from 13->14,
but compiler-rt hadn't yet been upgraded to the new slot, so my system
Clang was broken. CC=clang-13 CXX=clang++-13 emerge -v1 ... sorted out
the issue.

So, don't override CC & CXX to be Clang if we know it's already Clang.

That said, we probably still need to tweak the logic for when
the compiler fails (for which we already have checks in the ebuild).

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/compiler-rt/compiler-rt-14.0.4.ebuild      | 9 +++++++--
 sys-libs/compiler-rt/compiler-rt-14.0.5.ebuild      | 8 ++++++--
 sys-libs/compiler-rt/compiler-rt-15.0.0.9999.ebuild | 8 ++++++--
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/sys-libs/compiler-rt/compiler-rt-14.0.4.ebuild 
b/sys-libs/compiler-rt/compiler-rt-14.0.4.ebuild
index ff1e80b30fff..9a03b0678000 100644
--- a/sys-libs/compiler-rt/compiler-rt-14.0.4.ebuild
+++ b/sys-libs/compiler-rt/compiler-rt-14.0.4.ebuild
@@ -72,8 +72,13 @@ src_configure() {
 
        local nolib_flags=( -nodefaultlibs -lc )
        if use clang; then
-               local -x CC=${CHOST}-clang
-               local -x CXX=${CHOST}-clang++
+               # Only do this conditionally to allow overriding with
+               # e.g. CC=clang-13 in case of breakage
+               if ! tc-is-clang ; then
+                       local -x CC=${CHOST}-clang
+                       local -x CXX=${CHOST}-clang++
+               fi
+
                strip-unsupported-flags
                # ensure we can use clang before installing compiler-rt
                local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"

diff --git a/sys-libs/compiler-rt/compiler-rt-14.0.5.ebuild 
b/sys-libs/compiler-rt/compiler-rt-14.0.5.ebuild
index dcbada06ccf0..e5c0203110f9 100644
--- a/sys-libs/compiler-rt/compiler-rt-14.0.5.ebuild
+++ b/sys-libs/compiler-rt/compiler-rt-14.0.5.ebuild
@@ -72,8 +72,12 @@ src_configure() {
 
        local nolib_flags=( -nodefaultlibs -lc )
        if use clang; then
-               local -x CC=${CHOST}-clang
-               local -x CXX=${CHOST}-clang++
+               # Only do this conditionally to allow overriding with
+               # e.g. CC=clang-13 in case of breakage
+               if ! tc-is-clang ; then
+                       local -x CC=${CHOST}-clang
+                       local -x CXX=${CHOST}-clang++
+               fi
                strip-unsupported-flags
                # ensure we can use clang before installing compiler-rt
                local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"

diff --git a/sys-libs/compiler-rt/compiler-rt-15.0.0.9999.ebuild 
b/sys-libs/compiler-rt/compiler-rt-15.0.0.9999.ebuild
index 1a7cc5f2b724..c6913b149fa4 100644
--- a/sys-libs/compiler-rt/compiler-rt-15.0.0.9999.ebuild
+++ b/sys-libs/compiler-rt/compiler-rt-15.0.0.9999.ebuild
@@ -72,8 +72,12 @@ src_configure() {
 
        local nolib_flags=( -nodefaultlibs -lc )
        if use clang; then
-               local -x CC=${CHOST}-clang
-               local -x CXX=${CHOST}-clang++
+               # Only do this conditionally to allow overriding with
+               # e.g. CC=clang-13 in case of breakage
+               if ! tc-is-clang ; then
+                       local -x CC=${CHOST}-clang
+                       local -x CXX=${CHOST}-clang++
+               fi
                strip-unsupported-flags
                # ensure we can use clang before installing compiler-rt
                local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"

Reply via email to