Don't try to use ureq on musl targets

This commit is contained in:
Chris Nixon 2021-04-01 23:32:01 +01:00
parent 03e6048dc9
commit 74e6cf2916
No known key found for this signature in database
GPG key ID: 6F4189ED88C00543
2 changed files with 18 additions and 2 deletions

View file

@ -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"

View file

@ -1,10 +1,23 @@
mod macos;
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")
}
}
}
_ => {}
}
}