From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>,
"James Le Cuirot" <chewi@gentoo.org>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2 1/2] rust: pick a GCC-compatible Cargo target under MSYS2/MinGW
Date: Fri, 11 Sep 2026 14:09:46 -0700 [thread overview]
Message-ID: <xmqqa4pna411.fsf@gitster.g> (raw)
In-Reply-To: <6567eceb32c1bdcff5927c6baf0cadc97af7485b.1789153730.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Fri, 11 Sep 2026 19:08:49 +0000")
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> @@ -993,6 +993,7 @@ endif
> ifndef DEBUG
> CARGO_ARGS += --release
> endif
> +CARGO_ARGS += $(if $(CARGO_TARGET),--target $(CARGO_TARGET))
Should this use CARGO_BUILD_TARGET (instead of CARGO_TARGET) to
match what the officially supported Cargo environment variable is
called? It would also help us work better with the changes from the
jc/rust-cargo-build-target topic.
Thanks.
Author: James Le Cuirot <chewi@gentoo.org>
Date: Thu Sep 10 11:20:14 2026 +0100
rust: respect CARGO_BUILD_TARGET when locating build output
When cross-compiling, Cargo always writes to a target-tuple subdirectory
determined by CARGO_BUILD_TARGET, even when it matches the native tuple.
The build looked in $BUILD_DIR/$BUILD_TYPE directly, so it failed to
locate the freshly built library.
Respect CARGO_BUILD_TARGET in the output path so the correct artifact
is located.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/Makefile b/Makefile
index d4b775953d..f0ca2e4f72 100644
--- a/Makefile
+++ b/Makefile
@@ -959,7 +959,7 @@ RUST_LIB_NAME = gitcore.lib
else
RUST_LIB_NAME = libgitcore.a
endif
-RUST_LIB = target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)
+RUST_LIB = target/$(if $(CARGO_BUILD_TARGET),$(CARGO_BUILD_TARGET)/)$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)
endif
GITLIBS = common-main.o $(LIB_FILE)
diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh
index 75f3cd1265..83c7e7b79b 100755
--- a/src/cargo-meson.sh
+++ b/src/cargo-meson.sh
@@ -38,7 +38,7 @@ then
exit $RET
fi
-if ! cmp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a" >/dev/null 2>&1
+if ! cmp "$BUILD_DIR/${CARGO_BUILD_TARGET:+$CARGO_BUILD_TARGET/}$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a" >/dev/null 2>&1
then
- cp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a"
+ cp "$BUILD_DIR/${CARGO_BUILD_TARGET:+$CARGO_BUILD_TARGET/}$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a"
fi
next prev parent reply other threads:[~2026-09-11 21:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 14:21 [PATCH 0/2] Use Rust in the Windows CI jobs Johannes Schindelin via GitGitGadget
2026-09-01 14:21 ` [PATCH 1/2] rust: pick a GCC-compatible Cargo target under MSYS2/MinGW Johannes Schindelin via GitGitGadget
2026-09-02 6:25 ` Junio C Hamano
2026-09-11 12:25 ` Johannes Schindelin
2026-09-01 14:21 ` [PATCH 2/2] ci(windows): build with Rust Johannes Schindelin via GitGitGadget
2026-09-11 19:08 ` [PATCH v2 0/2] Use Rust in the Windows CI jobs Johannes Schindelin via GitGitGadget
2026-09-11 19:08 ` [PATCH v2 1/2] rust: pick a GCC-compatible Cargo target under MSYS2/MinGW Johannes Schindelin via GitGitGadget
2026-09-11 21:09 ` Junio C Hamano [this message]
2026-09-11 22:26 ` James Le Cuirot
2026-09-13 10:30 ` Johannes Schindelin
2026-09-11 19:08 ` [PATCH v2 2/2] ci(windows): build with Rust Johannes Schindelin via GitGitGadget
2026-09-13 10:31 ` [PATCH v3 0/2] Use Rust in the Windows CI jobs Johannes Schindelin via GitGitGadget
2026-09-13 10:31 ` [PATCH v3 1/2] rust: pick a GCC-compatible Cargo target under MSYS2/MinGW Johannes Schindelin via GitGitGadget
2026-09-13 10:31 ` [PATCH v3 2/2] ci(windows): build with Rust Johannes Schindelin via GitGitGadget
2026-09-13 15:57 ` [PATCH v4 0/2] Use Rust in the Windows CI jobs Johannes Schindelin via GitGitGadget
2026-09-13 15:57 ` [PATCH v4 1/2] rust: pick a GCC-compatible Cargo target under MSYS2/MinGW Johannes Schindelin via GitGitGadget
2026-09-13 15:57 ` [PATCH v4 2/2] ci(windows): build with Rust Johannes Schindelin via GitGitGadget
2026-09-13 22:52 ` [PATCH v4 0/2] Use Rust in the Windows CI jobs Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa4pna411.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chewi@gentoo.org \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox