Skip to content

Commit 3243683

Browse files
authored
Merge pull request #632 from vlovich/fix-windows-builds
Fix builds for cross-compilation with mingw
2 parents f35ccf7 + 32628f1 commit 3243683

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llama-cpp-sys-2/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ fn extract_lib_names(out_dir: &Path, build_shared_libs: bool) -> Vec<String> {
8080
let lib_name = if stem_str.starts_with("lib") {
8181
stem_str.strip_prefix("lib").unwrap_or(stem_str)
8282
} else {
83+
if path.extension() == Some(std::ffi::OsStr::new("a")) {
84+
// panic!("renaming {:?} to {:?}", &path, path.join(format!("lib{}.a", stem_str)));
85+
let target = path.parent().unwrap().join(format!("lib{}.a", stem_str));
86+
std::fs::rename(&path, &target).unwrap_or_else(|e| {
87+
panic!("Failed to rename {path:?} to {target:?}: {e:?}");
88+
})
89+
}
8390
stem_str
8491
};
8592
lib_names.push(lib_name.to_string());

0 commit comments

Comments
 (0)