1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/rust/version/build.rs
David Mulder abcf7644a9 Reorganize rust file tree
Place all rust code under samba/rust, similar to
how we organize python code in the samba tree.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-10-23 14:21:33 +00:00

30 lines
972 B
Rust

use std::env;
use std::path::{Path, PathBuf};
fn main() {
cc::Build::new()
.file("../../source3/lib/version.c")
.include(Path::new("../../bin/default"))
.include(Path::new("./include")) // for the empty includes.h
.warnings(false)
.compile("version");
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("../../bin/default/version.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!");
}