Subject: RE: [PATCH RFC v4 1/9] meson: add infrastructure to build internal

From: "D. Ben Knoble" <[email-masked]>
Date: Tue, 20 Jan 2026 17:18:42 -0500

Hi Patrick,

> 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

As far as I can tell, v4 of the Rust series introduced this script [1]. I didn't
notice any comments on or about the use of "--quiet" here, and Gentoo's been
carrying a patch to remove it [2] (also attached below). I don't think it's been
sent upstream, but we could… any thoughts on "why --quiet" or objections to such
a patch?

---- 8< ----
>From 35f637fbabb3b8181a29ba7d96a505b49ea0ba0d Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
From: Sam James <[email-masked]>
Date: Tue, 18 Nov 2025 18:10:03 +0000
Subject: [PATCH 1/2] rust: don't pass --quiet to cargo

This obscures that cargo is being invoked at all and it means even
ninja --verbose has no mention of it other than invoking the target.

Signed-off-by: Sam James <[email-masked]>
---
 src/cargo-meson.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh
index 3998db0435..63a5e7c6ac 100755
--- a/src/cargo-meson.sh
+++ b/src/cargo-meson.sh
@@ -19,7 +19,7 @@ do
 	esac
 done
 
-cargo build --lib --quiet --manifest-path="$SOURCE_DIR/Cargo.toml" --target-dir="$BUILD_DIR" "$@"
+cargo build --lib --manifest-path="$SOURCE_DIR/Cargo.toml" --target-dir="$BUILD_DIR" "$@"
 RET=$?
 if test $RET -ne 0
 then

base-commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
-- 
2.51.2
---- >8 ----

(While I'm thinking of it, we also have a patch to allow specifying CARGO [3],
in case there are comments on that.)

---- 8< ----
>From 1eba2788aab9f63ff55ac453b0d885aaa60c77af Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: Sam James <[email-masked]>
Date: Tue, 18 Nov 2025 18:10:47 +0000
Subject: [PATCH 2/2] rust: respect $CARGO environment variable

Respect the CARGO environment variable if set. Gentoo uses this to
control the version of rust/cargo for a build.

Signed-off-by: Sam James <[email-masked]>
---
 src/cargo-meson.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh
index 63a5e7c6ac..bbf3f91178 100755
--- a/src/cargo-meson.sh
+++ b/src/cargo-meson.sh
@@ -19,7 +19,7 @@ do
 	esac
 done
 
-cargo build --lib --manifest-path="$SOURCE_DIR/Cargo.toml" --target-dir="$BUILD_DIR" "$@"
+${CARGO:-cargo} build --lib --manifest-path="$SOURCE_DIR/Cargo.toml" --target-dir="$BUILD_DIR" "$@"
 RET=$?
 if test $RET -ne 0
 then
-- 
2.51.2
---- >8 ----

[1]: https://lore.kernel.org/git/[email-masked]/
[2]: https://github.com/gentoo/gentoo/blob/master/dev-vcs/git/files/git-2.52.0-0001-rust-don-t-pass-quiet-to-cargo.patch
[3]: https://github.com/gentoo/gentoo/blob/master/dev-vcs/git/files/git-2.52.0-0002-rust-respect-CARGO-environment-variable.patch