commit:     94e2375d8bbaa777c83a3bffd60355075ee6ff83
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Sun Jan 19 03:51:26 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  6 00:17:41 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94e2375d

dev-lang/rust: set experimental-targets according to USE

apply patch in commit 3d841904ebfe01e74cb01eae6456b30f6aeca7e8
which is submitted before rust-1.84.0

Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40200
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/rust/rust-1.84.0.ebuild | 13 ++++++++++++-
 dev-lang/rust/rust-1.84.1.ebuild | 13 ++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dev-lang/rust/rust-1.84.0.ebuild b/dev-lang/rust/rust-1.84.0.ebuild
index f07d34111b3e..e40d98a96166 100644
--- a/dev-lang/rust/rust-1.84.0.ebuild
+++ b/dev-lang/rust/rust-1.84.0.ebuild
@@ -39,6 +39,9 @@ ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY 
DirectX Hexagon Lanai
 ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
 LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?}
 
+# 
https://github.com/rust-lang/llvm-project/blob/rustc-1.84.0/llvm/CMakeLists.txt
+ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC CSKY DirectX M68k SPIRV Xtensa )
+
 LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
 SLOT="${PV}"
 
@@ -269,6 +272,14 @@ src_configure() {
        rust_build="$(rust_abi "${CBUILD}")"
        rust_host="$(rust_abi "${CHOST}")"
 
+       LLVM_EXPERIMENTAL_TARGETS=()
+       for _x in "${ALL_LLVM_EXPERIMENTAL_TARGETS[@]}"; do
+               if use llvm_targets_${_x} ; then
+                       LLVM_EXPERIMENTAL_TARGETS+=( ${_x} )
+               fi
+       done
+       LLVM_EXPERIMENTAL_TARGETS=${LLVM_EXPERIMENTAL_TARGETS[@]}
+
        local cm_btype="$(usex debug DEBUG RELEASE)"
        cat <<- _EOF_ > "${S}"/config.toml
                # https://github.com/rust-lang/rust/issues/135358 (bug #947897)
@@ -280,7 +291,7 @@ src_configure() {
                assertions = $(toml_usex debug)
                ninja = true
                targets = "${LLVM_TARGETS// /;}"
-               experimental-targets = ""
+               experimental-targets = "${LLVM_EXPERIMENTAL_TARGETS// /;}"
                link-shared = $(toml_usex system-llvm)
                $(if is_libcxx_linked; then
                        # https://bugs.gentoo.org/732632

diff --git a/dev-lang/rust/rust-1.84.1.ebuild b/dev-lang/rust/rust-1.84.1.ebuild
index 7f9acdb9a801..12a8d60e406a 100644
--- a/dev-lang/rust/rust-1.84.1.ebuild
+++ b/dev-lang/rust/rust-1.84.1.ebuild
@@ -39,6 +39,9 @@ ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY 
DirectX Hexagon Lanai
 ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
 LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?}
 
+# 
https://github.com/rust-lang/llvm-project/blob/rustc-1.84.0/llvm/CMakeLists.txt
+ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC CSKY DirectX M68k SPIRV Xtensa )
+
 LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
 SLOT="${PV}"
 
@@ -269,6 +272,14 @@ src_configure() {
        rust_build="$(rust_abi "${CBUILD}")"
        rust_host="$(rust_abi "${CHOST}")"
 
+       LLVM_EXPERIMENTAL_TARGETS=()
+       for _x in "${ALL_LLVM_EXPERIMENTAL_TARGETS[@]}"; do
+               if use llvm_targets_${_x} ; then
+                       LLVM_EXPERIMENTAL_TARGETS+=( ${_x} )
+               fi
+       done
+       LLVM_EXPERIMENTAL_TARGETS=${LLVM_EXPERIMENTAL_TARGETS[@]}
+
        local cm_btype="$(usex debug DEBUG RELEASE)"
        cat <<- _EOF_ > "${S}"/config.toml
                # https://github.com/rust-lang/rust/issues/135358 (bug #947897)
@@ -280,7 +291,7 @@ src_configure() {
                assertions = $(toml_usex debug)
                ninja = true
                targets = "${LLVM_TARGETS// /;}"
-               experimental-targets = ""
+               experimental-targets = "${LLVM_EXPERIMENTAL_TARGETS// /;}"
                link-shared = $(toml_usex system-llvm)
                $(if is_libcxx_linked; then
                        # https://bugs.gentoo.org/732632

Reply via email to