| 1 |
use std::path::PathBuf; |
| 2 |
|
| 3 |
fn main() { |
| 4 |
println!("cargo:rerun-if-changed=build.rs"); |
| 5 |
|
| •6 |
println!("cargo:rustc-link-lib=isal"); |
| 7 |
|
| 8 |
#[cfg(feature = "regenerate-bindings")] |
| 9 |
{ |
| 10 |
let out = PathBuf::from(&(format!("{}/igzip_lib.rs", std::env::var("OUT_DIR").unwrap()))); |
| 11 |
bindgen::Builder::default() |
| 12 |
// The input header we would like to generate |
| 13 |
// bindings for. |
| •14 |
.header("/usr/include/isa-l/igzip_lib.h") |
| 15 |
// Tell cargo to invalidate the built crate whenever any of the |
| 16 |
// included header files changed. |
| 17 |
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) |
| 18 |
.blocklist_type("__uint64_t_") |
| 19 |
.blocklist_type("__size_t") |
| 20 |
// Replaced by libc::FILE |
| 21 |
.blocklist_type("FILE") |
| 22 |
.blocklist_type("_IO_FILE") |
| 23 |
.blocklist_type("_IO_codecvt") |
| 24 |
.blocklist_type("_IO_wide_data") |
| 25 |
.blocklist_type("_IO_marker") |
| 26 |
.blocklist_type("_IO_lock_t") |
| 27 |
// Replaced by i64 |
| 28 |
.blocklist_type("LARGE_INTEGER") |
| 29 |
// Replaced by libc::timespec |
| 30 |
.blocklist_type("timespec") |
| 31 |
// etc |
| 32 |
.blocklist_type("__time_t") |
| 33 |
.blocklist_type("__syscall_slong_t") |
| 34 |
// .blocklist_type("__off64_t") |
| 35 |
.blocklist_type("__off_t") |
| 36 |
.size_t_is_usize(true) |
| 37 |
.generate() |
| 38 |
.expect("Unable to generate bindings") |
| 39 |
.write_to_file(out) |
| 40 |
.unwrap(); |
| 41 |
} |
| 42 |
} |