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@gentoo.org>
This commit is contained in:
James Le Cuirot
2023-01-07 11:16:14 +00:00
parent 5af79da3e8
commit 23022edf6f
4 changed files with 39 additions and 19 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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