Skip to content

Commit

Permalink
mingw: delete support for legacy mingw.org toolchain
Browse files Browse the repository at this point in the history
Drop support for "old" / "legacy" / "classic" / "v1" / "mingw32" MinGW:
  https://en.wikipedia.org/wiki/MinGW, https://osdn.net/projects/mingw/
Its homepage used to be http://mingw.org/ [no HTTPS], and broken now.
It supported the x86 CPU only and used a old Windows API header and
implib set, often causing issues. It also misses most modern Windows
features, offering old versions of both binutils and gcc (no llvm/clang
support). It was last updated 2 years ago.

curl now relies on toolchains based on the mingw-w64 project:
https://www.mingw-w64.org/  https://sourceforge.net/projects/mingw-w64/
https://www.msys2.org/  https://github.com/msys2/msys2
https://github.com/mstorsjo/llvm-mingw
(Also available via Linux and macOS package managers.)

Closes curl#11625
  • Loading branch information
vszakats authored and ptitSeb committed Sep 25, 2023
1 parent 62c963e commit ab8db51
Show file tree
Hide file tree
Showing 19 changed files with 32 additions and 519 deletions.
12 changes: 0 additions & 12 deletions .azure-pipelines.yml
Expand Up @@ -237,12 +237,6 @@ stages:
prepare: pacman -S --needed --noconfirm --noprogressbar libssh-devel mingw-w64-x86_64-libssh
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --with-libssh --with-openssl
tests: "~571 ~614"
v1_mingw:
name: 32-bit (legacy)
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw:ltsc2019
container_cmd: C:\MinGW\msys\1.0\bin\sh
configure: --host=i686-pc-mingw32 --build=i686-pc-mingw32 --prefix=/mingw --enable-debug --without-ssl --with-mingw1-deprecated
tests: "!203 !1143"
v1_mingw32:
name: 32-bit w/o zlib
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw32:ltsc2019
Expand All @@ -269,12 +263,6 @@ stages:
prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2
tests: "~571"
v1_mingw_schannel:
name: 32-bit Schannel/SSPI/WinIDN (legacy)
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw:ltsc2019
container_cmd: C:\MinGW\msys\1.0\bin\sh
configure: --host=i686-pc-mingw32 --build=i686-pc-mingw32 --prefix=/mingw --enable-debug --enable-sspi --with-schannel --with-winidn --with-mingw1-deprecated
tests: "!203 !305 !311 !312 !313 !404 !1143 !2033 !2035 !2038 !2041 !2042 !2048 !2070 !2079 !2087 !3023 !3024"
v1_mingw32_schannel:
name: 32-bit Schannel/SSPI/WinIDN w/o zlib
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw32:ltsc2019
Expand Down
27 changes: 3 additions & 24 deletions CMakeLists.txt
Expand Up @@ -385,19 +385,6 @@ if(WIN32)
if(USE_LIBRTMP)
list(APPEND CURL_LIBS "winmm")
endif()

# Matching logic used for Curl_win32_random()
if(MINGW)
check_c_source_compiles("
#include <_mingw.h>
#if defined(__MINGW64_VERSION_MAJOR)
#error
#endif
int main(void) {
return 0;
}"
HAVE_MINGW_ORIGINAL)
endif()
endif()

# check SSL libraries
Expand Down Expand Up @@ -488,9 +475,7 @@ if(CURL_USE_OPENSSL)

if(WIN32)
list(APPEND CURL_LIBS "ws2_32")
if(NOT HAVE_MINGW_ORIGINAL)
list(APPEND CURL_LIBS "bcrypt") # for OpenSSL/LibreSSL
endif()
list(APPEND CURL_LIBS "bcrypt") # for OpenSSL/LibreSSL
endif()

set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
Expand Down Expand Up @@ -595,9 +580,7 @@ macro(openssl_check_symbol_exists SYMBOL FILES VARIABLE)
endif()
if(WIN32)
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
if(NOT HAVE_MINGW_ORIGINAL)
list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL
endif()
elseif(USE_WOLFSSL)
set(CMAKE_REQUIRED_INCLUDES "${WolfSSL_INCLUDE_DIRS}")
Expand Down Expand Up @@ -1360,11 +1343,7 @@ if(WIN32)
list(APPEND CURL_LIBS "advapi32" "crypt32")
endif()

if(NOT HAVE_MINGW_ORIGINAL)
list(APPEND CURL_LIBS "bcrypt")
else()
set(HAVE_FTRUNCATE OFF)
endif()
list(APPEND CURL_LIBS "bcrypt")
endif()

