commit:     10f162c781a6eebf80e0aa91f54089d6d803b19d
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  8 15:19:49 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jan  8 15:20:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10f162c7

sys-devel/clang: Fix cross-compiling clang after the first time

I was only half right before. LLVM_TOOLS_BINARY_DIR is only used to find
llvm-tblgen, not clang-tblgen. The latter is found on the PATH, but we
cannot rely on that because llvm.eclass adds ESYSROOT's LLVM bin to the
PATH, and that breaks cross-compiling after the time time. Instead, we
must override the location with CLANG_TABLEGEN, as we did previously.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-devel/clang/clang-16.0.0.9999.ebuild        | 4 +++-
 sys-devel/clang/clang-16.0.0_pre20230101.ebuild | 4 +++-
 sys-devel/clang/clang-16.0.0_pre20230107.ebuild | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys-devel/clang/clang-16.0.0.9999.ebuild 
b/sys-devel/clang/clang-16.0.0.9999.ebuild
index 34eba8f9bc95..b3eeacb43e1d 100644
--- a/sys-devel/clang/clang-16.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-16.0.0.9999.ebuild
@@ -331,8 +331,10 @@ multilib_src_configure() {
        if tc-is-cross-compiler; then
                has_version -b sys-devel/clang:${LLVM_MAJOR} ||
                        die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
+               local tools_bin=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin
                mycmakeargs+=(
-                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
+                       -DLLVM_TOOLS_BINARY_DIR="${tools_bin}"
+                       -DCLANG_TABLEGEN="${tools_bin}"/clang-tblgen
                )
        fi
 

diff --git a/sys-devel/clang/clang-16.0.0_pre20230101.ebuild 
b/sys-devel/clang/clang-16.0.0_pre20230101.ebuild
index 1ffc67b58c67..15f87c70e26c 100644
--- a/sys-devel/clang/clang-16.0.0_pre20230101.ebuild
+++ b/sys-devel/clang/clang-16.0.0_pre20230101.ebuild
@@ -331,8 +331,10 @@ multilib_src_configure() {
        if tc-is-cross-compiler; then
                has_version -b sys-devel/clang:${LLVM_MAJOR} ||
                        die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
+               local tools_bin=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin
                mycmakeargs+=(
-                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
+                       -DLLVM_TOOLS_BINARY_DIR="${tools_bin}"
+                       -DCLANG_TABLEGEN="${tools_bin}"/clang-tblgen
                )
        fi
 

diff --git a/sys-devel/clang/clang-16.0.0_pre20230107.ebuild 
b/sys-devel/clang/clang-16.0.0_pre20230107.ebuild
index 34eba8f9bc95..b3eeacb43e1d 100644
--- a/sys-devel/clang/clang-16.0.0_pre20230107.ebuild
+++ b/sys-devel/clang/clang-16.0.0_pre20230107.ebuild
@@ -331,8 +331,10 @@ multilib_src_configure() {
        if tc-is-cross-compiler; then
                has_version -b sys-devel/clang:${LLVM_MAJOR} ||
                        die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
+               local tools_bin=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin
                mycmakeargs+=(
-                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
+                       -DLLVM_TOOLS_BINARY_DIR="${tools_bin}"
+                       -DCLANG_TABLEGEN="${tools_bin}"/clang-tblgen
                )
        fi
 

Reply via email to