commit:     ecbd50481557ed916cd5f68d21acd2404d54fc24
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  2 22:42:23 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 08:54:21 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ecbd5048

sys-devel/llvm: Fix cross-compiling by applying the build environment

When you cross-compile LLVM, it invokes CMake a second time during src_compile
to perform a "native" build. This invocation does not make use of a toolchain
file and relies on environment variables such as CC and CXX to determine the
compiler instead. These will often point to the cross-compiler rather than the
native/build compiler, leading to a failure when it tries to link the build
system's libzstd. The toolchain file provided in src_configure sets up the
cross-compiler as necessary, so there is no harm in pointing CC and friends to
the native/build compiler during src_compile.

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

 sys-devel/llvm/llvm-15.0.6.9999.ebuild        | 2 +-
 sys-devel/llvm/llvm-15.0.6.ebuild             | 2 +-
 sys-devel/llvm/llvm-16.0.0.9999.ebuild        | 2 +-
 sys-devel/llvm/llvm-16.0.0_pre20221217.ebuild | 2 +-
 sys-devel/llvm/llvm-16.0.0_pre20221226.ebuild | 2 +-
 sys-devel/llvm/llvm-16.0.0_pre20230101.ebuild | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys-devel/llvm/llvm-15.0.6.9999.ebuild 
b/sys-devel/llvm/llvm-15.0.6.9999.ebuild
index 8f078936032b..da0c1604bb7f 100644
--- a/sys-devel/llvm/llvm-15.0.6.9999.ebuild
+++ b/sys-devel/llvm/llvm-15.0.6.9999.ebuild
@@ -452,7 +452,7 @@ multilib_src_configure() {
 }
 
 multilib_src_compile() {
-       cmake_build distribution
+       tc-env_build cmake_build distribution
 
        pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
        pax-mark m "${BUILD_DIR}"/bin/lli

diff --git a/sys-devel/llvm/llvm-15.0.6.ebuild 
b/sys-devel/llvm/llvm-15.0.6.ebuild
index a0f90b636940..ea6bf123f308 100644
--- a/sys-devel/llvm/llvm-15.0.6.ebuild
+++ b/sys-devel/llvm/llvm-15.0.6.ebuild
@@ -452,7 +452,7 @@ multilib_src_configure() {
 }
 
 multilib_src_compile() {
-       cmake_build distribution
+       tc-env_build cmake_build distribution
 
        pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
        pax-mark m "${BUILD_DIR}"/bin/lli

diff --git a/sys-devel/llvm/llvm-16.0.0.9999.ebuild 
b/sys-devel/llvm/llvm-16.0.0.9999.ebuild
index 5f54f11fe7fe..38faaf5b1adf 100644
--- a/sys-devel/llvm/llvm-16.0.0.9999.ebuild
+++ b/sys-devel/llvm/llvm-16.0.0.9999.ebuild
@@ -455,7 +455,7 @@ multilib_src_configure() {
 }
 
 multilib_src_compile() {
-       cmake_build distribution
+       tc-env_build cmake_build distribution
 
        pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
        pax-mark m "${BUILD_DIR}"/bin/lli

diff --git a/sys-devel/llvm/llvm-16.0.0_pre20221217.ebuild 
b/sys-devel/llvm/llvm-16.0.0_pre20221217.ebuild
index 9b5f96110a1f..9a91d21695fd 100644
--- a/sys-devel/llvm/llvm-16.0.0_pre20221217.ebuild
+++ b/sys-devel/llvm/llvm-16.0.0_pre20221217.ebuild
@@ -455,7 +455,7 @@ multilib_src_configure() {
 }
 
 multilib_src_compile() {
-       cmake_build distribution
+       tc-env_build cmake_build distribution
 
        pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
        pax-mark m "${BUILD_DIR}"/bin/lli

diff --git a/sys-devel/llvm/llvm-16.0.0_pre20221226.ebuild 
b/sys-devel/llvm/llvm-16.0.0_pre20221226.ebuild
index 9b5f96110a1f..9a91d21695fd 100644
--- a/sys-devel/llvm/llvm-16.0.0_pre20221226.ebuild
+++ b/sys-devel/llvm/llvm-16.0.0_pre20221226.ebuild
@@ -455,7 +455,7 @@ multilib_src_configure() {
 }
 
 multilib_src_compile() {
-       cmake_build distribution
+       tc-env_build cmake_build distribution
 
        pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
        pax-mark m "${BUILD_DIR}"/bin/lli

diff --git a/sys-devel/llvm/llvm-16.0.0_pre20230101.ebuild 
b/sys-devel/llvm/llvm-16.0.0_pre20230101.ebuild
index ecc7df9944c0..4798e7ef1858 100644
--- a/sys-devel/llvm/llvm-16.0.0_pre20230101.ebuild
+++ b/sys-devel/llvm/llvm-16.0.0_pre20230101.ebuild
@@ -455,7 +455,7 @@ multilib_src_configure() {
 }
 
 multilib_src_compile() {
-       cmake_build distribution
+       tc-env_build cmake_build distribution
 
        pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
        pax-mark m "${BUILD_DIR}"/bin/lli

Reply via email to