Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,30 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: git-for-windows/setup-git-for-windows-sdk@v2
- name: Install GCC-compatible Rust target
shell: bash
run: |
# The hosted Windows runners ship a rustup-managed Rust whose
# default toolchain targets the MSVC ABI. That produces a
# `gitcore.lib` which the MinGW GCC used by the rest of the
# build cannot link. Install the precompiled `std` for a
# GCC-compatible target triple matching the MSYS2 subsystem;
# the Makefile selects the same triple via $(MSYSTEM) and
# passes it to `cargo build --target`.
case "$MSYSTEM" in
CLANGARM64) target=aarch64-pc-windows-gnullvm ;;
CLANG64) target=x86_64-pc-windows-gnullvm ;;
CLANG32) target=i686-pc-windows-gnullvm ;;
UCRT64) target=x86_64-pc-windows-gnu ;;
MINGW64) target=x86_64-pc-windows-gnu ;;
MINGW32) target=i686-pc-windows-gnu ;;
*) echo "::error::Unsupported MSYSTEM: $MSYSTEM"; exit 1 ;;
esac &&
rustup target add "$target" &&

# Ensure that cargo.exe is found even with the minimal SDK's restricted PATH
CARGO="$(type -p cargo.exe)" &&
echo "export PATH=\$PATH:${CARGO%/cargo.exe}" >>/etc/profile
- name: build
shell: bash
env:
Expand Down
9 changes: 9 additions & 0 deletions Documentation/RelNotes/2.56.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@ Performance, Internal Implementation, Development Support etc.
backend-specific object source layers, making them pluggable for
different object storage formats.

* When cross-compiling with Cargo, the output artifact is placed in a
target-specific subdirectory, which causes the build system to fail
to locate it. The build system has been updated to respect the
'CARGO_BUILD_TARGET' environment variable.


Fixes since v2.55
-----------------
Expand Down Expand Up @@ -897,6 +902,10 @@ Fixes since v2.55
branch-switch message.
(merge 2ba77ea828 hn/checkout-m-autostash-refine later to maint).

* The memory leak caused by not unusing the commit buffer returned by
repo_logmsg_reencode() during the rewording operation in 'git
history' has been plugged.

* Other code cleanup, docfix, build fix, etc.
(merge 026636128f ss/submittingpatches-typofix later to maint).
(merge d2af22cc21 jc/rerere-doc-typofix later to maint).
Expand Down
2 changes: 1 addition & 1 deletion GIT-VERSION-GEN
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

DEF_VER=v2.56.0-rc0
DEF_VER=v2.56.0-rc1

LF='
'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions builtin/history.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ static int commit_tree_ext(struct repository *repo,
free_commit_extra_headers(original_extra_headers);
strbuf_release(&commit_message);
free(original_author);
repo_unuse_commit_buffer(repo, commit_with_message, original_message);
return ret;
}

Expand Down
3 changes: 0 additions & 3 deletions ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,6 @@ linux-asan-ubsan)
osx-meson)
MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
;;
windows-*)
export NO_RUST=UnfortunatelyYes
;;
esac

MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
Expand Down
25 changes: 24 additions & 1 deletion config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,30 @@ ifeq ($(uname_S),MINGW)
MINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)
endif
prefix = $(MINGW_PREFIX)
HOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))

# A rustup-managed Rust on Windows defaults to the MSVC ABI and
# produces a `gitcore.lib` that the MinGW `ld.exe` cannot link.
# Pick a GCC-compatible Rust target triple matching the MSYS2
# subsystem instead: `*-pc-windows-gnullvm` for the Clang/LLVM
# subsystems (which on Windows is also the only choice for
# ARM64, where no MinGW-GCC port exists) and `*-pc-windows-gnu`
# for the MSVCRT-based MinGW subsystems. For a `staticlib`
# crate-type Cargo does not invoke an external linker, so
# `rustup target add <triple>` is sufficient.
ifneq (,$(filter %ARM64, $(MSYSTEM)))
HOST_CPU = aarch64
else ifneq (,$(filter %32, $(MSYSTEM)))
HOST_CPU = i686
else
HOST_CPU = x86_64
endif
ifneq (,$(filter CLANG%, $(MSYSTEM)))
CARGO_BUILD_TARGET = $(HOST_CPU)-pc-windows-gnullvm
else
CARGO_BUILD_TARGET = $(HOST_CPU)-pc-windows-gnu
endif
export CARGO_BUILD_TARGET

BASIC_LDFLAGS += -Wl,--pic-executable
COMPAT_CFLAGS += -DDETECT_MSYS_TTY \
-DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" \
Expand Down
4 changes: 2 additions & 2 deletions src/cargo-meson.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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