WHATSNEW: SMB3 Directory Leases
[samba4-gss.git] / rust / talloc / build.rs
blobd14b0b045e9961edc6351994b94321b2187cc462
1 use std::env;
2 use std::path::PathBuf;
4 fn main() {
5     let bindings = bindgen::Builder::default()
6         .blocklist_function("qgcvt")
7         .blocklist_function("qgcvt_r")
8         .blocklist_function("qfcvt")
9         .blocklist_function("qfcvt_r")
10         .blocklist_function("qecvt")
11         .blocklist_function("qecvt_r")
12         .blocklist_function("strtold")
13         .clang_arg("-Dbool=int")
14         .generate_comments(false)
15         .clang_arg("-I../../lib/talloc")
16         .header("../../lib/util/talloc_stack.h")
17         .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
18         .generate()
19         .expect("Unable to generate bindings");
20     println!("cargo:rerun-if-changed=../../lib/util/talloc_stack.h");
22     let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
23     bindings
24         .write_to_file(out_path.join("bindings.rs"))
25         .expect("Couldn't write bindings!");
27     let mut src_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
28     src_dir.push("../../bin/default/lib/talloc");
29     if config::USING_SYSTEM_TALLOC == 1 {
30         println!("cargo:rustc-link-lib=talloc");
31     } else {
32         println!("cargo:rustc-link-lib=talloc-private-samba");
33     }
34     println!(
35         "cargo:rustc-link-search=native={}",
36         src_dir.to_str().unwrap()
37     );