Skip to content

Commit bb02e7a

Browse files
dschogitster
authored andcommitted
mingw: use a more canonical method to fix the CPU reporting
In `git version --build-options`, we report also the CPU, but in Git for Windows we actually cross-compile the 32-bit version in a 64-bit Git for Windows, so we cannot rely on the auto-detected value. In 3815f64 (mingw: fix CPU reporting in `git version --build-options`, 2019-02-07), we fixed this by a Windows-only workaround, making use of magic pre-processor constants, which works in GCC, but most likely not all C compilers. As pointed out by Eric Sunshine, there is a better way, anyway: to set the Makefile variable HOST_CPU explicitly for cross-compiled Git. So let's do that! This reverts commit 3815f64 partially. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3815f64 commit bb02e7a

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

compat/mingw.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,6 @@ typedef _sigset_t sigset_t;
66
#include <winsock2.h>
77
#include <ws2tcpip.h>
88

9-
#ifdef __MINGW64_VERSION_MAJOR
10-
/*
11-
* In Git for Windows, we cannot rely on `uname -m` to report the correct
12-
* architecture: /usr/bin/uname.exe will report the architecture with which the
13-
* current MSYS2 runtime was built, not the architecture for which we are
14-
* currently compiling (both 32-bit and 64-bit `git.exe` is built in the 64-bit
15-
* Git for Windows SDK).
16-
*/
17-
#undef GIT_HOST_CPU
18-
/* This was figured out by looking at `cpp -dM </dev/null`'s output */
19-
#if defined(__x86_64__)
20-
#define GIT_HOST_CPU "x86_64"
21-
#elif defined(__i686__)
22-
#define GIT_HOST_CPU "i686"
23-
#else
24-
#error "Unknown architecture"
25-
#endif
26-
#endif
27-
289
/* MinGW-w64 reports to have flockfile, but it does not actually have it. */
2910
#ifdef __MINGW64_VERSION_MAJOR
3011
#undef _POSIX_THREAD_SAFE_FUNCTIONS

config.mak.uname

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,11 @@ else
553553
prefix = /usr/
554554
ifeq (MINGW32,$(MSYSTEM))
555555
prefix = /mingw32
556+
HOST_CPU = i686
556557
endif
557558
ifeq (MINGW64,$(MSYSTEM))
558559
prefix = /mingw64
560+
HOST_CPU = x86_64
559561
else
560562
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
561563
BASIC_LDFLAGS += -Wl,--large-address-aware

0 commit comments

Comments
 (0)