Skip to content

Commit

Permalink
Continue to support binutils ar
Browse files Browse the repository at this point in the history
sfackler [observed] that the `binutils` package [provides] binaries
named `$target-ar` (with no `-gcc`). This patch augments the change made
in #735 to continue picking those up too.

[observed]: alexcrichton/openssl-src-rs#163 (comment)
[provides]: https://packages.debian.org/bullseye/amd64/binutils-aarch64-linux-gnu/filelist
  • Loading branch information
Jon Gjengset authored and thomcc committed Oct 26, 2022
1 parent 76c821e commit 00befe7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2605,12 +2605,17 @@ impl Build {
} else if self.get_host()? != target {
match self.prefix_for_target(&target) {
Some(p) => {
let target_ar = format!("{}-gcc-ar", p);
if Command::new(&target_ar).output().is_ok() {
target_ar
} else {
default_ar
// GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both.
// Prefer -gcc-ar if it exists, since that matches what we'll use for $CC.
let mut ar = default_ar;
for &infix in &["-gcc", ""] {
let target_ar = format!("{}{}-ar", p, infix);
if Command::new(&target_ar).output().is_ok() {
ar = target_ar;
break;
}
}
ar
}
None => default_ar,
}
Expand Down

0 comments on commit 00befe7

Please sign in to comment.