Change build_helper to modify suffix of cc
This should help avoid issues when using tools like ccache.
This commit is contained in:
parent
f92ce2e9fe
commit
1e9595e116
1 changed files with 9 additions and 3 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue