use std::path::PathBuf; fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rustc-link-lib=isal"); #[cfg(feature = "regenerate-bindings")] { let out = PathBuf::from(&(format!("{}/igzip_lib.rs", std::env::var("OUT_DIR").unwrap()))); bindgen::Builder::default() // The input header we would like to generate // bindings for. .header("/usr/include/isa-l/igzip_lib.h") // Tell cargo to invalidate the built crate whenever any of the // included header files changed. .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) .blocklist_type("__uint64_t_") .blocklist_type("__size_t") // Replaced by libc::FILE .blocklist_type("FILE") .blocklist_type("_IO_FILE") .blocklist_type("_IO_codecvt") .blocklist_type("_IO_wide_data") .blocklist_type("_IO_marker") .blocklist_type("_IO_lock_t") // Replaced by i64 .blocklist_type("LARGE_INTEGER") // Replaced by libc::timespec .blocklist_type("timespec") // etc .blocklist_type("__time_t") .blocklist_type("__syscall_slong_t") // .blocklist_type("__off64_t") .blocklist_type("__off_t") .size_t_is_usize(true) .generate() .expect("Unable to generate bindings") .write_to_file(out) .unwrap(); } }