commit: 1792d3396dad606e254910619c13b8509998e7e5
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 25 11:08:52 2024 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Aug 6 08:30:12 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1792d339
cargo.eclass: Shadow flag variables so that LTO filtering remains local
This is currently done for Cargo by distutils-r1.eclass. The next commit
will remove that code, leaving cargo_env responsible for it.
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
eclass/cargo.eclass | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 99a7959b22e2..c360c2a6c419 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -549,7 +549,16 @@ cargo_env() {
[[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
die "FATAL: please call cargo_gen_config before using
${FUNCNAME}"
+ # Shadow flag variables so that filtering below remains local.
+ local flag
+ for flag in $(all-flag-vars); do
+ local -x "${flag}=${!flag}"
+ done
+
+ # Rust extensions are incompatible with C/C++ LTO compiler see e.g.
+ # https://bugs.gentoo.org/910220
filter-lto
+
tc-export AR CC CXX PKG_CONFIG
# Set vars for cc-rs crate.