if(MSVC)
Expand Down
15 changes: 0 additions & 15 deletions appveyor.yml
Expand Up @@ -188,21 +188,6 @@ environment:
ADD_PATH: "C:\\mingw-w64\\i686-6.3.0-posix-dwarf-rt_v5-rev1\\mingw32\\bin;C:\\msys64\\usr\\bin"
MSYS2_ARG_CONV_EXCL: "/*"
BUILD_OPT: -k
- job_name: "CMake, mingw, Debug x86, no SSL, Static"
APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2022"
BUILD_SYSTEM: CMake
PRJ_GEN: "MSYS Makefiles"
PRJ_CFG: Debug
OPENSSL: OFF
SCHANNEL: OFF
ENABLE_UNICODE: OFF
HTTP_ONLY: OFF
TESTING: ON
SHARED: OFF
DISABLED_TESTS: "!1139 !1501"
ADD_PATH: "C:\\MinGW\\bin;C:\\msys64\\usr\\bin"
MSYS2_ARG_CONV_EXCL: "/*"
BUILD_OPT: -k
# winbuild-based builds
- job_name: "winbuild, VS2015, Debug"
APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015"
Expand Down
64 changes: 1 addition & 63 deletions configure.ac
Expand Up @@ -579,67 +579,6 @@ else
fi
AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)

# For original MinGW (ie not MinGW-w64) define the Windows minimum supported OS
# version to Windows XP (0x501) if it hasn't already been defined by the user.
# Without this override original MinGW defaults the version to Windows NT 4.0.
# Note original MinGW sets _WIN32_WINNT if not defined to whatever WINVER is.
case $host in
*-*-mingw32*)
AC_MSG_CHECKING([if MinGW minimum supported OS should be set to XP])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <_mingw.h>
]],[[
#if defined(__MINGW64_VERSION_MAJOR) || \
defined(WINVER) || \
defined(_WIN32_WINNT)
#error
#endif
]])
],[
CPPFLAGS="$CPPFLAGS -DWINVER=0x501"
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
])
;;
esac

# Detect original MinGW (not MinGW-w64)
curl_mingw_original=no
case $host in
*-*-mingw32*)
AC_MSG_CHECKING([using original MinGW (not MinGW-w64)])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <_mingw.h>
]],[[
#if defined(__MINGW64_VERSION_MAJOR)
#error
#endif
]])
],[
curl_mingw_original=yes
curl_mingw_die=yes
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
])
;;
esac


AC_ARG_WITH(mingw1-deprecated,dnl
AS_HELP_STRING([--with-mingw1-deprecated],[confirm you realize support for mingw v1 is dying]),
if test X"$withval" != Xno; then
curl_mingw_die=
fi
)

if test -n "$curl_mingw_die"; then
AC_MSG_ERROR([support for mingw v1 is going away, enable temporarily with --with-mingw1-deprecated])
fi

dnl **********************************************************************
dnl Compilation based checks should not be done before this point.
dnl **********************************************************************
Expand Down Expand Up @@ -2080,8 +2019,7 @@ if test "x$USE_WIN32_CRYPTO" = "x1" -o "x$USE_SCHANNEL" = "x1"; then
fi

dnl link bcrypt for BCryptGenRandom() (used when building for Vista or newer)
if test "x$curl_cv_native_windows" = "xyes" &&
test "x$curl_mingw_original" = "xno"; then
if test "x$curl_cv_native_windows" = "xyes"; then
LIBS="-lbcrypt $LIBS"
fi

Expand Down
13 changes: 1 addition & 12 deletions docs/DEPRECATE.md
Expand Up @@ -6,18 +6,6 @@ email the
as soon as possible and explain to us why this is a problem for you and
how your use case cannot be satisfied properly using a workaround.

## mingw v1

We remove support for building curl with the original legacy mingw version 1
in September 2023.

During the deprecation period you can enable the support with the configure
option `--with-mingw1-deprecated`.

mingw version 1 is old and deprecated software. There are much better and
still support build environments to use to build curl and other software. For
example [MinGW-w64](https://www.mingw-w64.org/).

## space-separated `NOPROXY` patterns

When specifying patterns/domain names for curl that should *not* go through a
Expand Down Expand Up @@ -46,3 +34,4 @@ curl will remove the support for space-separated names in July 2024.
- Support for systems without 64 bit data types
- NSS
- gskit
- mingw v1
10 changes: 5 additions & 5 deletions docs/INSTALL.md
Expand Up @@ -183,12 +183,12 @@ multi-threaded dynamic C runtime.

If you get linkage errors read section 5.7 of the FAQ document.

## MinGW32
## mingw-w64

Make sure that MinGW32's bin directory is in the search path, for example:
Make sure that mingw-w64's bin directory is in the search path, for example:

```cmd
set PATH=c:\mingw32\bin;%PATH%
set PATH=c:\mingw-w64\bin;%PATH%
```

then run `mingw32-make mingw32` in the root dir. There are other
Expand Down Expand Up @@ -246,7 +246,7 @@ Requires DJGPP in the search path and pointing to the Watt-32 stack via

Run `make -f Makefile.dist djgpp` in the root curl dir.

For build configuration options, please see the MinGW32 section.
For build configuration options, please see the mingw-w64 section.

Notes:

Expand All @@ -261,7 +261,7 @@ Notes:

Run `make -f Makefile.dist amiga` in the root curl dir.

For build configuration options, please see the MinGW32 section.
For build configuration options, please see the mingw-w64 section.

## Disabling Specific Protocols in Windows builds

Expand Down
34 changes: 14 additions & 20 deletions lib/config-win32.h
Expand Up @@ -39,15 +39,13 @@
#define HAVE_FCNTL_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#if defined(__MINGW32__) || \
(defined(_MSC_VER) && (_MSC_VER >= 1800))
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__)
#define HAVE_INTTYPES_H 1
#endif

