aboutsummaryrefslogtreecommitdiff
path: root/build.rs
blob: 0cd0f145d474a0da8a50e23114af42705be6f8e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extern crate bindgen;

use std::env;
use std::path::PathBuf;

#[cfg(not(feature = "hermetic"))]
fn main() {
	println!("cargo:rustc-link-lib=squashfs");
	println!("cargo:rerun-if-changed=wrapper.h");
	let bindings = bindgen::Builder::default()
		.header("wrapper.h")
		.parse_callbacks(Box::new(bindgen::CargoCallbacks))
		.generate()
		.expect("Failed to generate SquashFS bindings");
	bindings.write_to_file(PathBuf::from(env::var("OUT_DIR").unwrap()).join("bindings.rs")).expect("Failed to write SquashFS bindings");
}

// Don't generate bindings or linking directives if we're building hermetically
#[cfg(feature = "hermetic")]
fn main() { }