Skip to contentSkip to conversation

Update cygwin.c for new mingw-64 win32 api headers

PATCH In review Mark Levedahl 2 participants 4 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update cygwin.c for new mingw-64 win32 api headers

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.

---
 Makefile        | 4 ++++
 compat/cygwin.c | 7 +++++++
 2 files changed, 11 insertions(+)
Makefile +4 -0
index f69979e..1cc5d96 100644
@@ -1082,6 +1082,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
@@ -1889,6 +1890,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
compat/cygwin.c +7 -0
index dfe9b30..59d86e4 100644
@@ -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)
Signature · 1 line
1.8.0.0.0.14
#1 lore raw
Quoted 10 lines · Mark Levedahl

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.

I have very little knowledge of cygwin compatibility, so thanks for a nice explanation. I'll queue it in 'pu' for now, and hopefully we can get some test reports from other cygwin folks (on new and old cygwin).

Makefile ifeq ($(uname_O),Cygwin) · line 1086

Quoted 10 lines
Makefile +1 -0
index f69979e..1cc5d96 100644
@@ -1082,6 +1082,7 @@ ifeq ($(uname_O),Cygwin)
 		NO_SYMLINK_HEAD = YesPlease
 		NO_IPV6 = YesPlease
 		OLD_ICONV = UnfortunatelyYes
+		V15_MINGW_HEADERS = YesPlease
 	endif

The "if" part of the conditional that did not make it into the context above is an expr match for "1.6.*" From the name, I would think that we would want to use these headers on cygwin 1.5.* , too. Is v1.5 too old to care about now?

-Peff

#2 lore raw
Quoted 33 lines · Jeff King
Quoted 10 lines · Mark Levedahl

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.

I have very little knowledge of cygwin compatibility, so thanks for a nice explanation. I'll queue it in 'pu' for now, and hopefully we can get some test reports from other cygwin folks (on new and old cygwin).

Makefile ifeq ($(uname_O),Cygwin) · line 1086

Quoted 10 lines
Makefile +1 -0
index f69979e..1cc5d96 100644
@@ -1082,6 +1082,7 @@ ifeq ($(uname_O),Cygwin)
              NO_SYMLINK_HEAD = YesPlease
              NO_IPV6 = YesPlease
              OLD_ICONV = UnfortunatelyYes
+             V15_MINGW_HEADERS = YesPlease
      endif

The "if" part of the conditional that did not make it into the context above is an expr match for "1.6.*" From the name, I would think that we would want to use these headers on cygwin 1.5.* , too. Is v1.5 too old to care about now?

Quoted 1 line

-Peff

The opening if expression is:

    ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)

which I believe matches any version below 1.7. 1.5 is what is released opensource, 1.6 is (or was) available as a supported product from redhat. So, I think the stanza is ok as is.

Mark

#3 lore raw
Quoted 16 lines · Mark Levedahl
Quoted 7 lines
Quoted 7 lines
Makefile +0 -0
index f69979e..1cc5d96 100644
@@ -1082,6 +1082,7 @@ ifeq ($(uname_O),Cygwin)
              NO_SYMLINK_HEAD = YesPlease
              NO_IPV6 = YesPlease
Quoted 8 lines

Makefile ifeq ($(uname_O),Cygwin) · line 1086

Quoted 3 lines
Makefile +1 -0
              OLD_ICONV = UnfortunatelyYes
+             V15_MINGW_HEADERS = YesPlease
      endif

The "if" part of the conditional that did not make it into the context above is an expr match for "1.6.*" From the name, I would think that we would want to use these headers on cygwin 1.5.* , too. Is v1.5 too old to care about now?

Quoted 5 lines

The opening if expression is:

    ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)

which I believe matches any version below 1.7. 1.5 is what is released opensource, 1.6 is (or was) available as a supported product from redhat. So, I think the stanza is ok as is.

Oh, right, I'm an idiot. I read the patch, thought "gee, I wonder what that conditional just outside the context is", looked it up, then promptly misremembered exactly what it said when writing the rest of my email.

Yes, what you have is absolutely right. Sorry for the noise.

-Peff