summaryrefslogtreecommitdiff
path: root/libsyslog-sys/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libsyslog-sys/build.rs')
-rw-r--r--libsyslog-sys/build.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/libsyslog-sys/build.rs b/libsyslog-sys/build.rs
new file mode 100644
index 0000000..6cab3c4
--- /dev/null
+++ b/libsyslog-sys/build.rs
@@ -0,0 +1,29 @@
+extern crate bindgen;
+
+use {
+ bindgen::{
+ Builder,
+ CargoCallbacks,
+ MacroTypeVariation,
+ },
+ std::{
+ env,
+ path::PathBuf,
+ },
+};
+
+fn main() {
+ println!("cargo:rerun-if-changed=wrapper.h");
+
+ let bindings = Builder::default()
+ .header("wrapper.h")
+ .parse_callbacks(Box::new(CargoCallbacks))
+ .default_macro_constant_type(MacroTypeVariation::Signed)
+ .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!");
+}