commit:     23022edf6f87c765db32fac54586d6c2d2c668ae
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  7 11:16:14 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Jan  7 13:34:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23022edf

sys-devel/clang: Fix cross-compiling of V16

`LLVM_TOOLS_BINARY_DIR` is now used to find llvm-tblgen and
clang-tblgen. clang-tblgen is still not normally installed, but it only
needs an additional, albeit inappropriate, configure option now. An
upstream fix is under review.

Bug: https://bugs.gentoo.org/731264
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-devel/clang/clang-16.0.0.9999.ebuild        | 15 ++++++++++-----
 sys-devel/clang/clang-16.0.0_pre20221217.ebuild | 15 ++++++++++-----
 sys-devel/clang/clang-16.0.0_pre20221226.ebuild | 15 ++++++++++-----
 sys-devel/clang/clang-16.0.0_pre20230101.ebuild | 13 +++++++++----
 4 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/sys-devel/clang/clang-16.0.0.9999.ebuild 
b/sys-devel/clang/clang-16.0.0.9999.ebuild
index 47dee6c6e902..34eba8f9bc95 100644
--- a/sys-devel/clang/clang-16.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-16.0.0.9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -198,6 +198,9 @@ get_distribution_components() {
                        clang-scan-deps
                        diagtool
                        hmaptool
+
+                       # needed for cross-compiling Clang
+                       clang-tblgen
                )
 
                if use extra; then
@@ -303,6 +306,9 @@ multilib_src_configure() {
                fi
                mycmakeargs+=(
                        -DCLANG_INCLUDE_DOCS=${build_docs}
+
+                       # Hack to install clang-tblgen: 
https://reviews.llvm.org/D141092
+                       -DLLVM_BUILD_UTILS=ON
                )
        fi
        if multilib_native_use extra; then
@@ -323,11 +329,10 @@ multilib_src_configure() {
        fi
 
        if tc-is-cross-compiler; then
-               [[ -x "/usr/bin/clang-tblgen" ]] \
-                       || die "/usr/bin/clang-tblgen not found or usable"
+               has_version -b sys-devel/clang:${LLVM_MAJOR} ||
+                       die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
                mycmakeargs+=(
-                       -DCMAKE_CROSSCOMPILING=ON
-                       -DCLANG_TABLEGEN=/usr/bin/clang-tblgen
+                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
                )
        fi
 

diff --git a/sys-devel/clang/clang-16.0.0_pre20221217.ebuild 
b/sys-devel/clang/clang-16.0.0_pre20221217.ebuild
index 25c3b72735ff..1ffc67b58c67 100644
--- a/sys-devel/clang/clang-16.0.0_pre20221217.ebuild
+++ b/sys-devel/clang/clang-16.0.0_pre20221217.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -198,6 +198,9 @@ get_distribution_components() {
                        clang-scan-deps
                        diagtool
                        hmaptool
+
+                       # needed for cross-compiling Clang
+                       clang-tblgen
                )
 
                if use extra; then
@@ -303,6 +306,9 @@ multilib_src_configure() {
                fi
                mycmakeargs+=(
                        -DCLANG_INCLUDE_DOCS=${build_docs}
+
+                       # Hack to install clang-tblgen: 
https://reviews.llvm.org/D141092
+                       -DLLVM_BUILD_UTILS=ON
                )
        fi
        if multilib_native_use extra; then
@@ -323,11 +329,10 @@ multilib_src_configure() {
        fi
 
        if tc-is-cross-compiler; then
-               [[ -x "/usr/bin/clang-tblgen" ]] \
-                       || die "/usr/bin/clang-tblgen not found or usable"
+               has_version -b sys-devel/clang:${LLVM_MAJOR} ||
+                       die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
                mycmakeargs+=(
-                       -DCMAKE_CROSSCOMPILING=ON
-                       -DCLANG_TABLEGEN=/usr/bin/clang-tblgen
+                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
                )
        fi
 

diff --git a/sys-devel/clang/clang-16.0.0_pre20221226.ebuild 
b/sys-devel/clang/clang-16.0.0_pre20221226.ebuild
index 25c3b72735ff..1ffc67b58c67 100644
--- a/sys-devel/clang/clang-16.0.0_pre20221226.ebuild
+++ b/sys-devel/clang/clang-16.0.0_pre20221226.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -198,6 +198,9 @@ get_distribution_components() {
                        clang-scan-deps
                        diagtool
                        hmaptool
+
+                       # needed for cross-compiling Clang
+                       clang-tblgen
                )
 
                if use extra; then
@@ -303,6 +306,9 @@ multilib_src_configure() {
                fi
                mycmakeargs+=(
                        -DCLANG_INCLUDE_DOCS=${build_docs}
+
+                       # Hack to install clang-tblgen: 
https://reviews.llvm.org/D141092
+                       -DLLVM_BUILD_UTILS=ON
                )
        fi
        if multilib_native_use extra; then
@@ -323,11 +329,10 @@ multilib_src_configure() {
        fi
 
        if tc-is-cross-compiler; then
-               [[ -x "/usr/bin/clang-tblgen" ]] \
-                       || die "/usr/bin/clang-tblgen not found or usable"
+               has_version -b sys-devel/clang:${LLVM_MAJOR} ||
+                       die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
                mycmakeargs+=(
-                       -DCMAKE_CROSSCOMPILING=ON
-                       -DCLANG_TABLEGEN=/usr/bin/clang-tblgen
+                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
                )
        fi
 

diff --git a/sys-devel/clang/clang-16.0.0_pre20230101.ebuild 
b/sys-devel/clang/clang-16.0.0_pre20230101.ebuild
index 5a6494180ad1..1ffc67b58c67 100644
--- a/sys-devel/clang/clang-16.0.0_pre20230101.ebuild
+++ b/sys-devel/clang/clang-16.0.0_pre20230101.ebuild
@@ -198,6 +198,9 @@ get_distribution_components() {
                        clang-scan-deps
                        diagtool
                        hmaptool
+
+                       # needed for cross-compiling Clang
+                       clang-tblgen
                )
 
                if use extra; then
@@ -303,6 +306,9 @@ multilib_src_configure() {
                fi
                mycmakeargs+=(
                        -DCLANG_INCLUDE_DOCS=${build_docs}
+
+                       # Hack to install clang-tblgen: 
https://reviews.llvm.org/D141092
+                       -DLLVM_BUILD_UTILS=ON
                )
        fi
        if multilib_native_use extra; then
@@ -323,11 +329,10 @@ multilib_src_configure() {
        fi
 
        if tc-is-cross-compiler; then
-               [[ -x "/usr/bin/clang-tblgen" ]] \
-                       || die "/usr/bin/clang-tblgen not found or usable"
+               has_version -b sys-devel/clang:${LLVM_MAJOR} ||
+                       die "sys-devel/clang:${LLVM_MAJOR} is required on the 
build host."
                mycmakeargs+=(
-                       -DCMAKE_CROSSCOMPILING=ON
-                       -DCLANG_TABLEGEN=/usr/bin/clang-tblgen
+                       
-DLLVM_TOOLS_BINARY_DIR="${BROOT}"/usr/lib/llvm/${LLVM_MAJOR}/bin
                )
        fi
 

Reply via email to