summaryrefslogtreecommitdiffstats
path: root/bindings/rust/libflashrom/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/rust/libflashrom/build.rs')
-rw-r--r--bindings/rust/libflashrom/build.rs17
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");
+}