From 3cd30acc77c6a000c497751eb06b21f7c566c820 Mon Sep 17 00:00:00 2001 From: wk333 <13474090681@163.com> Date: Mon, 17 Feb 2025 10:16:21 +0800 Subject: [PATCH] Switch to unbundled llvm for x86_64 aarch64 building (cherry picked from commit 6ed6ec6250d82b3f0b51aea636968cec9808f358) --- rust.spec | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/rust.spec b/rust.spec index e24b742..02eba95 100644 --- a/rust.spec +++ b/rust.spec @@ -5,7 +5,11 @@ %global bootstrap_date 2024-11-28 %global bootstrap_arches x86_64 aarch64 riscv64 loongarch64 %bcond_with llvm_static +%ifarch x86_64 aarch64 +%bcond_with bundled_llvm +%else %bcond_without bundled_llvm +%endif %bcond_without bundled_libgit2 %bcond_with disabled_libssh2 %bcond_without lldb @@ -23,7 +27,7 @@ Name: rust Version: 1.84.0 -Release: 1 +Release: 2 Summary: The Rust Programming Language License: Apache-2.0 OR MIT URL: https://www.rust-lang.org @@ -120,9 +124,15 @@ BuildRequires: cmake >= 2.8.11 %if %defined llvm %global llvm_root %{_libdir}/%{llvm} %else -# default llvm is decent enough on riscv64 +%ifarch x86_64 aarch64 +%global llvm llvm-toolset-18-llvm +%global llvm_root /opt/openEuler/llvm-toolset-18/root%{_prefix} +%global clang_maj_ver 18 +%else %global llvm llvm %global llvm_root %{_prefix} +%global clang_maj_ver 17 +%endif %endif # Minimum external LLVM for rust 1.82 BuildRequires: %{llvm} >= 17.0.0 @@ -133,8 +143,13 @@ BuildRequires: %{llvm}-static libffi-devel %endif BuildRequires: procps-ng BuildRequires: ninja-build +%ifarch x86_64 aarch64 +BuildRequires: llvm-toolset-18-compiler-rt +BuildRequires: llvm-toolset-18-clang +%else BuildRequires: compiler-rt BuildRequires: clang +%endif Provides: rustc = %{version}-%{release} Provides: rustc%{?_isa} = %{version}-%{release} Requires: %{name}-std-static%{?_isa} = %{version}-%{release} @@ -344,10 +359,9 @@ fi %ifarch ppc64le %global _arch powerpc64le %endif -%global clang_maj_ver 17 %if %{?clang_maj_ver} >= 17 # This is the new one, used on openEuler 24.03 LTS or later -%define profiler %(echo %{_prefix}/%{_lib}/clang/%{clang_maj_ver}/lib/%{_arch}-%{_vendor}-linux-gnu/libclang_rt.profile.a) +%define profiler %(echo %{llvm_root}/%{_lib}/clang/%{clang_maj_ver}/lib/%{_arch}-%{_vendor}-linux-gnu/libclang_rt.profile.a) %else # This is used before openEuler 23.09 %global clang_full_ver %%(clang --version | awk '/clang version/{print $3}') @@ -545,6 +559,9 @@ export %{rust_env} %{_mandir}/man1/cargo*.1* %changelog +* Mon Feb 17 2025 wangkai <13474090681@163.com> - 1.84.0-2 +- Switch to unbundled llvm for x86_64 aarch64 building + * Wed Jan 15 2025 wangkai <13474090681@163.com> - 1.84.0-1 - Update to 1.84.0 -- Gitee