You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.0 KiB
62 lines
2.0 KiB
From 0131b4e28aca1e036d1d089a17553d6378657e07 Mon Sep 17 00:00:00 2001
|
|
From: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
|
Date: Feb 15 2022 09:59:42 +0000
|
|
Subject: Include linker flags for package note in %build_rustflags
|
|
|
|
|
|
%build_rustflags was used in %cargo_prep, which is executed in %prep,
|
|
when %buildsubdir is not set yet. To avoid this, insertion of flags is
|
|
moved to an environment variable that is set for %cargo_build and
|
|
%cargo_test.
|
|
|
|
The linker flag gets passed to rustc, and resulting binaries seem to have
|
|
note as expected.
|
|
|
|
---
|
|
|
|
diff --git a/data/macros.cargo b/data/macros.cargo
|
|
index 07fcb56..05f5eb2 100644
|
|
--- a/data/macros.cargo
|
|
+++ b/data/macros.cargo
|
|
@@ -4,7 +4,7 @@
|
|
# it never writes to ~/.cargo during rpmbuild.
|
|
# We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps
|
|
# until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133
|
|
-%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo
|
|
+%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' %{_bindir}/cargo
|
|
%__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps
|
|
%__cargo_inspector %{_bindir}/cargo-inspector
|
|
|
|
@@ -20,7 +20,6 @@ cat > .cargo/config << EOF \
|
|
[build]\
|
|
rustc = "%{__rustc}"\
|
|
rustdoc = "%{__rustdoc}"\
|
|
-rustflags = %{__global_rustflags_toml}\
|
|
\
|
|
[env]\
|
|
CFLAGS = "%{build_cflags}"\
|
|
@@ -61,6 +60,7 @@ EOF\
|
|
|
|
%cargo_build(naf:) \
|
|
%{shrink:\
|
|
+ RUSTFLAGS='%{build_rustflags}' \
|
|
%{__cargo} build \
|
|
%{__cargo_common_opts} \
|
|
--release \
|
|
diff --git a/data/macros.rust b/data/macros.rust
|
|
index 7377f92..0940d06 100644
|
|
--- a/data/macros.rust
|
|
+++ b/data/macros.rust
|
|
@@ -5,7 +5,9 @@
|
|
%build_rustflags %{shrink:
|
|
-Copt-level=3
|
|
-Cdebuginfo=2
|
|
- -Clink-arg=-Wl,-z,relro,-z,now
|
|
+ -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
|
|
}
|
|
|