1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
From: Arnaud Ferraris <aferraris@debian.org>
Date: Fri, 15 Nov 2024 11:01:23 +0100
Subject: shell-rs: build: re-generate bindings before building exe
The build system provides a target named `update-rust-bindings` which
can be called manually to regenerate all Rust bindings. As we want to
ensure those are re-generated on Debian infra, make it a dependency of
the `cargo-build` target so bindings are always re-generated at build
time.
Forwarded: not-needed
---
rust/meson.build | 3 ++-
rust/update-bindings.sh | 33 ++++++++++++++++++++-------------
shell/src/meson.build | 2 +-
3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/rust/meson.build b/rust/meson.build
index 38ea303..1a97cb9 100644
--- a/rust/meson.build
+++ b/rust/meson.build
@@ -4,7 +4,8 @@ cargo_fmt = find_program('cargo-fmt', required: get_option('profile') == 'devel'
if gobject_introspection_dep.found() and cargo_fmt.found()
gir_dir = rust_binding_root / 'gir-files'
- run_target('update-rust-bindings',
+ update_bindings = custom_target('update-rust-bindings',
+ output: 'pps-girs',
command: [
rust_binding_root / 'update-bindings.sh',
libppsview_gir[0].full_path(),
diff --git a/rust/update-bindings.sh b/rust/update-bindings.sh
index fa60ffc..c624a21 100755
--- a/rust/update-bindings.sh
+++ b/rust/update-bindings.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-if [ -n "${MESON_SOURCE_ROOT}" ]; then
- cd "${MESON_SOURCE_ROOT}/rust"
+if [ -n "${DEB_SOURCE_DIR}" ]; then
+ pushd "${DEB_SOURCE_DIR}/rust"
fi
export PATH="$PATH:${MESON_SOURCE_ROOT}/rust/gir/target/release"
@@ -12,15 +12,22 @@ then
exit 1
fi
-for g in ${@:1}; do
- cp "$g" pps-girs
-done
+# Only re-generate bindings once to avoid useless rebuilds
+if ! [ -f "ev-girs/$(basename $1)" ]; then
+ for g in ${@:1}; do
+ cp "$g" pps-girs
+ done
-for d in papers-document papers-view; do
- pushd $d > /dev/null
- pushd sys > /dev/null
- gir -o .
- popd &> /dev/null
- gir -o .
- popd > /dev/null
-done
+ for d in papers-document papers-view; do
+ pushd $d > /dev/null
+ pushd sys > /dev/null
+ gir -o .
+ popd &> /dev/null
+ gir -o .
+ popd > /dev/null
+ done
+fi
+
+if [ -n "${DEB_SOURCE_DIR}" ]; then
+ popd
+fi
diff --git a/shell/src/meson.build b/shell/src/meson.build
index 7887522..968bed4 100644
--- a/shell/src/meson.build
+++ b/shell/src/meson.build
@@ -30,7 +30,7 @@ cargo_build = custom_target(
build_always_stale: true,
output: 'src',
console: true,
- depends: [papers_resources],
+ depends: [papers_resources, update_bindings],
env: cargo_env,
command: [
cargo, 'build',
|