rust-srpm-macros is a dependency of redhat-rpm-config so that Rust-based
SRPMs can rely on these particular macros. In RHEL 9 and earlier,
rust-srpm-macros was a separate source package which was included in
RHEL. Since then, it became a subpackage of rust-packaging in Fedora.
In order to not pull in any part of rust-packaging into RHEL 10, thereby
allowing it to be maintained separately in EPEL, those macros are
provided here instead.
This updates the RHEL/ELN rust-toolset macros to the state of
macros.rust and macros.cargo from Fedora rust-packaging v24, with
the following exceptions:
* %__cargo_to_rpm, as cargo2rpm is not shipped in RHEL;
* %cargo_registry, %cargo_instdir, and %cargo_generate_buildrequires
which are for building and/or consuming "library" crates which are not
built in RHEL;
* %__cargo_is_{bin,lib} and the is-lib conditional section of
%cargo_install, as they use cargo2rpm, and only "binary" crates are
built in RHEL;
* Dropped RUSTC_BOOTSTRAP and -Z avoid-dev-deps, as they are overly
broad and should not be needed with vendored builds (rust-packaging#23);
* Dropped rustflags that are already set by default (rust-packaging#24).
/usr/bin/rustfmt is linking to an internal rust library and this
results in load errors if rustfmt and rust are at different evrs:
$ rustfmt
rustfmt: error while loading shared libraries: librustc_driver-69c69b1255476b63.so: cannot open shared object file: No such file or directory
$ rpm -q rust rustfmt
rust-1.72.0-1.fc38.x86_64
rustfmt-1.72.1-1.fc38.x86_64
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
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é <berrange@redhat.com>
This supports depending on a variable target using something like
the following since the other target stdlib subpackages are named
by this convention.
BuildRequires: rust-std-static-%{cargo_target}