Allow easy overriding of the opt-level/debuginfo/codegen-units flags

Some crates use debuginfo=0 or debuginfo=1 to reduce memory pressure during
builds. This should make this easy.

Fixes https://pagure.io/fedora-rust/rust2rpm/issue/181
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-02-22 11:41:46 +01:00
parent 0aa82d22b0
commit 1b14d44d57

View file

@ -1,14 +1,18 @@
%__rustc %{_bindir}/rustc
%__rustdoc %{_bindir}/rustdoc
%rustflags_opt_level 3
%rustflags_debuginfo 2
%rustflags_codegen_units 1
# Enable optimization, debuginfo, and link hardening.
%build_rustflags %{shrink:
-Copt-level=3
-Cdebuginfo=2
-Copt-level=%rustflags_opt_level
-Cdebuginfo=%rustflags_debuginfo
-Ccodegen-units=%rustflags_codegen_units
-Clink-arg=-Wl,-z,relro
-Clink-arg=-Wl,-z,now
%{?_package_note_file:-Clink-arg=-Wl,-dT,%{_package_note_file}}
-Ccodegen-units=1
--cap-lints=warn
}