d2b0e42bfc
If we're going to scale out our oxidation, let's follow the path of Firefox (and other projects) further and use cbindgen: https://github.com/eqrion/cbindgen It's actually nice that `cbindgen` is packaged today in Fedora, but I doubt it is elsewhere; we may end up needing to push that forward, or just vendor it via a `build.rs` script and Cargo. I chose to rename things to `ROR`/`ror_` since it's shorter. I am tempted a bit to rename our internal functions to just `ro_` to or so. Closes: #1516 Approved by: jlebon
25 lines
739 B
Rust
25 lines
739 B
Rust
// See https://bugzilla.redhat.com/show_bug.cgi?id=1608670#c3
|
|
// and https://github.com/projectatomic/rpm-ostree/pull/1516
|
|
|
|
extern crate cbindgen;
|
|
|
|
fn run() -> Result<(), String> {
|
|
let out_dir_v = std::env::var("OUT_DIR").expect("OUT_DIR is unset");
|
|
let out_dir = std::path::Path::new(&out_dir_v);
|
|
let bindings = cbindgen::generate(std::path::Path::new(".")).map_err(|e| e.to_string())?;
|
|
// This uses unwraps internally; it'd be good to submit a patch
|
|
// to add a Result-based API.
|
|
bindings.write_to_file(out_dir.join("rpmostree-rust.h"));
|
|
Ok(())
|
|
}
|
|
|
|
fn main() {
|
|
match run() {
|
|
Ok(_) => {}
|
|
Err(e) => {
|
|
eprintln!("error: {}", e);
|
|
std::process::exit(1)
|
|
}
|
|
}
|
|
}
|