From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Ezekiel Newren <ezekielnewren@gmail.com>,
Patrick Steinhardt <ps@pks.im>,
git@vger.kernel.org,
"brian m. carlson" <sandals@crustytoothpaste.net>,
Karthik Nayak <karthik.188@gmail.com>,
Eric Sunshine <ericsunshine@gmail.com>,
Chris Torek <chris.torek@gmail.com>
Subject: Re: [PATCH v3 6/6] rust: support for Windows
Date: Fri, 21 Nov 2025 13:39:01 -0800 [thread overview]
Message-ID: <xmqq34673w22.fsf@gitster.g> (raw)
In-Reply-To: <dc753c0e-eb93-948c-55f7-bb0e91772c83@gmx.de> (Johannes Schindelin's message of "Fri, 21 Nov 2025 09:18:47 +0100 (CET)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Here is my patch (with proper handling of MSVC, but obviously it no longer
> applies without conflicts):
Thanks. Here is my attempt to make it apply to 'master'.
It seems to pass win+Meson build & test for 'master'.
https://github.com/git/git/actions/runs/19583133885
But curiously, the tip of 'master' has been happy without this fix,
and it does not help when brian's SHA-256 interop topic merged
further on top, but I didn't look any further.
--- >8 ---
Subject: [PATCH] meson(cargo): Visual C produces gitcore.lib, not libgitcore.a
On Windows, when Visual C compiler is used to compile, the resulting
library that is created is called gitcore.lib instead of libgitcore.a
library archive.
Johannes sent a fix in <dc753c0e-eb93-948c-55f7-bb0e91772c83@gmx.de>
that was based on an older code base, which I attempted to forward
port it to apply to today's codebase.
Based-on-the-patch-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
src/cargo-meson.sh | 14 ++++----------
src/meson.build | 11 ++++++++++-
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh
index 3998db0435..4a46f731d8 100755
--- a/src/cargo-meson.sh
+++ b/src/cargo-meson.sh
@@ -7,9 +7,10 @@ fi
SOURCE_DIR="$1"
BUILD_DIR="$2"
+LIBNAME="$3"
BUILD_TYPE=debug
-shift 2
+shift 3
for arg
do
@@ -26,14 +27,7 @@ then
exit $RET
fi
-case "$(cargo -vV | sed -s 's/^host: \(.*\)$/\1/')" in
- *-windows-*)
- LIBNAME=gitcore.lib;;
- *)
- LIBNAME=libgitcore.a;;
-esac
-
-if ! cmp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a" >/dev/null 2>&1
+if ! cmp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/$LIBNAME" >/dev/null 2>&1
then
- cp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a"
+ cp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/$LIBNAME"
fi
diff --git a/src/meson.build b/src/meson.build
index 25b9ad5a14..f37f0a5f58 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -3,6 +3,14 @@ libgit_rs_sources = [
'varint.rs',
]
+# The exact file name depends on the compiler
+if meson.get_compiler('c').get_id() == 'msvc'
+ libname = 'gitcore.lib'
+else
+ libname = 'libgitcore.a'
+endif
+
+
# Unfortunately we must use a wrapper command to move the output file into the
# current build directory. This can fixed once `cargo build --artifact-dir`
# stabilizes. See https://github.com/rust-lang/cargo/issues/6790 for that
@@ -12,6 +20,7 @@ cargo_command = [
meson.current_source_dir() / 'cargo-meson.sh',
meson.project_source_root(),
meson.current_build_dir(),
+ libname,
]
if get_option('buildtype') == 'release'
cargo_command += '--release'
@@ -21,7 +30,7 @@ libgit_rs = custom_target('git_rs',
input: libgit_rs_sources + [
meson.project_source_root() / 'Cargo.toml',
],
- output: 'libgitcore.a',
+ output: libname,
command: cargo_command,
)
libgit_dependencies += declare_dependency(link_with: libgit_rs)
--
2.52.0-168-gcf2c56d51e
next prev parent reply other threads:[~2025-11-21 21:39 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 12:36 [PATCH 0/6] ci: improvements to our Rust infrastructure Patrick Steinhardt
2025-10-07 12:36 ` [PATCH 1/6] ci: deduplicate calls to `apt-get update` Patrick Steinhardt
2025-10-07 12:54 ` Karthik Nayak
2025-10-14 20:56 ` Justin Tobler
2025-10-07 12:36 ` [PATCH 2/6] ci: check formatting of our Rust code Patrick Steinhardt
2025-10-07 13:04 ` Karthik Nayak
2025-10-07 13:50 ` Patrick Steinhardt
2025-10-07 17:13 ` Eric Sunshine
2025-10-07 17:38 ` Junio C Hamano
2025-10-07 18:03 ` Eric Sunshine
2025-10-07 22:42 ` brian m. carlson
2025-10-07 22:58 ` Chris Torek
2025-10-08 4:46 ` Patrick Steinhardt
2025-10-08 15:34 ` Junio C Hamano
2025-10-09 5:29 ` Patrick Steinhardt
2025-10-29 22:54 ` SZEDER Gábor
2025-10-07 22:07 ` brian m. carlson
2025-10-08 20:55 ` SZEDER Gábor
2025-10-09 5:29 ` Patrick Steinhardt
2025-10-29 21:19 ` SZEDER Gábor
2025-10-07 12:36 ` [PATCH 3/6] rust/varint: add safety comments Patrick Steinhardt
2025-10-08 0:29 ` brian m. carlson
2025-10-08 4:46 ` Patrick Steinhardt
2025-10-07 12:36 ` [PATCH 4/6] ci: check for common Rust mistakes via Clippy Patrick Steinhardt
2025-10-07 12:36 ` [PATCH 5/6] ci: verify minimum supported Rust version Patrick Steinhardt
2025-10-07 12:36 ` [PATCH 6/6] rust: support for Windows Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 0/6] ci: improvements to our Rust infrastructure Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 1/6] ci: deduplicate calls to `apt-get update` Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 2/6] ci: check formatting of our Rust code Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 3/6] rust/varint: add safety comments Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 4/6] ci: check for common Rust mistakes via Clippy Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 5/6] ci: verify minimum supported Rust version Patrick Steinhardt
2025-10-15 6:04 ` [PATCH v3 6/6] rust: support for Windows Patrick Steinhardt
2025-11-20 19:45 ` Ezekiel Newren
2025-11-21 8:18 ` Johannes Schindelin
2025-11-21 21:39 ` Junio C Hamano [this message]
2025-10-15 15:21 ` [PATCH v3 0/6] ci: improvements to our Rust infrastructure 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=xmqq34673w22.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=chris.torek@gmail.com \
--cc=ericsunshine@gmail.com \
--cc=ezekielnewren@gmail.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
/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;
as well as URLs for NNTP newsgroup(s).