-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.rs
26 lines (22 loc) · 887 Bytes
/
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
use std::process::Command;
use std::path::Path;
use std::env;
fn main() {
let sdrad_srcdir = Path::new("./secure-rewind-and-discard/src");
let output_prefix = env::var("OUT_DIR").unwrap();
let libsdrad_path = Path::new(&output_prefix);
let original_ld_library_path = env::var("LD_LIBRARY_PATH").unwrap_or_default();
Command::new("git")
.args(&["checkout", "sdrad_ffi"])
.current_dir("./secure-rewind-and-discard/")
.status()
.unwrap();
Command::new("sh")
.arg("-c")
.arg("make")
.env("OUTPUT_PREFIX", &output_prefix)
.current_dir(&sdrad_srcdir)
.status().unwrap();
println!(r"cargo:rustc-link-search={}", &libsdrad_path.display());
println!(r"cargo:rustc-env=LD_LIBRARY_PATH={}:{}", &libsdrad_path.display(), &original_ld_library_path);
}