[mingw-curl: 8/11] Fix compatibility with mingw-w64

epienbro epienbro at fedoraproject.org
Tue Mar 6 18:26:06 UTC 2012


commit 8f5eba0ca27fc38fc353dba9d1c9793fc486f570
Author: Erik van Pienbroek <epienbro at fedoraproject.org>
Date:   Tue Feb 28 01:02:27 2012 +0100

    Fix compatibility with mingw-w64
    
    - Let curl use its own errno/WSA error codes
    - The function ftruncate64 doesn't need to be reimplemented by curl
      as the mingw-w64 crt already contains an implementation for it

 curl-dont-implement-ftruncate64.patch |   19 +++++++++
 curl-undef-mingw-error-codes.patch    |   66 +++++++++++++++++++++++++++++++++
 mingw32-curl.spec                     |   15 +++++++
 3 files changed, 100 insertions(+), 0 deletions(-)
---
diff --git a/curl-dont-implement-ftruncate64.patch b/curl-dont-implement-ftruncate64.patch
new file mode 100644
index 0000000..2f2f36b
--- /dev/null
+++ b/curl-dont-implement-ftruncate64.patch
@@ -0,0 +1,19 @@
+--- src/main.c.orig	2012-02-28 00:45:09.060495137 +0100
++++ src/main.c	2012-02-28 00:46:20.440778598 +0100
+@@ -432,6 +432,7 @@
+  * Truncate a file handle at a 64-bit position 'where'.
+  */
+ 
++#if 0
+ static int ftruncate64 (int fd, curl_off_t where)
+ {
+   if(_lseeki64(fd, where, SEEK_SET) < 0)
+@@ -442,6 +443,8 @@
+ 
+   return 0;
+ }
++#endif
++
+ #define ftruncate(fd,where) ftruncate64(fd,where)
+ 
+ #endif /* WIN32 */
diff --git a/curl-undef-mingw-error-codes.patch b/curl-undef-mingw-error-codes.patch
new file mode 100644
index 0000000..034b0ee
--- /dev/null
+++ b/curl-undef-mingw-error-codes.patch
@@ -0,0 +1,66 @@
+--- lib/setup_once.h.orig	2012-02-28 00:48:10.756762217 +0100
++++ lib/setup_once.h	2012-02-28 00:54:40.421769545 +0100
+@@ -373,38 +373,63 @@
+ #define EINTR            WSAEINTR
+ #undef  EINVAL           /* override definition in errno.h */
+ #define EINVAL           WSAEINVAL
++#undef  EWOULDBLOCK      /* override definition in errno.h */
+ #define EWOULDBLOCK      WSAEWOULDBLOCK
++#undef  EINPROGRESS      /* override definition in errno.h */
+ #define EINPROGRESS      WSAEINPROGRESS
++#undef  EALREADY         /* override definition in errno.h */
+ #define EALREADY         WSAEALREADY
++#undef  ENOTSOCK         /* override definition in errno.h */
+ #define ENOTSOCK         WSAENOTSOCK
++#undef  EDESTADDRREQ     /* override definition in errno.h */
+ #define EDESTADDRREQ     WSAEDESTADDRREQ
++#undef  EMSGSIZE         /* override definition in errno.h */
+ #define EMSGSIZE         WSAEMSGSIZE
++#undef  EPROTOTYPE       /* override definition in errno.h */
+ #define EPROTOTYPE       WSAEPROTOTYPE
++#undef  ENOPROTOOPT      /* override definition in errno.h */
+ #define ENOPROTOOPT      WSAENOPROTOOPT
++#undef  EPROTONOSUPPORT  /* override definition in errno.h */
+ #define EPROTONOSUPPORT  WSAEPROTONOSUPPORT
+ #define ESOCKTNOSUPPORT  WSAESOCKTNOSUPPORT
++#undef  EOPNOTSUPP       /* override definition in errno.h */
+ #define EOPNOTSUPP       WSAEOPNOTSUPP
+ #define EPFNOSUPPORT     WSAEPFNOSUPPORT
++#undef  EAFNOSUPPORT     /* override definition in errno.h */
+ #define EAFNOSUPPORT     WSAEAFNOSUPPORT
++#undef  EADDRINUSE       /* override definition in errno.h */
+ #define EADDRINUSE       WSAEADDRINUSE
++#undef  EADDRNOTAVAIL    /* override definition in errno.h */
+ #define EADDRNOTAVAIL    WSAEADDRNOTAVAIL
++#undef  ENETDOWN         /* override definition in errno.h */
+ #define ENETDOWN         WSAENETDOWN
++#undef  ENETUNREACH      /* override definition in errno.h */
+ #define ENETUNREACH      WSAENETUNREACH
++#undef  ENETRESET        /* override definition in errno.h */
+ #define ENETRESET        WSAENETRESET
++#undef  ECONNABORTED     /* override definition in errno.h */
+ #define ECONNABORTED     WSAECONNABORTED
++#undef  ECONNRESET       /* override definition in errno.h */
+ #define ECONNRESET       WSAECONNRESET
++#undef  ENOBUFS          /* override definition in errno.h */
+ #define ENOBUFS          WSAENOBUFS
++#undef  EISCONN          /* override definition in errno.h */
+ #define EISCONN          WSAEISCONN
++#undef  ENOTCONN         /* override definition in errno.h */
+ #define ENOTCONN         WSAENOTCONN
+ #define ESHUTDOWN        WSAESHUTDOWN
+ #define ETOOMANYREFS     WSAETOOMANYREFS
++#undef  ETIMEDOUT        /* override definition in errno.h */
+ #define ETIMEDOUT        WSAETIMEDOUT
++#undef  ECONNREFUSED     /* override definition in errno.h */
+ #define ECONNREFUSED     WSAECONNREFUSED
++#undef  ELOOP            /* override definition in errno.h */
+ #define ELOOP            WSAELOOP
+ #ifndef ENAMETOOLONG     /* possible previous definition in errno.h */
+ #define ENAMETOOLONG     WSAENAMETOOLONG
+ #endif
+ #define EHOSTDOWN        WSAEHOSTDOWN
++#undef  EHOSTUNREACH     /* override definition in errno.h */
+ #define EHOSTUNREACH     WSAEHOSTUNREACH
+ #ifndef ENOTEMPTY        /* possible previous definition in errno.h */
+ #define ENOTEMPTY        WSAENOTEMPTY
diff --git a/mingw32-curl.spec b/mingw32-curl.spec
index b61d4af..7c8c0bb 100644
--- a/mingw32-curl.spec
+++ b/mingw32-curl.spec
@@ -65,6 +65,15 @@ Patch106:       curl-7.20.1-threaded-dns.patch
 # exclude test1112 from the test suite (#565305)
 Patch107:       curl-7.20.0-disable-test1112.patch
 
+# Curl tries to implement the ftruncate64 function while mingw-w64 already
+# provides an implementation for this function
+Patch108:       curl-dont-implement-ftruncate64.patch
+
+# Curl wants to map various errno/WSA error codes to its own interpration
+# Let curl do this without conflicting with the errno/WSA error codes defined
+# in the mingw-w64 headers
+Patch109:       curl-undef-mingw-error-codes.patch
+
 #
 # End of native patches
 #
@@ -143,6 +152,9 @@ done
 %patch107 -p1
 rm -f tests/data/test1112
 
+%patch108 -p0
+%patch109 -p0
+
 autoreconf
 
 # replace hard wired port numbers in the test suite
@@ -218,6 +230,9 @@ rm -rf $RPM_BUILD_ROOT
 %changelog
 * Mon Feb 27 2012 Erik van Pienbroek <epienbro at fedoraproject.org> - 7.20.1-5
 - Rebuild against the mingw-w64 toolchain
+- Let curl use its own errno/WSA error codes
+- The function ftruncate64 doesn't need to be reimplemented by curl
+  as the mingw-w64 crt already contains an implementation for it
 
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 7.20.1-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild


More information about the scm-commits mailing list