-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.rs
41 lines (36 loc) · 1.05 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use std::env;
use std::fs;
use std::path::PathBuf;
use std::process::{Command, Stdio};
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let outdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let build_dir = outdir.join("build");
let _ = fs::remove_dir_all(&build_dir);
fs::create_dir(&build_dir).unwrap();
for file in &[
"install_deps.sh",
"liberasurecode.patch",
"for_darwin_to_detect_compiler_flag.patch",
] {
fs::copy(file, build_dir.join(file)).unwrap();
}
match Command::new("./install_deps.sh")
.current_dir(&build_dir)
.stderr(Stdio::inherit())
.output()
{
Err(e) => {
panic!("{}: {}", build_dir.display(), e);
}
Ok(output) => {
if !output.status.success() {
panic!(
"./install_deps.sh failed: exit-code={:?}",
output.status.code()
);
}
}
}
println!("cargo:rustc-link-search={}/lib", build_dir.display());
}