libubootenv-sys 0.1.1

FFI bindings to libubootenv
use std::path::PathBuf;

fn main() {
    let lib = pkg_config::Config::new()
        .probe("libubootenv")
        .expect("libubootenv not found via pkg-config");

    let mut builder = bindgen::Builder::default();

    for path in &lib.include_paths {
        builder = builder.clang_arg(format!("-I{}", path.display()));
    }

    let bindings = builder
        .header("wrapper.h")
        .allowlist_function("libuboot_.*")
        .allowlist_type("uboot_.*")
        .generate()
        .expect("bindgen failed");

    let out = PathBuf::from(std::env::var("OUT_DIR").unwrap());
    bindings.write_to_file(out.join("bindings.rs")).unwrap();
}