1// use bindgen::callbacks::ParseCallbacks;2// use std::path::PathBuf;3//4// #[derive(Debug)]5// struct StripPrefix;6// impl ParseCallbacks for StripPrefix {7// fn item_name(&self, name: &str) -> Option<String> {8// name.strip_prefix("nix_").map(ToOwned::to_owned)9// }10// }1112fn main() {13 //14 // let mut libnix = bindgen::builder().header_contents("nix.h", "15 // #define GC_THREADS16 // #include <gc/gc.h>17 // #include <nix_api_expr.h>18 // #include <nix_api_store.h>19 // #include <nix_api_util.h>20 // #include <nix_api_value.h>21 // ").parse_callbacks(Box::new(StripPrefix));22 //23 // for header in pkg_config::probe_library("nix-expr-c").expect("nix-expr-c").include_paths.into_iter().chain(pkg_config::probe_library("bdw-gc").expect("bdw-gc").include_paths.into_iter()) {24 // libnix = libnix.clang_arg(format!("-I{}", header.to_str().expect("path is utf-8")));25 // }26 //27 // let mut out = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is set by cargo"));28 // out.push("bindings.rs");29 // libnix.generate().expect("generate bindings").write_to_file(out).expect("write bindings");30}difftreelog
source
crates/nix-eval/build.rs1.1 KiBsourcehistory