1 extern crate cc; 2 3 use std::env; 4 5 fn main() { 6 let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"); 7 8 cc::Build::new() 9 .flag("-nostdinc") 10 .flag("-nostdlib") 11 .flag("-I") 12 .flag(&format!("{}/include", crate_dir)) 13 .flag("-fno-stack-protector") 14 .flag("-Wno-expansion-to-defined") 15 .file("src/c/dlmalloc.c") 16 .file("src/c/fcntl.c") 17 .file("src/c/stack_chk.c") 18 .file("src/c/stdio.c") 19 .file("src/c/unistd.c") 20 .compile("relibc_c"); 21 22 println!("cargo:rustc-link-lib=static=relibc_c"); 23 } 24