]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: bump minimum required mingw-w64 to v3.0 (from v1.0)
authorViktor Szakats <commit@vsz.me>
Thu, 24 Jul 2025 00:57:49 +0000 (02:57 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 28 Jul 2025 10:43:02 +0000 (12:43 +0200)
mingw-w64 3.0 was released on 2013-09-20. Offered by Debian jessie.

1.0 and 2.0 were released in 2011. It seems unlikely that many people
use them. The oldest downloadable toolchain (that I know of) comes with
3.0. Due to this, older versions weren't CI tested, and probably seldom
tested elsewhere. The last bugfix update for both 1.0 and 2.0 was
released in 2015.

curl can now assume availability of these 3.0 features/fixes:
- 64-bit file offsets.
- `ADDRESS_FAMILY` type.
- `__MINGW_PRINTF_FORMAT` macro. (in public curl headers)

Public curl headers keep supporting older mingw-w64 versions.

Fixes #17984
Closes #18010

CMake/win32-cache.cmake
CMakeLists.txt
docs/INSTALL.md
lib/curl_setup.h
lib/easy_lock.h

index 4fe9eb1139f54a7c845acc0cfab98f93938ce833..cb2e45cf564fa215ea4a92f318b446052ca70564 100644 (file)
@@ -191,6 +191,7 @@ if(MINGW OR MSVC)
   curl_prefill_type_size("LONG_LONG" 8)
   curl_prefill_type_size("__INT64" 8)
   curl_prefill_type_size("CURL_OFF_T" 8)
+  curl_prefill_type_size("ADDRESS_FAMILY" 2)  # MSVC or mingw-w64 v2+
   # CURL_SOCKET_T, SIZE_T: 8 for _WIN64, 4 otherwise
   # TIME_T: 8 for _WIN64 or UCRT or MSVC and not Windows CE, 4 otherwise
   #   Also 4 for non-UCRT 32-bit when _USE_32BIT_TIME_T is set.
@@ -199,20 +200,10 @@ if(MINGW OR MSVC)
     set(HAVE_SIZEOF_SSIZE_T 0)
     set(HAVE_FILE_OFFSET_BITS 0)
     curl_prefill_type_size("OFF_T" 4)
-    curl_prefill_type_size("ADDRESS_FAMILY" 2)
   else()
     # SSIZE_T: 8 for _WIN64, 4 otherwise
-    if(MINGW64_VERSION)
-      if(MINGW64_VERSION VERSION_GREATER_EQUAL 3.0)
-        set(HAVE_FILE_OFFSET_BITS 1)
-        curl_prefill_type_size("OFF_T" 8)
-      endif()
-      if(MINGW64_VERSION VERSION_GREATER_EQUAL 2.0)
-        curl_prefill_type_size("ADDRESS_FAMILY" 2)
-      else()
-        set(HAVE_SIZEOF_ADDRESS_FAMILY 0)
-      endif()
-    endif()
+    set(HAVE_FILE_OFFSET_BITS 1)  # mingw-w64 v3+
+    curl_prefill_type_size("OFF_T" 8)  # mingw-w64 v3+
   endif()
 endif()
 
index d113989a5cc0ffdc10376a1eb015e41b8da9df35..f3041b652db56b42ee1140903a0f53d61ef8fb62 100644 (file)
@@ -246,6 +246,9 @@ if(WIN32)
       string(REGEX REPLACE "MINGW64_VERSION=" "" MINGW64_VERSION "${CURL_TEST_OUTPUT}")
       if(MINGW64_VERSION)
         message(STATUS "Found MINGW64_VERSION=${MINGW64_VERSION}")
+        if(MINGW64_VERSION VERSION_LESS 3.0)
+          message(FATAL_ERROR "mingw-w64 3.0 or upper is required")
+        endif()
       endif()
     endif()
     unset(MINGW64_VERSION CACHE)  # Avoid storing in CMake cache
@@ -1595,7 +1598,6 @@ if(WIN32)
   # Pre-fill detection results based on target OS version
   if(_CURL_PREFILL)
     if(NOT HAVE_WIN32_WINNT OR HAVE_WIN32_WINNT LESS 0x0600 OR  # older than Windows Vista
-       (MINGW AND MINGW64_VERSION VERSION_LESS 2.0) OR
        WINCE OR WINDOWS_STORE)
       set(HAVE_IF_NAMETOINDEX 0)
       unset(HAVE_IF_NAMETOINDEX CACHE)
index 410fba07d4aa09186835c41f20c5fd4ec87ab929..0c53731710f1a1768960f194cc393734169c5233 100644 (file)
@@ -181,7 +181,7 @@ Building for Windows XP is required as a minimum.
 You can build curl with:
 
 - Microsoft Visual Studio 2008 v9.0 or later (`_MSC_VER >= 1500`)
-- MinGW-w64
+- MinGW-w64 3.0 or later (`__MINGW64_VERSION_MAJOR >= 3`)
 
 ## Building Windows DLLs and C runtime (CRT) linkage issues
 
index fc5359d1b48c4544a359c26734278baeee24382b..36da5c6cbfdf2946f3bcb4883e141ae146d7b139 100644 (file)
 #endif
 #endif
 
+#if defined(__MINGW32__) && \
+  (!defined(__MINGW64_VERSION_MAJOR) || (__MINGW64_VERSION_MAJOR < 3))
+#error "Building curl requires mingw-w64 3.0 or later"
+#endif
+
 /* Visual Studio 2008 is the minimum Visual Studio version we support.
    Workarounds for older versions of Visual Studio have been removed. */
 #if defined(_MSC_VER) && (_MSC_VER < 1500)
index 2d705174be3a2ae97002954d974cbd40fb75b236..909753f43aa37f94f97d13a855a6b9efe4769e3d 100644 (file)
 
 #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
 
-#ifdef __MINGW32__
-#ifndef SRWLOCK_INIT
-#define SRWLOCK_INIT NULL
-#endif
-#endif /* __MINGW32__ */
-
 #define curl_simple_lock SRWLOCK
 #define CURL_SIMPLE_LOCK_INIT SRWLOCK_INIT