From 58662257c8186dc4b5f1a8d6d99946e88997e9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 31 Aug 2023 16:08:44 +0100 Subject: [PATCH] add 'x86_64-unknown-none' build target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The coconut-svsm project which provides a low level firmware for AMD SEV-SNP virtual machines uses 'x86_64-unknown-none' as its build target and has recently removed the requirement to use rust nightly[1]. Thus adding 'x86_64-unknown-none' as a build target will enable us to build coconut-svsm in Fedora using the standard Rust toolchain packages. [1] https://github.com/coconut-svsm/svsm/pull/81 Signed-off-by: Daniel P. Berrangé --- rust.spec | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/rust.spec b/rust.spec index f748f4d..74fad24 100644 --- a/rust.spec +++ b/rust.spec @@ -29,6 +29,9 @@ %if 0%{?fedora} || 0%{?rhel} >= 8 %global wasm_targets wasm32-unknown-unknown wasm32-wasi %endif +%if 0%{?fedora} || 0%{?rhel} >= 10 +%global extra_targets x86_64-unknown-none +%endif %endif # We need CRT files for *-wasi targets, at least as new as the commit in @@ -428,6 +431,33 @@ end} %endif +%if %defined extra_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{extra_targets}"), "%S+") do + local subs = { + triple = triple, + name = rpm.expand("%{name}"), + verrel = rpm.expand("%{version}-%{release}"), + } + local s = string.gsub([[ + +%package std-static-{{triple}} +Summary: Standard library for Rust {{triple}} +BuildArch: noarch +Requires: {{name}} = {{verrel}} +Requires: lld >= 8.0 + +%description std-static-{{triple}} +This package includes the standard libraries for building applications +written in Rust for the embedded target {{triple}}. + +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + + %package debugger-common Summary: Common debugger pretty printers for Rust BuildArch: noarch @@ -801,7 +831,7 @@ PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') %{__python3} ./x.py build -j "$ncpus" %{__python3} ./x.py doc -for triple in %{?mingw_targets} %{?wasm_targets}; do +for triple in %{?mingw_targets} %{?wasm_targets} %{?extra_targets}; do %{__python3} ./x.py build --target=$triple std done @@ -813,7 +843,7 @@ done DESTDIR=%{buildroot} %{__python3} ./x.py install -for triple in %{?mingw_targets} %{?wasm_targets}; do +for triple in %{?mingw_targets} %{?wasm_targets} %{?extra_targets}; do DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std done @@ -1013,6 +1043,27 @@ end} end} %endif +%if %defined extra_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{extra_targets}"), "%S+") do + local subs = { + triple = triple, + rustlibdir = rpm.expand("%{rustlibdir}"), + } + local s = string.gsub([[ + +%files std-static-{{triple}} +%dir {{rustlibdir}} +%dir {{rustlibdir}}/{{triple}} +%dir {{rustlibdir}}/{{triple}}/lib +{{rustlibdir}}/{{triple}}/lib/*.rlib + +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + %files debugger-common %dir %{rustlibdir} @@ -1090,6 +1141,7 @@ end} %changelog * Mon Sep 25 2023 Josh Stone - 1.72.1-2 - Fix LLVM dependency for ELN +- Add build target for x86_64-unknown-none * Tue Sep 19 2023 Josh Stone - 1.72.1-1 - Update to 1.72.1.