Update cygwin.c for new mingw-64 win32 api headers
authorMark Levedahl <mlevedahl@gmail.com>
Mon, 12 Nov 2012 00:17:20 +0000 (19:17 -0500)
committerJeff King <peff@peff.net>
Mon, 12 Nov 2012 20:47:50 +0000 (15:47 -0500)
The cygwin project recently switched to a new implementation of the
windows api, now using header files from the mingw-64 project. These
new header files are incompatible with the way cygwin.c included the
old headers: cygwin.c can be compiled using the new or the older (mingw)
headers, but different files must be included in different order for each
to work. The new headers are in use only for the current release series
(based upon the v1.7.x dll version). The previous release series using
the v1.5 dll is kept available but unmaintained for use on older versions
of Windows. So, patch cygwin.c to use the new include ordering only if
the dll version is 1.7 or higher.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Makefile
compat/cygwin.c

index 53a766e283652d3f0e4602065ec73ea7e675836c..504ce6ced240b003333755dfad61a5aa7c980f59 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1086,6 +1086,7 @@ ifeq ($(uname_O),Cygwin)
                NO_SYMLINK_HEAD = YesPlease
                NO_IPV6 = YesPlease
                OLD_ICONV = UnfortunatelyYes
+               V15_MINGW_HEADERS = YesPlease
        endif
        NO_THREAD_SAFE_PREAD = YesPlease
        NEEDS_LIBICONV = YesPlease
@@ -1893,6 +1894,9 @@ ifdef NO_REGEX
        COMPAT_CFLAGS += -Icompat/regex
        COMPAT_OBJS += compat/regex/regex.o
 endif
+ifdef V15_MINGW_HEADERS
+       COMPAT_CFLAGS += -DV15_MINGW_HEADERS
+endif
 
 ifdef USE_NED_ALLOCATOR
        COMPAT_CFLAGS += -Icompat/nedmalloc
index dfe9b3084ffbfd6c41a648e32a1857e78b566215..59d86e4d1518dcccfe70b594015b5882ff82cc09 100644 (file)
@@ -1,6 +1,13 @@
 #define WIN32_LEAN_AND_MEAN
+#ifdef V15_MINGW_HEADERS
 #include "../git-compat-util.h"
 #include "win32.h"
+#else
+#include <sys/stat.h>
+#include <sys/errno.h>
+#include "win32.h"
+#include "../git-compat-util.h"
+#endif
 #include "../cache.h" /* to read configuration */
 
 static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)