From 74e6cf2916a15909203760da456beb7c0d7c13f0 Mon Sep 17 00:00:00 2001 From: Chris Nixon Date: Thu, 1 Apr 2021 23:32:01 +0100 Subject: [PATCH] Don't try to use ureq on musl targets --- build/Cargo.toml | 3 +++ build/src/lib.rs | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/build/Cargo.toml b/build/Cargo.toml index 997ae113..c0d0c837 100644 --- a/build/Cargo.toml +++ b/build/Cargo.toml @@ -10,4 +10,7 @@ repository = "https://github.com/napi-rs/napi-rs" version = "1.0.1" [dependencies] +cfg-if = "1" + +[target.'cfg(not(target_env = "musl"))'.dependencies] ureq = "2" diff --git a/build/src/lib.rs b/build/src/lib.rs index 72046f9d..7a4e51b1 100644 --- a/build/src/lib.rs +++ b/build/src/lib.rs @@ -1,10 +1,23 @@ mod macos; -mod windows; + +cfg_if::cfg_if! { + if #[cfg(not(target_env = "musl"))] { + mod windows; + } +} pub fn setup() { match std::env::var("CARGO_CFG_TARGET_OS").as_deref() { Ok("macos") => macos::setup(), - Ok("windows") => windows::setup(), + Ok("windows") => { + cfg_if::cfg_if! { + if #[cfg(not(target_env = "musl"))] { + windows::setup() + } else { + eprintln!("Cross compiling to windows-msvc is not supported from *-musl hosts") + } + } + } _ => {} } }