]> granicus.if.org Git - git/commitdiff
mingw: use a more canonical method to fix the CPU reporting
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 13 Feb 2019 10:19:49 +0000 (02:19 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Feb 2019 21:46:58 +0000 (13:46 -0800)
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 3815f64b0dd9 (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 3815f64b0dd983bdbf9242a0547706d5d81cb3e6 partially.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.h
config.mak.uname

index 363f047df0a3291e0d3d311f53066d6dabf673dd..8c24ddaa3efc20e4454ebc87c51fa30316f64a22 100644 (file)
@@ -6,25 +6,6 @@ typedef _sigset_t sigset_t;
 #include <winsock2.h>
 #include <ws2tcpip.h>
 
-#ifdef __MINGW64_VERSION_MAJOR
-/*
- * In Git for Windows, we cannot rely on `uname -m` to report the correct
- * architecture: /usr/bin/uname.exe will report the architecture with which the
- * current MSYS2 runtime was built, not the architecture for which we are
- * currently compiling (both 32-bit and 64-bit `git.exe` is built in the 64-bit
- * Git for Windows SDK).
- */
-#undef GIT_HOST_CPU
-/* This was figured out by looking at `cpp -dM </dev/null`'s output */
-#if defined(__x86_64__)
-#define GIT_HOST_CPU "x86_64"
-#elif defined(__i686__)
-#define GIT_HOST_CPU "i686"
-#else
-#error "Unknown architecture"
-#endif
-#endif
-
 /* MinGW-w64 reports to have flockfile, but it does not actually have it. */
 #ifdef __MINGW64_VERSION_MAJOR
 #undef _POSIX_THREAD_SAFE_FUNCTIONS
index 3ee7da0e230c4c33e79ae2f3cf498a5cd7cc4881..194f20a8b30823084a3e089311a79e9d0f5eace4 100644 (file)
@@ -553,9 +553,11 @@ else
                prefix = /usr/
                ifeq (MINGW32,$(MSYSTEM))
                        prefix = /mingw32
+                       HOST_CPU = i686
                endif
                ifeq (MINGW64,$(MSYSTEM))
                        prefix = /mingw64
+                       HOST_CPU = x86_64
                else
                        COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
                        BASIC_LDFLAGS += -Wl,--large-address-aware