Skip to content

Choose AR args by program name instead of target #668

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

Closed
wants to merge 1 commit into from
Closed
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: 6 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,10 +1991,10 @@ impl Build {
}

fn assemble_progressive(&self, dst: &Path, objs: &[PathBuf]) -> Result<(), Error> {
let target = self.get_target()?;
let (mut cmd, program) = self.get_ar()?;

if target.contains("msvc") {
let (mut cmd, program) = self.get_ar()?;
// `get_ar()` will never return "lib" or such
if program.eq_ignore_ascii_case("lib.exe") {
let mut out = OsString::from("-out:");
out.push(dst);
cmd.arg(out).arg("-nologo");
Expand All @@ -2009,8 +2009,6 @@ impl Build {
cmd.args(objs);
run(&mut cmd, &program)?;
} else {
let (mut ar, cmd) = self.get_ar()?;

// Set an environment variable to tell the OSX archiver to ensure
// that all dates listed in the archive are zero, improving
// determinism of builds. AFAIK there's not really official
Expand All @@ -2033,11 +2031,11 @@ impl Build {
//
// In any case if this doesn't end up getting read, it shouldn't
// cause that many issues!
ar.env("ZERO_AR_DATE", "1");
cmd.env("ZERO_AR_DATE", "1");
for flag in self.ar_flags.iter() {
ar.arg(flag);
cmd.arg(flag);
}
run(ar.arg("cq").arg(dst).args(objs), &cmd)?;
run(cmd.arg("cq").arg(dst).args(objs), &program)?;
}

Ok(())
Expand Down