Skip to content

Commit

Permalink
Default to staticlib-only on platform known to not support cdylib
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Feb 18, 2021
1 parent 14951bb commit 736a842
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,13 @@ pub fn cbuild(
};

let rustc_target = target::Target::new(target.as_ref())?;
let libkinds = args
.values_of("library-type")
.map_or_else(|| vec!["staticlib", "cdylib"], |v| v.collect::<Vec<_>>());
let libkinds = args.values_of("library-type").map_or_else(
|| match (rustc_target.os.as_str(), rustc_target.env.as_str()) {
("none", _) | (_, "musl") => vec!["staticlib"],
_ => vec!["staticlib", "cdylib"],
},
|v| v.collect::<Vec<_>>(),
);
let only_staticlib = !libkinds.contains(&"cdylib");

let name = &ws
Expand Down

0 comments on commit 736a842

Please sign in to comment.