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

Correctly infer ranlib/ar from cross-gcc #163

Merged
merged 1 commit into from
Oct 26, 2022
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
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,16 @@ impl Build {
configure.env_remove("CROSS_COMPILE");

// Infer ar/ranlib tools from cross compilers if the it looks like
// we're doing something like `foo-gcc` route that to `foo-ranlib`
// we're doing something like `foo-gcc` route that to `foo-gcc-ranlib`
// as well.
if path.ends_with("-gcc") && !target.contains("unknown-linux-musl") {
let path = &path[..path.len() - 4];
let suffix = &path[path.len() - 4..];
let path = &path[..path.len() - suffix.len()];
if env::var_os("RANLIB").is_none() {
configure.env("RANLIB", format!("{}-ranlib", path));
configure.env("RANLIB", format!("{}{}-ranlib", path, suffix));
}
if env::var_os("AR").is_none() {
configure.env("AR", format!("{}-ar", path));
configure.env("AR", format!("{}{}-ar", path, suffix));
}
}

Expand Down