Skip to content

Commit 6fcea4c

Browse files
committed
Do support Windows again after requiring Rust
By default, Rust wants to build MS Visual C-compatible libraries on Windows, because that is _the_ native C compiler. Git is historically lacking in its MSVC support, and the official Git for Windows versions are built using GCC instead. As a consequence, an entire GCC toolchain is installed as part of the `windows-build` job of every CI build. Naturally, this requires adjustments in how Rust is called, most importantly it requires installing support for a GCC-compatible build target. Let's make the necessary adjustment both in the CI-specific code that installs Rust as well as in the Windows-specific configuration in `config.mak.uname`. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 0de0867 commit 6fcea4c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ci/install-rust.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ if [ "$BITNESS" = "32" ]; then
2828
$CARGO_HOME/bin/rustup default --force-non-host $RUST_VERSION || exit $?
2929
else
3030
$CARGO_HOME/bin/rustup default $RUST_VERSION || exit $?
31+
if [ "$CI_OS_NAME" = "windows" ]; then
32+
$CARGO_HOME/bin/rustup target add x86_64-pc-windows-gnu || exit $?
33+
fi
3134
fi
3235

3336
. $CARGO_HOME/env

config.mak.uname

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,19 +727,28 @@ ifeq ($(uname_S),MINGW)
727727
prefix = /mingw32
728728
HOST_CPU = i686
729729
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
730+
CARGO_BUILD_TARGET = i686-pc-windows-gnu
730731
endif
731732
ifeq (MINGW64,$(MSYSTEM))
732733
prefix = /mingw64
733734
HOST_CPU = x86_64
734735
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
736+
CARGO_BUILD_TARGET = x86_64-pc-windows-gnu
735737
else ifeq (CLANGARM64,$(MSYSTEM))
736738
prefix = /clangarm64
737739
HOST_CPU = aarch64
738740
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
741+
CARGO_BUILD_TARGET = aarch64-pc-windows-gnu
739742
else
740743
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
741744
BASIC_LDFLAGS += -Wl,--large-address-aware
742745
endif
746+
747+
export CARGO_BUILD_TARGET
748+
RUST_TARGET_DIR = rust/target/$(CARGO_BUILD_TARGET)/$(RUST_BUILD_MODE)
749+
# Unfortunately now needed because of Rust
750+
EXTLIBS += -luserenv
751+
743752
CC = gcc
744753
COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
745754
-fstack-protector-strong

0 commit comments

Comments
 (0)