{"thread":{"id":"36536","subject":"[PATCH 01/12] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64","startedAt":"2014-04-29T09:11:54Z","lastAt":"2014-05-05T12:15:15Z","messageCount":29,"participants":["Marat Radchenko","Karsten Blees","Erik Faye-Lund","Stepan Kasal","Johannes Schindelin","Felipe Contreras","'502304919' via msysGit"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"240131","messageId":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":null,"subject":"[PATCH v2] MinGW(-W64) cross-compilation","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:11:54Z","receivedAt":"2014-04-29T09:11:54Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"Differences with v1:\n - Dropped \"MINGW: compat/bswap.h: include stdint.h\", it isn't needed after\n   \"MINGW: git-compat-util.h: use inttypes.h for printf macros\"\n - Split \"MINGW: config.mak.uname allow using CURL for non-msysGit builds\"\n   into \"MINGW: config.mak.uname: allow using cURL for non-msysGit builds\"\n   and \"MINGW: fix main() signature in http-fetch.c and remote-curl.c\"\n - Reworded \"MINGW: git-compat-util.h: use inttypes.h for printf macros\"\n - Reworded \"MINGW: config.mak.uname: reorganize MINGW settings\"\n - Rewrote \"MINGW: config.mak.uname: drop -DNOGDI\" into\n   \"MINGW: compat/poll/poll.c: undef NOGDI\"\n - Rewrote \"MINGW: config.mak.uname: drop USE_NED_ALLOCATOR\" into\n   \"compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64\"\n - Reworded \"Makefile: introduce CROSS_COMPILE variable\"\n - Reordeder commits (1-5 are Acked by: Eric Faye-Lund <kusmabite@gmail.com>)\n\n=====================================\n\nThis patch series fixes building on modern MinGW and (32bit only yet) MinGW-W64.\n\n*Compilation* tested on:\n - MSVC (via WinGit environment)\n - msysGit environment\n - Linux cross-toolchain i686-pc-mingw32 (4.8.2) with mingw-runtime-3.20.2\n - Linux cross-toolchain i686-w64-mingw32 (4.8.2) with mingw64-runtime-3.1.0\n\nStuff still required to make Git build with x86_64 MinGW-W64 toolchain:\n\n1. Drop -D_USE_32BIT_TIME_T that was added in fa93bb to config.mak.uname\nbecause time_t cannot be 32bit on x86_64. I haven't yet figured out what\nshould break if this define is removed (pointers are welcome) and why it was\nadded in the first place.\n\n2. Stop passing --large-address-aware to linker. I wonder if it does anything\nfor 32bit MinGW builds.\n\n3. Fix several places with mismatched pointer size casts.\n\nBuilding it from Gentoo Linux:\n\nMinGW:\n\n  crossdev -t i686-pc-mingw32\n  ARCH=x86 emerge-i686-pc-mingw32 -u dev-libs/libiconv sys-libs/zlib net-misc/curl sys-devel/gettext expat\n  cd <git>\n  make CROSS_COMPILE=i686-pc-mingw32- NO_OPENSSL=1 MINGW=1 CURLDIR=/usr/i686-pc-mingw32/usr\n\nMinGW-W64 (32 bit):\n\n  crossdev -t i686-w64-mingw32\n  ARCH=x86 emerge-i686-w64-mingw32 -u dev-libs/libiconv sys-libs/zlib net-misc/curl sys-devel/gettext expat\n  cd <git>\n  make CROSS_COMPILE=i686-w64-mingw32- NO_OPENSSL=1 MINGW=1 CURLDIR=/usr/i686-w64-mingw32/usr\n"},{"id":"240127","messageId":"1398762726-22825-2-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 01/12] MINGW: compat/mingw.h: do not attempt to redefine lseek on mingw-w64","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:11:55Z","receivedAt":"2014-04-29T09:11:55Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"Unlike MinGW, MinGW-W64 has lseek already properly defined in io.h.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\nAcked-by: Eric Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.h | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex e033e72..262b300 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -265,7 +265,9 @@ static inline int getrlimit(int resource, struct rlimit *rlp)\n  * Use mingw specific stat()/lstat()/fstat() implementations on Windows.\n  */\n #define off_t off64_t\n+#ifndef lseek\n #define lseek _lseeki64\n+#endif\n \n /* use struct stat with 64 bit st_size */\n #ifdef stat\n-- \n1.9.1\n"},{"id":"240130","messageId":"1398762726-22825-3-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 02/12] MSVC: config.mak.uname: drop -D__USE_MINGW_ACCESS from CFLAGS","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:11:56Z","receivedAt":"2014-04-29T09:11:56Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"-D__USE_MINGW_ACCESS only affects MinGW and does nothing when\nMSVC is used.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\nAcked-by: Eric Faye-Lund <kusmabite@gmail.com>\n---\n config.mak.uname | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 23a8803..faddb82 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -357,7 +357,7 @@ ifeq ($(uname_S),Windows)\n \tCOMPAT_OBJS = compat/msvc.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/dirent.o\n-\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tCOMPAT_CFLAGS = -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib\n \tEXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj\n \tPTHREAD_LIBS =\n-- \n1.9.1\n"},{"id":"240132","messageId":"1398762726-22825-4-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 03/12] MINGW: compat/mingw.h: drop fork() definition","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:11:57Z","receivedAt":"2014-04-29T09:11:57Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"fork() is not used in MinGW builds but causes a compiler warning\non x86_64 MinGW-W64: conflicting types for built-in function 'fork'\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\nAcked-by: Eric Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.h | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 262b300..87d58ba 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -90,8 +90,6 @@ static inline int symlink(const char *oldpath, const char *newpath)\n { errno = ENOSYS; return -1; }\n static inline int fchmod(int fildes, mode_t mode)\n { errno = ENOSYS; return -1; }\n-static inline pid_t fork(void)\n-{ errno = ENOSYS; return -1; }\n static inline unsigned int alarm(unsigned int seconds)\n { return 0; }\n static inline int fsync(int fd)\n-- \n1.9.1\n"},{"id":"240137","messageId":"1398762726-22825-5-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 04/12] MINGW: do not fail at redefining pid_t on MinGW-W64","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:11:58Z","receivedAt":"2014-04-29T09:11:58Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"pid_t is available in sys/types.h on both MinGW and MinGW-W64\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\nAcked-by: Eric Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.h | 1 -\n compat/msvc.h  | 2 ++\n 2 files changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 87d58ba..7e3d038 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -5,7 +5,6 @@\n  * things that are not available in header files\n  */\n \n-typedef int pid_t;\n typedef int uid_t;\n typedef int socklen_t;\n #define hstrerror strerror\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex 580bb55..a63d878 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -15,6 +15,8 @@\n #define strtoull     _strtoui64\n #define strtoll      _strtoi64\n \n+typedef int pid_t;\n+\n static __inline int strcasecmp (const char *s1, const char *s2)\n {\n \tint size1 = strlen(s1);\n-- \n1.9.1\n"},{"id":"240138","messageId":"1398762726-22825-6-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 05/12] MINGW: config.mak.uname: allow using cURL for non-msysGit builds","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:11:59Z","receivedAt":"2014-04-29T09:11:59Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"Is it absolutely valid and possible to have cURL in generic\nMinGW environment. Building Git without cURL is still possible\nby passing NO_CURL=1\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\nAcked-by: Eric Faye-Lund <kusmabite@gmail.com>\n---\n config.mak.uname | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex faddb82..a626410 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -519,8 +519,6 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n \tINTERNAL_QSORT = YesPlease\n \tHAVE_LIBCHARSET_H = YesPlease\n \tNO_GETTEXT = YesPlease\n-else\n-\tNO_CURL = YesPlease\n endif\n endif\n ifeq ($(uname_S),QNX)\n-- \n1.9.1\n"},{"id":"240139","messageId":"1398762726-22825-7-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 06/12] MINGW: git-compat-util.h: use inttypes.h for printf macros","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:00Z","receivedAt":"2014-04-29T09:12:00Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"All MinGW flavors have inttypes.h, so just include it.\n\nHowever, we need to pass -D__USE_MINGW_ANSI_STDIO=0 to select\nMSVCRT-compatible macro definitions on MinGW-W64:\nhttp://sourceforge.net/apps/trac/mingw-w64/wiki/gnu%20printf\n\nAs a side-effect, Git no longer builds with MSVC < 2010 due to\nits lack of stdint.h but hopefully that is not a problem.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n compat/mingw.h    |  2 --\n compat/msvc.h     |  3 +++\n config.mak.uname  |  3 ++-\n git-compat-util.h | 11 ++++++-----\n 4 files changed, 11 insertions(+), 8 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 7e3d038..2fbc8ea 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -339,8 +339,6 @@ static inline char *mingw_find_last_dir_sep(const char *path)\n }\n #define find_last_dir_sep mingw_find_last_dir_sep\n #define PATH_SEP ';'\n-#define PRIuMAX \"I64u\"\n-#define PRId64 \"I64d\"\n \n void mingw_open_html(const char *path);\n #define open_html mingw_open_html\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex a63d878..84a03f9 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -17,6 +17,9 @@\n \n typedef int pid_t;\n \n+#define PRIuMAX \"I64u\"\n+#define PRId64 \"I64d\"\n+\n static __inline int strcasecmp (const char *s1, const char *s2)\n {\n \tint size1 = strlen(s1);\ndiff --git a/config.mak.uname b/config.mak.uname\nindex a626410..50c1114 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -316,6 +316,7 @@ ifeq ($(uname_S),Windows)\n \tNO_PREAD = YesPlease\n \tNEEDS_CRYPTO_WITH_SSL = YesPlease\n \tNO_LIBGEN_H = YesPlease\n+\tNO_INTTYPES_H = UnfortunatelyYes\n \tNO_POLL = YesPlease\n \tNO_SYMLINK_HEAD = YesPlease\n \tNO_IPV6 = YesPlease\n@@ -497,7 +498,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_INET_NTOP = YesPlease\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tDEFAULT_HELP_FORMAT = html\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex f6d3a46..65498a2 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -95,6 +95,12 @@\n #define GIT_WINDOWS_NATIVE\n #endif\n \n+#ifndef NO_INTTYPES_H\n+#include <inttypes.h>\n+#else\n+#include <stdint.h>\n+#endif\n+\n #include <unistd.h>\n #include <stdio.h>\n #include <sys/stat.h>\n@@ -146,11 +152,6 @@\n #include <netdb.h>\n #include <pwd.h>\n #include <sys/un.h>\n-#ifndef NO_INTTYPES_H\n-#include <inttypes.h>\n-#else\n-#include <stdint.h>\n-#endif\n #ifdef NO_INTPTR_T\n /*\n  * On I16LP32, ILP32 and LP64 \"long\" is the save bet, however\n-- \n1.9.1\n"},{"id":"240136","messageId":"1398762726-22825-8-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 07/12] MINGW: config.mak.uname: reorganize MINGW settings","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:01Z","receivedAt":"2014-04-29T09:12:01Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"HAVE_LIBCHARSET_H and NO_R_TO_GCC_LINKER are not specific to\nmsysGit, they're general MinGW settings.\n\nLogic behind HAVE_LIBCHARSET_H: if user is on MinGW and has iconv,\nwe expect him to have libcharset.h. If user doesn't have iconv,\nhe has to explicitly say so via NO_ICONV=1.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n config.mak.uname | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 50c1114..b68a7d1 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -516,11 +516,11 @@ ifneq (,$(wildcard ../THIS_IS_MSYSGIT))\n \tprefix =\n \tINSTALL = /bin/install\n \tEXTLIBS += /mingw/lib/libz.a\n-\tNO_R_TO_GCC_LINKER = YesPlease\n \tINTERNAL_QSORT = YesPlease\n-\tHAVE_LIBCHARSET_H = YesPlease\n \tNO_GETTEXT = YesPlease\n endif\n+\tHAVE_LIBCHARSET_H = YesPlease\n+\tNO_R_TO_GCC_LINKER = YesPlease\n endif\n ifeq ($(uname_S),QNX)\n \tCOMPAT_CFLAGS += -DSA_RESTART=0\n-- \n1.9.1\n"},{"id":"240129","messageId":"1398762726-22825-9-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:02Z","receivedAt":"2014-04-29T09:12:02Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"On MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.\nFix `warning: passing argument 2 of 'mingw_main' from incompatible\npointer type` in http-fetch.c and remote-curl.c by dropping 'const'.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n http-fetch.c  | 5 +++--\n remote-curl.c | 2 +-\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex ba3ea10..a6a9a2f 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -6,7 +6,7 @@\n static const char http_fetch_usage[] = \"git http-fetch \"\n \"[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url\";\n \n-int main(int argc, const char **argv)\n+int main(int argc, char **argv)\n {\n \tstruct walker *walker;\n \tint commits_on_stdin = 0;\n@@ -38,7 +38,8 @@ int main(int argc, const char **argv)\n \t\t} else if (argv[arg][1] == 'v') {\n \t\t\tget_verbosely = 1;\n \t\t} else if (argv[arg][1] == 'w') {\n-\t\t\twrite_ref = &argv[arg + 1];\n+\t\t\tconst char *ref = argv[arg + 1];\n+\t\t\twrite_ref = &ref;\n \t\t\targ++;\n \t\t} else if (argv[arg][1] == 'h') {\n \t\t\tusage(http_fetch_usage);\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 52c2d96..565b6c9 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -938,7 +938,7 @@ static void parse_push(struct strbuf *buf)\n \tfree(specs);\n }\n \n-int main(int argc, const char **argv)\n+int main(int argc, char **argv)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n \tint nongit;\n-- \n1.9.1\n"},{"id":"240128","messageId":"1398762726-22825-10-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 09/12] Makefile: introduce CROSS_COMPILE variable","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:03Z","receivedAt":"2014-04-29T09:12:03Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"To ease cross-compilation process, introduce a single variable\nwith the prefix to all compiler-related executables.\n\nDefine CROSS_COMPILE=foo- if your compiler and binary utilities\nare foo-cc, foo-ar, foo-strip, etc.  More specific variables\noverride this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-\nthen the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n Makefile         | 19 +++++++++++++------\n config.mak.uname |  2 +-\n 2 files changed, 14 insertions(+), 7 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 74a929b..8406b94 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -350,6 +350,11 @@ all::\n #\n # Define GMTIME_UNRELIABLE_ERRORS if your gmtime() function does not\n # return NULL when it receives a bogus time_t.\n+#\n+# Define CROSS_COMPILE=foo- if your compiler and binary utilities\n+# are foo-cc, foo-ar, foo-strip, etc.  More specific variables\n+# override this, so if you set CC=gcc CROSS_COMPILE=ia64-linux-gnu-\n+# then the compiler will be 'gcc', not 'ia64-linux-gnu-gcc'.\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n@@ -361,7 +366,6 @@ CFLAGS = -g -O2 -Wall\n LDFLAGS =\n ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)\n ALL_LDFLAGS = $(LDFLAGS)\n-STRIP ?= strip\n \n # Among the variables below, these:\n #   gitexecdir\n@@ -401,8 +405,12 @@ htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))\n \n export prefix bindir sharedir sysconfdir gitwebdir localedir\n \n-CC = cc\n-AR = ar\n+AR = $(CROSS_COMPILE)ar\n+CC = $(CROSS_COMPILE)cc\n+GCOV = $(CROSS_COMPILE)gcov\n+RC = $(CROSS_COMPILE)windres\n+STRIP = $(CROSS_COMPILE)strip\n+\n RM = rm -f\n DIFF = diff\n TAR = tar\n@@ -415,13 +423,12 @@ XGETTEXT = xgettext\n MSGFMT = msgfmt\n PTHREAD_LIBS = -lpthread\n PTHREAD_CFLAGS =\n-GCOV = gcov\n \n export TCL_PATH TCLTK_PATH\n \n SPARSE_FLAGS =\n \n-\n+RCFLAGS =\n \n ### --- END CONFIGURATION SECTION ---\n \n@@ -1796,7 +1803,7 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES\n \tmv $@+ $@\n \n git.res: git.rc GIT-VERSION-FILE\n-\t$(QUIET_RC)$(RC) \\\n+\t$(QUIET_RC)$(RC) $(RCFLAGS) \\\n \t  $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \\\n \t  -DGIT_VERSION=\"\\\\\\\"$(GIT_VERSION)\\\\\\\"\" $< -o $@\n \ndiff --git a/config.mak.uname b/config.mak.uname\nindex b68a7d1..d5f7953 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -507,7 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tEXTLIBS += -lws2_32\n \tGITLIBS += git.res\n \tPTHREAD_LIBS =\n-\tRC = windres -O coff\n+\tRCFLAGS += -O coff\n \tNATIVE_CRLF = YesPlease\n \tX = .exe\n \tSPARSE_FLAGS = -Wno-one-bit-signed-bitfield\n-- \n1.9.1\n"},{"id":"240134","messageId":"1398762726-22825-11-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:04Z","receivedAt":"2014-04-29T09:12:04Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.\n\nRemoval -DNOGDI=1 from config.mak.uname has an undesirable effect of\nbringing in wingdi.h with weird #define ERROR 0 that conflicts with\ninternal Git enums. So, just #undef NOGDI in compat/poll/poll.c.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n compat/poll/poll.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/compat/poll/poll.c b/compat/poll/poll.c\nindex 31163f2..e38cba8 100644\n--- a/compat/poll/poll.c\n+++ b/compat/poll/poll.c\n@@ -38,6 +38,7 @@\n #include <assert.h>\n \n #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n+# undef NOGDI\n # define WIN32_NATIVE\n # if defined (_MSC_VER) && !defined(_WIN32_WINNT)\n #  define _WIN32_WINNT 0x0502\n-- \n1.9.1\n"},{"id":"240135","messageId":"1398762726-22825-12-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 11/12] compat/nedmalloc/malloc.c.h: fix compilation under MinGW-W64","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:05Z","receivedAt":"2014-04-29T09:12:05Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"1. Unlike MinGW, MinGW-W64 already provides _ReadWriteBarrier macro,\n   so don't try to redefine it.\n\n2. MinGW-W64 has a strange definition FORCEINLINE as\n   extern __inline__ __attribute__((__always_inline__,__gnu_inline__))\n\n   'extern' doesn't work together with 'static', so #undef MinGW-W64\n   version of FORCEINLINE.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n compat/nedmalloc/malloc.c.h | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\nindex f216a2a..a6c8cac 100644\n--- a/compat/nedmalloc/malloc.c.h\n+++ b/compat/nedmalloc/malloc.c.h\n@@ -715,6 +715,10 @@ struct mallinfo {\n #endif /* HAVE_USR_INCLUDE_MALLOC_H */\n #endif /* NO_MALLINFO */\n \n+#ifdef __MINGW64_VERSION_MAJOR\n+  #undef FORCEINLINE\n+#endif\n+\n /*\n   Try to persuade compilers to inline. The most critical functions for\n   inlining are defined as macros, so these aren't used for them.\n@@ -1382,7 +1386,9 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);\n \n   /*** Atomic operations ***/\n   #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100\n-    #define _ReadWriteBarrier() __sync_synchronize()\n+    #ifndef _ReadWriteBarrier\n+      #define _ReadWriteBarrier() __sync_synchronize()\n+    #endif\n   #else\n     static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)\n     {\n-- \n1.9.1\n"},{"id":"240133","messageId":"1398762726-22825-13-git-send-email-marat@slonopotamus.org","threadId":"36536","inReplyTo":"1398762726-22825-1-git-send-email-marat@slonopotamus.org","subject":"[PATCH 12/12] MINGW: config.mak.uname: add explicit way to request MinGW-build","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-04-29T09:12:06Z","receivedAt":"2014-04-29T09:12:06Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"When crosscompiling, one cannot rely on `uname` from host system.\nThus, add an option to use `make MINGW=1` for building MinGW build\nfrom non-MinGW host (Linux, for example).\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n config.mak.uname | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex d5f7953..c7f3d74 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -13,6 +13,11 @@ ifdef MSVC\n \tuname_O := Windows\n endif\n \n+ifdef MINGW\n+\tuname_S := MINGW\n+\tuname_O := MINGW\n+endif\n+\n # We choose to avoid \"if .. else if .. else .. endif endif\"\n # because maintaining the nesting to match is a pain.  If\n # we had \"elif\" things would have been much nicer...\n-- \n1.9.1\n"},{"id":"240275","messageId":"5360B5EC.1070907@gmail.com","threadId":"36536","inReplyTo":"1398762726-22825-9-git-send-email-marat@slonopotamus.org","subject":"Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Karsten Blees","fromEmail":"karsten.blees@gmail.com","sentAt":"2014-04-30T08:35:56Z","receivedAt":"2014-04-30T08:35:56Z","isPatch":true,"sender":{"key":"karsten.blees@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1111200?v=4"},"body":"Am 29.04.2014 11:12, schrieb Marat Radchenko:\n> On MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.\n> Fix `warning: passing argument 2 of 'mingw_main' from incompatible\n> pointer type` in http-fetch.c and remote-curl.c by dropping 'const'.\n> \n\nWould you mind cross checking your changes with the msysgit fork? Fixing the same thing in a slightly different manner will just cause unnecessary conflicts (i.e. unnecessary work for the Git for Windows maintainers, as well as for you to come up with an alternate solution for something that's long been fixed).\n\nSee https://github.com/msysgit/git/commit/9206e7fd (squashed from https://github.com/msysgit/git/commit/0115ef83 and https://github.com/msysgit/git/commit/6949537a).\n \n"},{"id":"240276","messageId":"CABPQNSbSipaCAgJV0LimP-J1-WOXHQU5w9qOoBq-ccRYQFrAxw@mail.gmail.com","threadId":"36536","inReplyTo":"5360B5EC.1070907@gmail.com","subject":"Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2014-04-30T08:56:10Z","receivedAt":"2014-04-30T08:56:10Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Wed, Apr 30, 2014 at 10:35 AM, Karsten Blees <karsten.blees@gmail.com> wrote:\n> Am 29.04.2014 11:12, schrieb Marat Radchenko:\n>> On MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.\n>> Fix `warning: passing argument 2 of 'mingw_main' from incompatible\n>> pointer type` in http-fetch.c and remote-curl.c by dropping 'const'.\n>>\n>\n> Would you mind cross checking your changes with the msysgit fork? Fixing the same thing in a slightly different manner will just cause unnecessary conflicts (i.e. unnecessary work for the Git for Windows maintainers, as well as for you to come up with an alternate solution for something that's long been fixed).\n>\n> See https://github.com/msysgit/git/commit/9206e7fd (squashed from https://github.com/msysgit/git/commit/0115ef83 and https://github.com/msysgit/git/commit/6949537a).\n>\n\nWhile it's certainly a good point, I think this is *our* fault for not\nupstreaming our changes, and the responsibility of cleaning up merges\nshould lie on our shoulders. We've diverged a lot. Sure, Dscho does a\ngreat job making the divergence less painful, but IMO we should try to\nreduce the delta as well.\n\nFor instance, I think the Unicode-support patches have proven\nthemselves by now and should go upstream. And there's probably a ton\nof smaller free-standing clean-ups that could get the same treatment.\n"},{"id":"240297","messageId":"20140430114125.GA23046@camelia.ucw.cz","threadId":"36536","inReplyTo":"1398762726-22825-11-git-send-email-marat@slonopotamus.org","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-04-30T11:41:25Z","receivedAt":"2014-04-30T11:41:25Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"Hello,\n\nOn Tue, Apr 29, 2014 at 01:12:04PM +0400, Marat Radchenko wrote:\n> On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.\n> \n> Removal -DNOGDI=1 from config.mak.uname has an undesirable effect of\n> bringing in wingdi.h with weird #define ERROR 0 that conflicts with\n> internal Git enums. So, just #undef NOGDI in compat/poll/poll.c.\n\ncompat/poll/poll.c comes from Gnulib, so it would be better to submit\nthe patch there and then backport so that the divergence of the two\nversions does not get worse.\n\nStepan\n"},{"id":"240300","messageId":"alpine.DEB.1.00.1404301424590.14982@s15462909.onlinehome-server.info","threadId":"36536","inReplyTo":"CABPQNSbSipaCAgJV0LimP-J1-WOXHQU5w9qOoBq-ccRYQFrAxw@mail.gmail.com","subject":"Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2014-04-30T12:31:01Z","receivedAt":"2014-04-30T12:31:01Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi kusma,\n\nOn Wed, 30 Apr 2014, Erik Faye-Lund wrote:\n\n> While it's certainly a good point, I think this is *our* fault for not\n> upstreaming our changes, and the responsibility of cleaning up merges\n> should lie on our shoulders. We've diverged a lot. Sure, Dscho does a\n> great job making the divergence less painful, but IMO we should try to\n> reduce the delta as well.\n\nJust for historical context: we *did* try to get our changes upstream. In\nfact, that was in large part everything Steffen Prohaska did while he was\nmaintaining Git for Windows. The going has been tough, though, to the\npoint that we were losing contributors who were not *quite* willing to put\nup with such a detailed vetting process as the Git mailing list requires.\n\nI have to admit that it is really, really hard even for someone like me,\nwho is used to the ways of the Git mailing list, because just a simple\nthing like this curl-config issue already eats up several days of my Git\ntime budget.\n\nSo while I am sympathetic to the point of view that the Git for Windows\nproject failed to upstream its changes, I am *equally* sympathetic to the\npoint of view that it is an undue burden to have to go through the process\nof getting patches included by upstream Git. I, for one, simply ain't got\nthe time, man.\n\nCiao,\nJohannes\n"},{"id":"240333","messageId":"5361270f70fed_1404fdd3102e@nysa.notmuch","threadId":"36536","inReplyTo":"alpine.DEB.1.00.1404301424590.14982@s15462909.onlinehome-server.info","subject":"Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-30T16:38:39Z","receivedAt":"2014-04-30T16:38:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Johannes Schindelin wrote:\n> On Wed, 30 Apr 2014, Erik Faye-Lund wrote:\n> \n> > While it's certainly a good point, I think this is *our* fault for not\n> > upstreaming our changes, and the responsibility of cleaning up merges\n> > should lie on our shoulders. We've diverged a lot. Sure, Dscho does a\n> > great job making the divergence less painful, but IMO we should try to\n> > reduce the delta as well.\n> \n> Just for historical context: we *did* try to get our changes upstream. In\n> fact, that was in large part everything Steffen Prohaska did while he was\n> maintaining Git for Windows. The going has been tough, though, to the\n> point that we were losing contributors who were not *quite* willing to put\n> up with such a detailed vetting process as the Git mailing list requires.\n> \n> I have to admit that it is really, really hard even for someone like me,\n> who is used to the ways of the Git mailing list, because just a simple\n> thing like this curl-config issue already eats up several days of my Git\n> time budget.\n> \n> So while I am sympathetic to the point of view that the Git for Windows\n> project failed to upstream its changes, I am *equally* sympathetic to the\n> point of view that it is an undue burden to have to go through the process\n> of getting patches included by upstream Git. I, for one, simply ain't got\n> the time, man.\n\nAs a maintainer of another friendly fork of Git (or downstream), because\nof very similar reaons, I symphathize.\n\nIt's something that has to be done though, otherwise the burden of\nmaintaining the friendly fork becomse unberable.\n\nThe trick is to only send the trivial patches upstream, and also to\nconstantly keep track of what is missing from upstream.\n\nIn oder to do this I've found invaluable to have an integration branch,\nwhich I constnatly regenerate with `git reintegrate`[1]. IIRC you do a\nsimilar kind of reintegration for each new release of msysgit, and it\nappears to me that you do it by hand, which must be tedious.\n\nI'm planning to write a blog post about the subject, but basically I\nhave a bunch of branches that are direct descendants of an upstream\nversion, I tell `git reintegrate` to merge them on top of certain\nupstream release, the result must match *exactly* what my main master\nbranch has. The descendant branches I constanly keep rebasing, and the\nmain master branch always mergering and cherry-picking, never rebasing.\n\n[1] https://github.com/felipec/git-reintegrate\n\n-- \nFelipe Contreras\n"},{"id":"240389","messageId":"20140430221728.GA27914@camelia.ucw.cz","threadId":"36536","inReplyTo":"5360B5EC.1070907@gmail.com","subject":"Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-04-30T22:17:28Z","receivedAt":"2014-04-30T22:17:28Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"Hello,\n\nOn Wed, Apr 30, 2014 at 10:35:56AM +0200, Karsten Blees wrote:\n> Would you mind cross checking your changes with the msysgit fork?\n> [...]\n> See https://github.com/msysgit/git/commit/9206e7fd (squashed from\n> https://github.com/msysgit/git/commit/0115ef83 and\n> https://github.com/msysgit/git/commit/6949537a).\n\nOK, I _did_ checked these, let's look at the two original commits:\n\n- 0115ef83 is interesting, but not relevant to the warnings,\n- 6949537a contains a fix for the const warning, plus it fixed a\n  minor nit in the other commit.\n\n> [...] you to come up with an\n> alternate solution for something that's long been fixed).\n\nLong been fixed by a quick and dirty hack.\nMarat's fix is nicer, can I ask some of the msysGit guys to ack it?\n(Appended below for the new cc's here.)\n\nHave a nice day,\n\tStepan\n\nPS: I bet Dscho will be able to handle the conflict.\n\nFrom: Marat Radchenko <marat@slonopotamus.org>\nSubject: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c\nDate: Tue, 29 Apr 2014 13:12:02 +0400\n\nOn MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.\nFix `warning: passing argument 2 of 'mingw_main' from incompatible\npointer type` in http-fetch.c and remote-curl.c by dropping 'const'.\n\nSigned-off-by: Marat Radchenko <marat@slonopotamus.org>\n---\n http-fetch.c  | 5 +++--\n remote-curl.c | 2 +-\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex ba3ea10..a6a9a2f 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -6,7 +6,7 @@\n static const char http_fetch_usage[] = \"git http-fetch \"\n \"[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url\";\n \n-int main(int argc, const char **argv)\n+int main(int argc, char **argv)\n {\n \tstruct walker *walker;\n \tint commits_on_stdin = 0;\n@@ -38,7 +38,8 @@ int main(int argc, const char **argv)\n \t\t} else if (argv[arg][1] == 'v') {\n \t\t\tget_verbosely = 1;\n \t\t} else if (argv[arg][1] == 'w') {\n-\t\t\twrite_ref = &argv[arg + 1];\n+\t\t\tconst char *ref = argv[arg + 1];\n+\t\t\twrite_ref = &ref;\n \t\t\targ++;\n \t\t} else if (argv[arg][1] == 'h') {\n \t\t\tusage(http_fetch_usage);\ndiff --git a/remote-curl.c b/remote-curl.c\nindex 52c2d96..565b6c9 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -938,7 +938,7 @@ static void parse_push(struct strbuf *buf)\n \tfree(specs);\n }\n \n-int main(int argc, const char **argv)\n+int main(int argc, char **argv)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n \tint nongit;\n-- \n1.9.1\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe git\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"240390","messageId":"20140430222836.GB27914@camelia.ucw.cz","threadId":"36536","inReplyTo":"20140430221728.GA27914@camelia.ucw.cz","subject":"[PATCH] Win32: move main macro to a function","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-04-30T22:28:36Z","receivedAt":"2014-04-30T22:28:36Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"From: Karsten Blees <blees@dcon.de>\nDate: Fri, 7 Jan 2011 19:47:23 +0100\n\nThe code in the MinGW main macro is getting more and more complex,\nmove to a separate initialization function for readabiliy and\nextensibility.\n\nSigned-off-by: Karsten Blees <blees@dcon.de>\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\nSigned-off-by: Stepan Kasal <kasal@ucw.cz>\n---\n\nHello,\n  this is commit 0115ef83 alias 9206e7fd that Karsten mentioned.\n\nJunio, this one has been in msysgit for 2 or 3 years, so you can\nsuppose it is acked.\n\nHave a nice day,\n\tStepan\n\n compat/mingw.c | 15 +++++++++++++++\n compat/mingw.h | 16 +++++-----------\n 2 files changed, 20 insertions(+), 11 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex e9892f8..1d11e9f 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1823,3 +1823,18 @@ pid_t waitpid(pid_t pid, int *status, int options)\n \terrno = EINVAL;\n \treturn -1;\n }\n+\n+void mingw_startup()\n+{\n+\t/* copy executable name to argv[0] */\n+\t__argv[0] = xstrdup(_pgmptr);\n+\n+\t/* initialize critical section for waitpid pinfo_t list */\n+\tInitializeCriticalSection(&pinfo_cs);\n+\n+\t/* set up default file mode and file modes for stdin/out/err */\n+\t_fmode = _O_BINARY;\n+\t_setmode(_fileno(stdin), _O_BINARY);\n+\t_setmode(_fileno(stdout), _O_BINARY);\n+\t_setmode(_fileno(stderr), _O_BINARY);\n+}\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex e033e72..95bcc75 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -361,22 +361,16 @@ void free_environ(char **env);\n extern CRITICAL_SECTION pinfo_cs;\n \n /*\n- * A replacement of main() that ensures that argv[0] has a path\n- * and that default fmode and std(in|out|err) are in binary mode\n+ * A replacement of main() that adds win32 specific initialization.\n  */\n \n+void mingw_startup();\n #define main(c,v) dummy_decl_mingw_main(); \\\n static int mingw_main(c,v); \\\n-int main(int argc, char **argv) \\\n+int main(c,v) \\\n { \\\n-\textern CRITICAL_SECTION pinfo_cs; \\\n-\t_fmode = _O_BINARY; \\\n-\t_setmode(_fileno(stdin), _O_BINARY); \\\n-\t_setmode(_fileno(stdout), _O_BINARY); \\\n-\t_setmode(_fileno(stderr), _O_BINARY); \\\n-\targv[0] = xstrdup(_pgmptr); \\\n-\tInitializeCriticalSection(&pinfo_cs); \\\n-\treturn mingw_main(argc, argv); \\\n+\tmingw_startup(); \\\n+\treturn mingw_main(__argc, __argv); \\\n } \\\n static int mingw_main(c,v)\n \n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"240612","messageId":"20140503070050.GA8580@seldon","threadId":"36536","inReplyTo":"20140430114125.GA23046@camelia.ucw.cz","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-05-03T07:00:51Z","receivedAt":"2014-05-03T07:00:51Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"On Wed, Apr 30, 2014 at 01:41:25PM +0200, Stepan Kasal wrote:\n> Hello,\n> \n> On Tue, Apr 29, 2014 at 01:12:04PM +0400, Marat Radchenko wrote:\n> > On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.\n> > \n> > Removal -DNOGDI=1 from config.mak.uname has an undesirable effect of\n> > bringing in wingdi.h with weird #define ERROR 0 that conflicts with\n> > internal Git enums. So, just #undef NOGDI in compat/poll/poll.c.\n> \n> compat/poll/poll.c comes from Gnulib, so it would be better to submit\n> the patch there and then backport so that the divergence of the two\n> versions does not get worse.\n\nThat's why v1 of this patch [1] didn't touch poll.c at all.\nI don't think it's gnulib problem that combination of two third-parties\n(git and mingw-w64) set up such conditions where poll.c fails to compile.\n\nIf one wants to dig deeper, I'd say the problem is in MinGW-W64 headers\nbecause their behavior of hiding MsgWaitForMultipleObjects doesn't\nmatch behavior of MSVC headers.\n"},{"id":"240614","messageId":"20140503074341.GA8960@seldon","threadId":"36536","inReplyTo":"5360B5EC.1070907@gmail.com","subject":"Re: [PATCH 08/12] MINGW: fix main() signature in http-fetch.c and remote-curl.c","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-05-03T07:43:41Z","receivedAt":"2014-05-03T07:43:41Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"On Wed, Apr 30, 2014 at 10:35:56AM +0200, Karsten Blees wrote:\n> Am 29.04.2014 11:12, schrieb Marat Radchenko:\n> > On MinGW, compat/mingw.h defines a 'mingw_main' wrapper function.\n> > Fix `warning: passing argument 2 of 'mingw_main' from incompatible\n> > pointer type` in http-fetch.c and remote-curl.c by dropping 'const'.\n> > \n> \n> Would you mind cross checking your changes with the msysgit fork?\n> Fixing the same thing in a slightly different manner will just cause\n> unnecessary conflicts (i.e. unnecessary work for the Git for Windows\n> maintainers, as well as for you to come up with an alternate solution\n> for something that's long been fixed).\n>\n> See https://github.com/msysgit/git/commit/9206e7fd (squashed from\n> https://github.com/msysgit/git/commit/0115ef83 and\n> https://github.com/msysgit/git/commit/6949537a). \n\n6949537a is just an unnecessary hack and would have to be rewritten\nno matter who would try to submit it upstream.\n"},{"id":"240695","messageId":"20140504185244.GA17183@camelia.ucw.cz","threadId":"36536","inReplyTo":"20140503070050.GA8580@seldon","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-05-04T18:52:44Z","receivedAt":"2014-05-04T18:52:44Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"Hello Marat,\n\nOn Sat, May 03, 2014 at 11:00:51AM +0400, Marat Radchenko wrote:\n> On Wed, Apr 30, 2014 at 01:41:25PM +0200, Stepan Kasal wrote:\n> > On Tue, Apr 29, 2014 at 01:12:04PM +0400, Marat Radchenko wrote:\n> > > On MinGW-W64, MsgWaitForMultipleObjects is guarded with #ifndef NOGDI.\n> > > \n> > > Removal -DNOGDI=1 from config.mak.uname has an undesirable effect of\n[..]\n> > \n> > compat/poll/poll.c comes from Gnulib, so it would be better to submit\n[..]\n> \n> That's why v1 of this patch [1] didn't touch poll.c at all.\n\nouch!  It looks like you everyone sending you elsewhere.  I apologize\nfor being part of that.  (I was not aware about the previous version.)\n\n> I don't think it's gnulib problem that combination of two third-parties\n> (git and mingw-w64) set up such conditions where poll.c fails to compile.\n\nWell, yes and no: gnulib is mostly a collection of compatibility\nreimplementaions of functions that should be available on an ideal\nsystem.\n\n> If one wants to dig deeper, I'd say the problem is in MinGW-W64 headers\n> because their behavior of hiding MsgWaitForMultipleObjects doesn't\n> match behavior of MSVC headers.\n\nThank you very much for this analysis.\nIt enables us to redirect you the third time: to report this as a\nbug in MinGW-W64 !  ;-)\n\nSeriously, it looks you found the best description of the problem,\nand it would be nice if you could modify your patch so that it\nis really a work around: it would be in effect only for MinGW-W64,\nand the comment would explain that this is a hack to work around the\nbug.  \n\nIf you manage to change the defs for poll.c without changing its\ncontent, no one could tell you to report to gnulib first.\n\nOTOH, if MsgWaitForMultipleObjects is present ustream (in gnulib's\npoll.c, sorry that I cannot check right now), it still might be\nbetter to submit the work-around there first.\n\nThanks for your work,\n\tStepan Kasal\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"240700","messageId":"53669faf17247_61fea2d30c14@nysa.notmuch","threadId":"36536","inReplyTo":"20140503070050.GA8580@seldon","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-04T20:14:39Z","receivedAt":"2014-05-04T20:14:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Marat Radchenko wrote:\n> If one wants to dig deeper, I'd say the problem is in MinGW-W64\n> headers because their behavior of hiding MsgWaitForMultipleObjects\n> doesn't match behavior of MSVC headers.\n\nI agree with that. Can you file a bug report?\n\n-- \nFelipe Contreras\n"},{"id":"240701","messageId":"20140504205552.GA15590@seldon","threadId":"36536","inReplyTo":"20140504185244.GA17183@camelia.ucw.cz","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Marat Radchenko","fromEmail":"marat@slonopotamus.org","sentAt":"2014-05-04T20:55:52Z","receivedAt":"2014-05-04T20:55:52Z","isPatch":true,"sender":{"key":"marat@slonopotamus.org","avatar":"https://avatars.githubusercontent.com/u/92637?v=4"},"body":"On Sun, May 04, 2014 at 08:52:44PM +0200, Stepan Kasal wrote:\n> Thank you very much for this analysis.\n> It enables us to redirect you the third time: to report this as a\n> bug in MinGW-W64 !  ;-)\n\nI'll report this to MinGW-W64 soon, though even if/when they fix\nthe issue on their side, I'd still like to have a workaround in\nGit to be able to use older MinGW-W64 versions that didn't\nreceive a fix.\n\n> Seriously, it looks you found the best description of the problem,\n> and it would be nice if you could modify your patch so that it\n> is really a work around: it would be in effect only for MinGW-W64,\n> and the comment would explain that this is a hack to work around the\n> bug.  \n\nWorkarounds do not have to be ugly and full of #ifdef's.\n\n> If you manage to change the defs for poll.c without changing its\n> content, no one could tell you to report to gnulib first.\n\nv1 does exactly this.\n\n> OTOH, if MsgWaitForMultipleObjects is present ustream (in gnulib's\n> poll.c, sorry that I cannot check right now), it still might be\n> better to submit the work-around there first.\n\nWorkaround is \"just don't pass -DNOGDI on MinGW-W64 if you want\nMsgWaitForMultipleObjects\", there's nothing to send to gnulib.\nAfter all, was there a strong reason why Git started passing it?\nWhat is there was no option to disable part of windows.h?\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"240782","messageId":"1E023E9C-FDD6-47A5-9E7C-6D43F9167EEB@aol.com","threadId":"36536","inReplyTo":"20140504205552.GA15590@seldon","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"'502304919' via msysGit","fromEmail":"msysgit@googlegroups.com","sentAt":"2014-05-04T21:46:29Z","receivedAt":"2014-05-04T21:46:29Z","isPatch":true,"sender":{"key":"name:'502304919'","avatar":null},"body":"I've added this to my to-do list. On May 4, 2014 at 3:55:52 PM CDT, Marat Radchenko <marat@slonopotamus.org> wrote:On Sun, May 04, 2014 at 08:52:44PM +0200, Stepan Kasal wrote:> Thank you very much for this analysis.> It enables us to redirect you the third time: to report this as a> bug in MinGW-W64 ! ;-)I'll report this to MinGW-W64 soon, though even if/when they fixthe issue on their side, I'd still like to have a workaround inGit to be able to use older MinGW-W64 versions that didn'treceive a fix.> Seriously, it looks you found the best description of the problem,> and it would be nice if you could modify your patch so that it> is really a work around: it would be in effect only for MinGW-W64,> and the comment would explain that this is a hack to work around the> bug. Workarounds do not have to be ugly and full of #ifdef's.> If you manage to change the defs for poll.c without changing its> content, no one could tell you to report to gnulib first.v1 does exactly this.> OTOH, if MsgWaitForMultipleObjects is present ustream (in gnulib's> poll.c, sorry that I cannot check right now), it still might be> better to submit the work-around there first.Workaround is \"just don't pass -DNOGDI on MinGW-W64 if you wantMsgWaitForMultipleObjects\", there's nothing to send to gnulib.After all, was there a strong reason why Git started passing it?What is there was no option to disable part of windows.h?--To unsubscribe from this list: send the line \"unsubscribe git\" inthe body of a message to majordomo@vger.kernel.orgMore majordomo info at http://vger.kernel.org/majordomo-info.html     \n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"240709","messageId":"53673e7b65c4d_78fd70f2ec46@nysa.notmuch","threadId":"36536","inReplyTo":"20140505073547.GB20599@camelia.ucw.cz","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-05T07:32:11Z","receivedAt":"2014-05-05T07:32:11Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Stepan Kasal wrote:\n> diff --git a/config.mak.uname b/config.mak.uname\n> index 82b8dff..446dd41 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -508,7 +508,11 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n>  \tNO_POSIX_GOODIES = UnfortunatelyYes\n>  \tDEFAULT_HELP_FORMAT = html\n>  \tNO_D_INO_IN_DIRENT = YesPlease\n> -\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n> +\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -Icompat -Icompat/win32\n> +ifneq ($(uname_M),x86_64)\n> +\t# MinGW-W64 < x.y headers do not provide MsgWaitForMultipleObjects with NOGDI\n\nMinGW-w64 != x86_64; it provides a i686 compiler as well.\n\n-- \nFelipe Contreras\n"},{"id":"240708","messageId":"20140505073547.GB20599@camelia.ucw.cz","threadId":"36536","inReplyTo":"20140504205552.GA15590@seldon","subject":"Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-05-05T07:35:47Z","receivedAt":"2014-05-05T07:35:47Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"Hello,\n\nOn Mon, May 05, 2014 at 12:55:52AM +0400, Marat Radchenko wrote:\n> On Sun, May 04, 2014 at 08:52:44PM +0200, Stepan Kasal wrote:\n> > is really a work around: it would be in effect only for MinGW-W64,\n> > and the comment would explain that this is a hack to work around the\n> > bug.  \n> \n> Workarounds do not have to be ugly and full of #ifdef's.\n\nI'm afraid they have to.  If you just select one of the reasonable\nvariants, without noting that the other ones would trigger a bug, you\nare lying a trap for future contributors.\n\n> > If you manage to change the defs for poll.c without changing its\n> > content, no one could tell you to report to gnulib first.\n> \n> v1 does exactly this.\n\nYes, but it changes the define for other configurations as well\n(MSVC, mingw 32bit).  I would suggest something along the change\nbelow.\n\nWhat do you think?\n\nStepan\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 82b8dff..446dd41 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -508,7 +508,11 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tDEFAULT_HELP_FORMAT = html\n \tNO_D_INO_IN_DIRENT = YesPlease\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -Icompat -Icompat/win32\n+ifneq ($(uname_M),x86_64)\n+\t# MinGW-W64 < x.y headers do not provide MsgWaitForMultipleObjects with NOGDI\n+\tCOMPAT_CFLAGS += -DNOGDI\n+endif\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex e6de32c..29a8afd 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -92,6 +92,9 @@\n #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n #include <winsock2.h>\n #include <windows.h>\n+/* We cannot define NOGDI on MinGW-W64, so we unfortunately include\n+   wingdi.h.  It then defines ERROR=0, undef it to avoid conflicts */\n+#undef ERROR\n #define GIT_WINDOWS_NATIVE\n #endif\n \n"},{"id":"240750","messageId":"20140505121515.GA21638@camelia.ucw.cz","threadId":"36536","inReplyTo":"53673e7b65c4d_78fd70f2ec46@nysa.notmuch","subject":"Re: [msysGit] Re: [PATCH 10/12] MINGW: compat/poll/poll.c: undef NOGDI","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-05-05T12:15:15Z","receivedAt":"2014-05-05T12:15:15Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"On Mon, May 05, 2014 at 02:32:11AM -0500, Felipe Contreras wrote:\n> Stepan Kasal wrote:\n> > +ifneq ($(uname_M),x86_64)\n> > +\t# MinGW-W64 < x.y headers do not provide MsgWaitForMultipleObjects with NOGDI\n> \n> MinGW-w64 != x86_64; it provides a i686 compiler as well.\n\nthanks for correcting me.  The diff was just a quick sketch.\nEvery workaround should say what bug is working around, otherwise it\nis destined to become a superstition in the future.\n\nStepan\n"}]}