use std::env;
use std::fs::File;
use std::path::Path;
use cc;
fn main() {
cc::Build::new()
.file("src/context/context_asm.S")
.compile("context_context_asm");
cc::Build::new()
.file("src/instance/siginfo_ext.c")
.compile("instance_siginfo_ext");
cc::Build::new()
.file("src/context/tests/c_child.c")
.compile("context_tests_c_child");
let commit_file_path = Path::new(&env::var("OUT_DIR").unwrap()).join("commit_hash");
#[allow(unused_variables, unused_mut)]
let mut f = File::create(&commit_file_path).unwrap();
#[cfg(not(debug_assertions))]
{
use std::io::Write;
use std::process::Command;
let last_commit_hash = Command::new("git")
.args(&["log", "-n", "1", "--pretty=format:%H"])
.output()
.ok();
if let Some(last_commit_hash) = last_commit_hash {
f.write_all(&last_commit_hash.stdout).unwrap();
}
}
}