From c0134f5bdb0a2501c9fbd2ae63e254ae02b113c3 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 8 Jan 2025 13:18:06 +0300 Subject: [PATCH] AlmaLinux change: Use the correct architecture in x86_64_v2 --- macros.rust-toolset | 2 +- rust.spec | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/macros.rust-toolset b/macros.rust-toolset index 135b3e2..d6a9fd7 100644 --- a/macros.rust-toolset +++ b/macros.rust-toolset @@ -42,6 +42,7 @@ -Cdebuginfo=%rustflags_debuginfo -Ccodegen-units=%rustflags_codegen_units -Cstrip=none + %[0%{?x86_64_v2} ? "-Ctarget_cpu=x86-64-v2" : ""] %{expr:0%{?_include_frame_pointers} && ("%{_arch}" != "ppc64le" && "%{_arch}" != "s390x" && "%{_arch}" != "i386") ? "-Cforce-frame-pointers=yes" : ""} %[0%{?_package_note_status} ? "-Clink-arg=%_package_note_flags" : ""] } @@ -253,4 +254,3 @@ set -euo pipefail\ > cargo-vendor.txt \ }\ ) - diff --git a/rust.spec b/rust.spec index 42f6746..30a7eba 100644 --- a/rust.spec +++ b/rust.spec @@ -186,6 +186,8 @@ Patch100: rustc-1.82.0-disable-libssh2.patch arch = "powerpc64le" elseif arch == "riscv64" then arch = "riscv64gc" + elseif arch == "x86_64_v2" then + arch = "x86_64" end return arch.."-unknown-linux-"..abi end} @@ -751,6 +753,21 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' print(env) end} +%ifarch x86_64_v2 +%global rustc_target_cpus %{lua: do + local fedora = tonumber(rpm.expand("0%{?fedora}")) + local rhel = tonumber(rpm.expand("0%{?rhel}")) + local env = + " RUSTC_TARGET_CPU_X86_64=x86-64-v2" + .. " RUSTC_TARGET_CPU_PPC64LE=" .. ((rhel >= 9) and "pwr9" or "pwr8") + .. " RUSTC_TARGET_CPU_S390X=" .. + ((rhel >= 9) and "z14" or (rhel == 8 or fedora >= 38) and "z13" or + (fedora >= 26) and "zEC12" or (rhel == 7) and "z196" or "z10") + print(env) +end} +%endif + + # Set up shared environment variables for build/install/check. # *_USE_PKG_CONFIG=1 convinces *-sys crates to use the system library. %global rust_env %{shrink: