1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00
Evan Benn 401d9bfa71 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>
2022-08-19 04:37:43 +00:00

18 lines
511 B
Rust

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");
}