From 3bdeefd84dcfe737c1f4db730228e4bf6160cea1 Mon Sep 17 00:00:00 2001 From: Johannes Nixdorf Date: Sun, 1 Apr 2018 10:32:08 +0200 Subject: [PATCH] Pass -static depending on crt-static on linux too. This is the done the same way as it's already done for msvc. --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7b8b831..c3a847a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1106,8 +1106,11 @@ impl Build { cmd.args.push("-m64".into()); } - if self.static_flag.is_none() && target.contains("musl") { - cmd.args.push("-static".into()); + if self.static_flag.is_none() { + let features = env::var("CARGO_CFG_TARGET_FEATURE").unwrap_or(String::new()); + if features.contains("crt-static") { + cmd.args.push("-static".into()); + } } // armv7 targets get to use armv7 instructions