-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
279e7c4
commit d2b0e42
Showing
8 changed files
with
52 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" | ||
language = "C" | ||
header = "#include <gio/gio.h>\ntypedef GError RORGError;" | ||
|
||
[export] | ||
prefix = "ROR" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters