void-packages/srcpkgs/python3-setuptools-rust/patches/preserve_rustflags.patch

28 lines
1009 B
Diff

From cbd30fda8c6f7cc0d304728413f2cbf488da096b Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 8 Feb 2021 12:58:58 -0500
Subject: [PATCH] Augment, rather than replace, existing RUSTFLAGS when
building
Some complex environments, like Void's cross-compilation environment,
use RUSTFLAGS to control the behavior of rust compilation. Rather than
overwriting RUSTFLAGS with custom flags, augment any existing RUSTFLAGS
to preserve these environments.
---
setuptools_rust/build.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git setuptools_rust/build.py setuptools_rust/build.py
index 40d8e42..60eddfa 100644
--- setuptools_rust/build.py
+++ setuptools_rust/build.py
@@ -186,7 +186,7 @@ def build_extension(self, ext):
rustflags += " -C target-cpu=native"
if rustflags:
- env["RUSTFLAGS"] = rustflags
+ env["RUSTFLAGS"] = (env.get("RUSTFLAGS", "") + " " + rustflags).strip()
# Execute cargo
try: