build: Regenerate rpmostree-rust.h if cbindgen.toml changes
So when I edit it I get the changes. Figuring this out took me a little while, we were missing two dependencies. Closes: #1559 Approved by: jlebon
This commit is contained in:
parent
8df776e367
commit
36bf3c9164
@ -87,7 +87,7 @@ librpmostree_rust_path = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librpmos
|
||||
# want to (by default) touch the Internet during builds here.
|
||||
# One reason is that we want to support `make && sudo make install`,
|
||||
# and we don't want to do `sudo cargo` there.
|
||||
LIBRPMOSTREE_RUST_SRCS = $(wildcard rust/src/*.rs)
|
||||
LIBRPMOSTREE_RUST_SRCS = $(wildcard rust/src/*.rs) rust/cbindgen.toml
|
||||
$(librpmostree_rust_path): Makefile $(LIBRPMOSTREE_RUST_SRCS)
|
||||
cd $(top_srcdir)/rust && \
|
||||
export CARGO_TARGET_DIR=@abs_top_builddir@/target && \
|
||||
|
@ -6,6 +6,10 @@ extern crate cbindgen;
|
||||
fn run() -> Result<(), String> {
|
||||
let out_dir_v = std::env::var("OUT_DIR").expect("OUT_DIR is unset");
|
||||
let out_dir = std::path::Path::new(&out_dir_v);
|
||||
|
||||
// First, output our dependencies https://doc.rust-lang.org/cargo/reference/build-scripts.html
|
||||
println!("cargo:rerun-if-changed=cbindgen.toml");
|
||||
|
||||
let bindings = cbindgen::generate(std::path::Path::new(".")).map_err(|e| e.to_string())?;
|
||||
// This uses unwraps internally; it'd be good to submit a patch
|
||||
// to add a Result-based API.
|
||||
|
Loading…
Reference in New Issue
Block a user