Re: [PATCH RFC v4 1/9] meson: add infrastructure to build internal Rust library
From: brian m. carlson <hidden>
Date: 2025-09-11 21:34:02
Attachments
- signature.asc [application/pgp-signature] 262 bytes
From: brian m. carlson <hidden>
Date: 2025-09-11 21:34:02
On 2025-09-10 at 15:35:47, Patrick Steinhardt wrote:
diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh new file mode 100755 index 00000000000..f29745beb36 --- /dev/null +++ b/src/cargo-meson.sh@@ -0,0 +1,32 @@ +#!/bin/sh + +if test "$#" -lt 2 +then + exit 1 +fi + +SOURCE_DIR="$1" +BUILD_DIR="$2" +BUILD_TYPE=debug + +shift 2 + +for arg +do + case "$arg" in + --release) + BUILD_TYPE=release;; + esac +done + +cargo build --lib --quiet --manifest-path="$SOURCE_DIR/Cargo.toml" --target-dir="$BUILD_DIR" "$@" +RET=$? +if test $RET -ne 0 +then + exit $RET +fi + +if ! cmp "$BUILD_DIR/$BUILD_TYPE/libgit.a" "$BUILD_DIR/libgit.a" >/dev/null 2>&1 +then + cp "$BUILD_DIR/$BUILD_TYPE/libgit.a" "$BUILD_DIR/libgit.a" +fi
Okay, this seems like a reasonable approach. It would be nicer to not have to do this, but we've got to work with what we've got. If I get mrustc working, this could also be a nice way to abstract that functionality in a useful way.
diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 00000000000..e69de29bb2d
An empty file seems like a good start. -- brian m. carlson (they/them) Toronto, Ontario, CA