Fix build of sys crate when source directory is read-only
This commit is contained in:
parent
1a02c60f52
commit
230aa88986
|
@ -14,3 +14,5 @@ links = "whisper"
|
|||
|
||||
[build-dependencies]
|
||||
bindgen = "0.64"
|
||||
tempfile = "3.3.0"
|
||||
dircpy = "0.3.14"
|
||||
|
|
10
sys/build.rs
10
sys/build.rs
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue