Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RANLIB and ARFLAGS #185

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,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 @@ -336,14 +336,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