diff options
author | Evan Benn <evanbenn@chromium.org> | 2022-06-01 10:24:08 +1000 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2022-08-19 04:37:43 +0000 |
commit | 401d9bfa71ee3269ff0e561c3ba795410b920e6d (patch) | |
tree | a6427cfd508bb0c73bc35347ccd7d2b87ad34920 /bindings/rust/libflashrom/build.rs | |
parent | 06d32e11473bbd4631cf2709c16d220d81280f2d (diff) | |
download | flashrom-401d9bfa71ee3269ff0e561c3ba795410b920e6d.tar.gz flashrom-401d9bfa71ee3269ff0e561c3ba795410b920e6d.tar.bz2 flashrom-401d9bfa71ee3269ff0e561c3ba795410b920e6d.zip |
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>
Diffstat (limited to 'bindings/rust/libflashrom/build.rs')
-rw-r--r-- | bindings/rust/libflashrom/build.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bindings/rust/libflashrom/build.rs b/bindings/rust/libflashrom/build.rs new file mode 100644 index 000000000..9908ebbc2 --- /dev/null +++ b/bindings/rust/libflashrom/build.rs @@ -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"); +} |