Skip to content

Commit

Permalink
Fix RANLIB and ARFLAGS (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss authored and alexcrichton committed Mar 20, 2023
1 parent 50efcde commit fdc5658
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl Build {

let ar = cc.get_archiver();
configure.env("AR", ar.get_program());
if ar.get_args().count() == 0 {
if ar.get_args().count() != 0 {
// On some platforms (like emscripten on windows), the ar to use may not be a
// single binary, but instead a multi-argument command like `cmd /c emar.bar`.
// We can't convey that through `AR` alone, and so also need to set ARFLAGS.
Expand All @@ -358,14 +358,10 @@ impl Build {
);
}
let ranlib = cc.get_ranlib();
configure.env("RANLIB", ranlib.get_program());
if ranlib.get_args().count() == 0 {
// Same thing as for AR -- we may need to set RANLIBFLAGS
configure.env(
"RANLIBFLAGS",
ranlib.get_args().collect::<Vec<_>>().join(OsStr::new(" ")),
);
}
// OpenSSL does not support RANLIBFLAGS. Jam the flags in RANLIB.
let mut args = vec![ranlib.get_program()];
args.extend(ranlib.get_args());
configure.env("RANLIB", args.join(OsStr::new(" ")));

// Make sure we pass extra flags like `-ffunction-sections` and
// other things like ARM codegen flags.
Expand Down

0 comments on commit fdc5658

Please sign in to comment.