From 4f8bb65228f490b171b5262d362609296d099da3 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 3 Dec 2024 15:54:13 +0100 Subject: [PATCH] Allow setting _WIN32_WINNT when building --- mingw-w64-build | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/mingw-w64-build b/mingw-w64-build index 4d0da33..96d6518 100755 --- a/mingw-w64-build +++ b/mingw-w64-build @@ -21,6 +21,7 @@ ROOT_PATH="$HOME/.zeranoe/mingw-w64" MINGW_W64_BRANCH="master" BINUTILS_BRANCH="binutils-2_42-branch" GCC_BRANCH="releases/gcc-14" +WIN32_WINNT="0xa00" ENABLE_THREADS="--enable-threads=posix" @@ -51,6 +52,22 @@ Options: --gcc-branch set GCC branch (default: $GCC_BRANCH) --mingw-w64-branch set MinGW-w64 branch (default: $MINGW_W64_BRANCH) --linked-runtime set MinGW Linked Runtime (default: $LINKED_RUNTIME) + --win32-winnt set default _WIN32_WINNT value (default: $WIN32_WINNT) + +Possible _WIN32_WINNT values: + + 0x0400 (Windows NT 4.0) + 0x0500 (Windows 2000) + 0x0501 (Windows XP) + 0x0502 (Windows Server 2003) + 0x0600 (Windows Vista) + 0x0601 (Windows 7) + 0x0602 (Windows 8) + 0x0603 (Windows 8.1) + 0x0A00 (Windows 10) + +See also: https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt + EOF } @@ -187,6 +204,7 @@ build() execute "($arch): configuring MinGW-w64 headers" "" \ "$SRC_PATH/mingw-w64/mingw-w64-headers/configure" --build="$BUILD" \ --host="$host" --prefix="$prefix/$host" \ + --with-default-win32-winnt=$WIN32_WINNT \ --with-default-msvcrt=$LINKED_RUNTIME execute "($arch): installing MinGW-w64 headers" "" \ @@ -351,6 +369,20 @@ while :; do --mingw-w64-branch=) arg_error "'--mingw-w64-branch' requires a non-empty option argument" ;; + --win32-winnt) + if [ "$2" ]; then + WIN32_WINNT="$2" + shift + else + arg_error "'--win32-winnt' requires a non-empty option argument" + fi + ;; + --win32-winnt=?*) + WIN32_WINNT=${1#*=} + ;; + --WIN32_WINNT=) + arg_error "'--win32-winnt' requires a non-empty option argument" + ;; i586) BUILD_I586=1 ;;