Compare commits

...

1 Commits

2 changed files with 11 additions and 1 deletions

View File

@ -14,3 +14,5 @@ links = "whisper"
[build-dependencies]
bindgen = "0.64"
tempfile = "3.3.0"
dircpy = "0.3.14"

View File

@ -57,8 +57,16 @@ fn main() {
return;
}
// copy sources to a temporary directory: in some build systems, the source repo can be read-only
// and the makefile compiles files in-place.
let temp_build_dir = tempfile::tempdir().expect("failed to acquire temporary directory");
dircpy::CopyBuilder::new("whisper.cpp", &temp_build_dir)
.with_exclude_filter(".git")
.run()
.expect("could not copy whisper.cpp to temporary directory");
// build libwhisper.a
env::set_current_dir("whisper.cpp").expect("Unable to change directory");
env::set_current_dir(&temp_build_dir).expect("Unable to change directory");
let code = std::process::Command::new("make")
.arg("libwhisper.a")
.status()