parent
9490476bd1
commit
e8c3341575
@ -1,34 +0,0 @@
|
||||
From f1be3a0d4d2df6497d46f627cc54ce8450da8699 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksei Bavshin <alebastr@fedoraproject.org>
|
||||
Date: Dec 06 2021 06:20:52 +0000
|
||||
Subject: macros: pass CFLAGS/CXXFLAGS to the processes started by cargo
|
||||
|
||||
|
||||
This is mainly targeted to the crates using `rust-cc`, where we want to
|
||||
apply system-wide compiler flags when invoking the compiler. `cc`
|
||||
supports CFLAGS and CXXFLAGS, but we never set those.
|
||||
Defining that per project is not possible, as we have no way to inherit
|
||||
any build context from a dependency package.
|
||||
|
||||
Possibly also affects: `bindgen`, `cxx`, any other crate that invokes
|
||||
the C/C++ compiler and passes the CFLAGSS
|
||||
|
||||
---
|
||||
|
||||
diff --git a/data/macros.cargo b/data/macros.cargo
|
||||
index 0a68998..07fcb56 100644
|
||||
--- a/data/macros.cargo
|
||||
+++ b/data/macros.cargo
|
||||
@@ -22,6 +22,11 @@ rustc = "%{__rustc}"\
|
||||
rustdoc = "%{__rustdoc}"\
|
||||
rustflags = %{__global_rustflags_toml}\
|
||||
\
|
||||
+[env]\
|
||||
+CFLAGS = "%{build_cflags}"\
|
||||
+CXXFLAGS = "%{build_cxxflags}"\
|
||||
+LDFLAGS = "%{build_ldflags}"\
|
||||
+\
|
||||
[install]\
|
||||
root = "%{buildroot}%{_prefix}"\
|
||||
\
|
||||
|
@ -1,61 +0,0 @@
|
||||
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
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
SHA512 (rust2rpm-v20.tar.gz) = f29a443b61690c71b023ce9d9536ca05099fdd9c51ccca921dd75fc578d6213b095b5becdeb85040fb073f9a59610553091345c34ce2bde4514689b303c951b1
|
||||
SHA512 (rust2rpm-v21.tar.gz) = 50864eea0025d1c6d681e5e618f7e7dfe3aab576ec722134e07089459d73cb954e5886409578de7dd7d1a05dfbe7cc034af5f2b4d4e27db3310b0e0a2170869e
|
||||
|
Loading…
Reference in new issue