Skip to content

Commit

Permalink
Change build_helper to modify suffix of cc
Browse files Browse the repository at this point in the history
This should help avoid issues when using tools like ccache.
  • Loading branch information
pierzchalski committed Apr 4, 2016
1 parent f92ce2e commit 1e9595e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/build_helper/lib.rs
Expand Up @@ -43,10 +43,16 @@ pub fn cc2ar(cc: &Path, target: &str) -> PathBuf {
if target.contains("musl") || target.contains("msvc") {
PathBuf::from("ar")
} else {
let parent = cc.parent().unwrap();
let file = cc.file_name().unwrap().to_str().unwrap();
cc.parent().unwrap().join(file.replace("gcc", "ar")
.replace("cc", "ar")
.replace("clang", "ar"))
for suffix in &["gcc", "cc", "clang"] {
if let Some(idx) = file.rfind(suffix) {
let mut file = file[..idx].to_owned();
file.push_str(suffix);
return parent.join(&file);
}
}
parent.join(file)
}
}

Expand Down

0 comments on commit 1e9595e

Please sign in to comment.