From 7e34a3279d0f420d56a32f3fc4ab904be88da275 Mon Sep 17 00:00:00 2001 From: konstin Date: Thu, 18 Feb 2021 23:21:40 +0100 Subject: [PATCH] Use RUSTFLAGS again to fix #427 For some reason, this argument --- Changelog.md | 16 ++++++---------- src/compile.rs | 8 ++++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Changelog.md b/Changelog.md index de037beb2..329fbf3fb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,14 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (for the cli, not for the crate). -## 0.9.2 - 2021-02-17 - - * Escape version in wheel metadata by messense in [#420](https://github.com/PyO3/maturin/pull/420) - * Set executable bit on shared library by messense in [#421](https://github.com/PyO3/maturin/pull/421) - * Rename `classifier` to `classifiers` for pypi compatibility. The old `classifier` is still available and now also works with pypi - * Fix building for musl by automatically setting `-C target-feature=-crt-static` - -## 0.9.4 +## 0.9.4 - 2021-02-18 * Fix building a bin with musl @@ -20,9 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * CI failure -## 0.9.2 +## 0.9.2 - 2021-02-17 -* CI failure + * Escape version in wheel metadata by messense in [#420](https://github.com/PyO3/maturin/pull/420) + * Set executable bit on shared library by messense in [#421](https://github.com/PyO3/maturin/pull/421) + * Rename `classifier` to `classifiers` for pypi compatibility. The old `classifier` is still available and now also works with pypi + * Fix building for musl by automatically setting `-C target-feature=-crt-static` ## 0.9.1 - 2021-01-13 diff --git a/src/compile.rs b/src/compile.rs index 720bc6b0c..c426f2b92 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -113,6 +113,8 @@ fn compile_target( .map(String::as_str) .collect(); + let mut rust_flags = env::var_os("RUSTFLAGS").unwrap_or_default(); + // We need to pass --bins / --lib to set the rustc extra args later // TODO: What do we do when there are multiple bin targets? match bindings_crate { @@ -121,8 +123,9 @@ fn compile_target( shared_args.push("--lib"); // https://github.com/rust-lang/rust/issues/59302#issue-422994250 // We must only do this for libraries as it breaks binaries + // For some reason this value is ignored when passed as rustc argument if context.target.is_musl_target() { - rustc_args.extend(&["-C", "target-feature=-crt-static"]); + rust_flags.push(" -C target-feature=-crt-static"); } } } @@ -168,12 +171,9 @@ fn compile_target( .iter() .fold("cargo".to_string(), |acc, x| acc + " " + x); - let rust_flags = env::var_os("RUSTFLAGS").unwrap_or_default(); - let mut let_binding = Command::new("cargo"); let build_command = let_binding .args(&build_args) - .env("RUSTFLAGS", rust_flags) // We need to capture the json messages .stdout(Stdio::piped()) // We can't get colored human and json messages from rustc as they are mutually exclusive,