1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/rust/idmap/build.rs
David Mulder 33bdebb7c8 Enable rust cargo test in Samba make test
Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-10-23 14:21:33 +00:00

34 lines
1.1 KiB
Rust

use std::env;
use std::path::Path;
use std::path::PathBuf;
fn main() {
cc::Build::new()
.file("src/sss_idmap.c")
.file("src/sss_idmap_conv.c")
.file("src/murmurhash3.c")
.include(Path::new("../../bin/default/include"))
.warnings(false)
.compile("sss_idmap");
let bindings = bindgen::Builder::default()
.blocklist_function("qgcvt")
.blocklist_function("qgcvt_r")
.blocklist_function("qfcvt")
.blocklist_function("qfcvt_r")
.blocklist_function("qecvt")
.blocklist_function("qecvt_r")
.blocklist_function("strtold")
.header("src/sss_idmap.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
println!("cargo:rustc-link-lib=utf8proc");
println!("cargo:rustc-env=LD_LIBRARY_PATH=../../bin/shared/private/");
}