/* Define to 1 if you have the <stdint.h> header file. */
#if defined(__MINGW32__) || defined(__POCC__) || \
(defined(_MSC_VER) && (_MSC_VER >= 1600)) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x0582))
#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(__MINGW32__) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x0582)) || defined(__POCC__)
#define HAVE_STDINT_H 1
#endif

Expand All @@ -72,8 +70,7 @@
#define HAVE_SIGNAL_H 1

/* Define to 1 if you have the <stdbool.h> header file. */
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || \
defined(__MINGW64_VERSION_MAJOR)
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__)
#define HAVE_STDBOOL_H 1
#endif

Expand Down Expand Up @@ -140,7 +137,7 @@
#define HAVE_STRING_H 1

/* Define to 1 if you have the <libgen.h> header file. */
#if defined(__MINGW64_VERSION_MAJOR)
#if defined(__MINGW32__)
#define HAVE_LIBGEN_H 1
#endif

Expand All @@ -155,8 +152,7 @@
/* #define TIME_WITH_SYS_TIME 1 */

/* Define to 1 if bool is an available type. */
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || \
defined(__MINGW64_VERSION_MAJOR)
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__)
#define HAVE_BOOL_T 1
#endif

Expand All @@ -168,7 +164,7 @@
#define HAVE_CLOSESOCKET 1

/* Define if you have the ftruncate function. */
#if defined(__MINGW64_VERSION_MAJOR)
#if defined(__MINGW32__)
#define HAVE_FTRUNCATE 1
#endif

Expand Down Expand Up @@ -203,7 +199,7 @@
#define HAVE_SOCKET 1

/* Define if you have the strcasecmp function. */
#ifdef __MINGW32__
#if defined(__MINGW32__)
#define HAVE_STRCASECMP 1
#endif

Expand Down Expand Up @@ -276,12 +272,12 @@
#endif

/* Define to 1 if you have the `basename' function. */
#if defined(__MINGW64_VERSION_MAJOR)
#if defined(__MINGW32__)
#define HAVE_BASENAME 1
#endif

/* Define to 1 if you have the strtok_r function. */
#if defined(__MINGW64_VERSION_MAJOR)
#if defined(__MINGW32__)
#define HAVE_STRTOK_R 1
#endif

Expand Down Expand Up @@ -411,11 +407,9 @@
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif

/* mingw-w64, mingw using >= MSVCR80, and visual studio >= 2005 (MSVCR80)
/* mingw-w64 and visual studio >= 2005 (MSVCR80)
all default to 64-bit time_t unless _USE_32BIT_TIME_T is defined */
#if defined(__MINGW64_VERSION_MAJOR) || \
(defined(__MINGW32__) && (__MSVCRT_VERSION__ >= 0x0800)) || \
(defined(_MSC_VER) && (_MSC_VER >= 1400))
#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) || defined(__MINGW32__)
# ifndef _USE_32BIT_TIME_T
# define SIZEOF_TIME_T 8
# else
Expand Down Expand Up @@ -564,14 +558,14 @@ Vista
#endif

/* Number of bits in a file offset, on hosts where this is settable. */
#if defined(USE_WIN32_LARGE_FILES) && defined(__MINGW64_VERSION_MAJOR)
#if defined(USE_WIN32_LARGE_FILES) && defined(__MINGW32__)
# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# endif
#endif

/* Define to the size of `off_t', as computed by sizeof. */
#if defined(__MINGW64_VERSION_MAJOR) && \
#if defined(__MINGW32__) && \
defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
# define SIZEOF_OFF_T 8
#else
Expand Down
8 changes: 0 additions & 8 deletions lib/curl_setup.h
Expand Up @@ -28,11 +28,6 @@
#define CURL_NO_OLDIES
#endif

/* define mingw version macros, eg __MINGW{32,64}_{MINOR,MAJOR}_VERSION */
#ifdef __MINGW32__
#include <_mingw.h>
#endif

/*
* Disable Visual Studio warnings:
* 4127 "conditional expression is constant"
Expand Down Expand Up @@ -830,9 +825,6 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
#endif

#if defined(USE_UNIX_SOCKETS) && defined(WIN32)
# if defined(__MINGW32__) && !defined(LUP_SECURE)
typedef u_short ADDRESS_FAMILY; /* Classic mingw, 11y+ old mingw-w64 */
# endif
# if !defined(UNIX_PATH_MAX)
/* Replicating logic present in afunix.h
(distributed with newer Windows 10 SDK versions only) */
Expand Down

0 comments on commit ab8db51

Please sign in to comment.