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// }111213fn main() {14 //15 // let mut libnix = bindgen::builder().header_contents("nix.h", "16 // #define GC_THREADS17 // #include <gc/gc.h>18 // #include <nix_api_expr.h>19 // #include <nix_api_store.h>20 // #include <nix_api_util.h>21 // #include <nix_api_value.h>22 // ").parse_callbacks(Box::new(StripPrefix));23 //24 // 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()) {25 // libnix = libnix.clang_arg(format!("-I{}", header.to_str().expect("path is utf-8")));26 // }27 //28 // let mut out = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is set by cargo"));29 // out.push("bindings.rs");30 // libnix.generate().expect("generate bindings").write_to_file(out).expect("write bindings");31}difftreelog
source
crates/nix-eval/build.rs1.1 KiBsourcehistory