{"thread":{"id":"50490","subject":"[PATCH 0/1] Use a more canonical method to fix the CPU reporting on Windows","startedAt":"2019-02-13T10:19:52Z","lastAt":"2019-02-13T21:46:40Z","messageCount":3,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"369222","messageId":"pull.125.git.gitgitgadget@gmail.com","threadId":"50490","inReplyTo":null,"subject":"[PATCH 0/1] Use a more canonical method to fix the CPU reporting on Windows","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2019-02-13T10:19:48Z","receivedAt":"2019-02-13T10:19:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Eric Sunshine pointed out that I had completely forgotten about the HOST_CPU\nthing, and that is indeed the much better method of fixing the issue.\n\nJohannes Schindelin (1):\n  mingw: use a more canonical method to fix the CPU reporting\n\n compat/mingw.h   | 19 -------------------\n config.mak.uname |  2 ++\n 2 files changed, 2 insertions(+), 19 deletions(-)\n\n\nbase-commit: 3815f64b0dd983bdbf9242a0547706d5d81cb3e6\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-125%2Fdscho%2Fmingw-host-cpu-take2-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-125/dscho/mingw-host-cpu-take2-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/125\n-- \ngitgitgadget\n"},{"id":"369223","messageId":"68df753d12b712ec33943a310f0bc80f4ec78d9a.1550053187.git.gitgitgadget@gmail.com","threadId":"50490","inReplyTo":"pull.125.git.gitgitgadget@gmail.com","subject":"[PATCH 1/1] mingw: use a more canonical method to fix the CPU reporting","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2019-02-13T10:19:49Z","receivedAt":"2019-02-13T10:19:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn `git version --build-options`, we report also the CPU, but in Git for\nWindows we actually cross-compile the 32-bit version in a 64-bit Git for\nWindows, so we cannot rely on the auto-detected value.\n\nIn 3815f64b0dd9 (mingw: fix CPU reporting in `git version\n--build-options`, 2019-02-07), we fixed this by a Windows-only\nworkaround, making use of magic pre-processor constants, which works in\nGCC, but most likely not all C compilers.\n\nAs pointed out by Eric Sunshine, there is a better way, anyway: to set\nthe Makefile variable HOST_CPU explicitly for cross-compiled Git. So\nlet's do that!\n\nThis reverts commit 3815f64b0dd983bdbf9242a0547706d5d81cb3e6 partially.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.h   | 19 -------------------\n config.mak.uname |  2 ++\n 2 files changed, 2 insertions(+), 19 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 363f047df0..8c24ddaa3e 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -6,25 +6,6 @@ typedef _sigset_t sigset_t;\n #include <winsock2.h>\n #include <ws2tcpip.h>\n \n-#ifdef __MINGW64_VERSION_MAJOR\n-/*\n- * In Git for Windows, we cannot rely on `uname -m` to report the correct\n- * architecture: /usr/bin/uname.exe will report the architecture with which the\n- * current MSYS2 runtime was built, not the architecture for which we are\n- * currently compiling (both 32-bit and 64-bit `git.exe` is built in the 64-bit\n- * Git for Windows SDK).\n- */\n-#undef GIT_HOST_CPU\n-/* This was figured out by looking at `cpp -dM </dev/null`'s output */\n-#if defined(__x86_64__)\n-#define GIT_HOST_CPU \"x86_64\"\n-#elif defined(__i686__)\n-#define GIT_HOST_CPU \"i686\"\n-#else\n-#error \"Unknown architecture\"\n-#endif\n-#endif\n-\n /* MinGW-w64 reports to have flockfile, but it does not actually have it. */\n #ifdef __MINGW64_VERSION_MAJOR\n #undef _POSIX_THREAD_SAFE_FUNCTIONS\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 3ee7da0e23..194f20a8b3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -553,9 +553,11 @@ else\n \t\tprefix = /usr/\n \t\tifeq (MINGW32,$(MSYSTEM))\n \t\t\tprefix = /mingw32\n+\t\t\tHOST_CPU = i686\n \t\tendif\n \t\tifeq (MINGW64,$(MSYSTEM))\n \t\t\tprefix = /mingw64\n+\t\t\tHOST_CPU = x86_64\n \t\telse\n \t\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n-- \ngitgitgadget\n"},{"id":"369259","messageId":"xmqq8syjbbus.fsf@gitster-ct.c.googlers.com","threadId":"50490","inReplyTo":"68df753d12b712ec33943a310f0bc80f4ec78d9a.1550053187.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/1] mingw: use a more canonical method to fix the CPU reporting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-02-13T21:46:35Z","receivedAt":"2019-02-13T21:46:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> In `git version --build-options`, we report also the CPU, but in Git for\n> Windows we actually cross-compile the 32-bit version in a 64-bit Git for\n> Windows, so we cannot rely on the auto-detected value.\n>\n> In 3815f64b0dd9 (mingw: fix CPU reporting in `git version\n> --build-options`, 2019-02-07), we fixed this by a Windows-only\n> workaround, making use of magic pre-processor constants, which works in\n> GCC, but most likely not all C compilers.\n>\n> As pointed out by Eric Sunshine, there is a better way, anyway: to set\n> the Makefile variable HOST_CPU explicitly for cross-compiled Git. So\n> let's do that!\n>\n> This reverts commit 3815f64b0dd983bdbf9242a0547706d5d81cb3e6 partially.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>  compat/mingw.h   | 19 -------------------\n>  config.mak.uname |  2 ++\n>  2 files changed, 2 insertions(+), 19 deletions(-)\n\nWill apply; thanks.\n\n>\n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index 363f047df0..8c24ddaa3e 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -6,25 +6,6 @@ typedef _sigset_t sigset_t;\n>  #include <winsock2.h>\n>  #include <ws2tcpip.h>\n>  \n> -#ifdef __MINGW64_VERSION_MAJOR\n> -/*\n> - * In Git for Windows, we cannot rely on `uname -m` to report the correct\n> - * architecture: /usr/bin/uname.exe will report the architecture with which the\n> - * current MSYS2 runtime was built, not the architecture for which we are\n> - * currently compiling (both 32-bit and 64-bit `git.exe` is built in the 64-bit\n> - * Git for Windows SDK).\n> - */\n> -#undef GIT_HOST_CPU\n> -/* This was figured out by looking at `cpp -dM </dev/null`'s output */\n> -#if defined(__x86_64__)\n> -#define GIT_HOST_CPU \"x86_64\"\n> -#elif defined(__i686__)\n> -#define GIT_HOST_CPU \"i686\"\n> -#else\n> -#error \"Unknown architecture\"\n> -#endif\n> -#endif\n> -\n>  /* MinGW-w64 reports to have flockfile, but it does not actually have it. */\n>  #ifdef __MINGW64_VERSION_MAJOR\n>  #undef _POSIX_THREAD_SAFE_FUNCTIONS\n> diff --git a/config.mak.uname b/config.mak.uname\n> index 3ee7da0e23..194f20a8b3 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -553,9 +553,11 @@ else\n>  \t\tprefix = /usr/\n>  \t\tifeq (MINGW32,$(MSYSTEM))\n>  \t\t\tprefix = /mingw32\n> +\t\t\tHOST_CPU = i686\n>  \t\tendif\n>  \t\tifeq (MINGW64,$(MSYSTEM))\n>  \t\t\tprefix = /mingw64\n> +\t\t\tHOST_CPU = x86_64\n>  \t\telse\n>  \t\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n>  \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n"}]}