aboutsummaryrefslogtreecommitdiff
path: root/build.rs
blob: fc0c243f777c74c028274d71c65ed6ae66a0b938 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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() {}