1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

bindings/rust/libflashrom: Create fat rust binding

Create a rust library wrapping libflashrom-sys in a more idiomatic rust
API.

BUG=b:230545739
BRANCH=None
TEST=cargo test

Change-Id: Ie3bcfde40dc475f6a9439ccab8e2446967f7d6dd
Signed-off-by: Evan Benn <evanbenn@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/65281
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Evan Benn
2022-06-01 10:24:08 +10:00
committed by Edward O'Callaghan
parent 06d32e1147
commit 401d9bfa71
5 changed files with 1194 additions and 0 deletions

View File

@ -0,0 +1,17 @@
extern crate cc;
fn main() {
// pkg_config is needed only to pick up the include path for log.c to use.
// libflashrom-sys tells cargo how to link to libflashrom.
let flashrom = pkg_config::Config::new()
.cargo_metadata(false)
.probe("flashrom")
.unwrap();
let mut log_c = cc::Build::new();
log_c.file("src/log.c");
for p in flashrom.include_paths {
log_c.include(p);
}
log_c.compile("log.o");
println!("cargo:rerun-if-changed=src/log.c");
}