mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 07:02:34 +02:00

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>
18 lines
511 B
Rust
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");
|
|
}
|