Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting _WIN32_WINNT for targetting older Windows API versions #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions mingw-w64-build
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -51,6 +52,22 @@ Options:
--gcc-branch <branch> set GCC branch (default: $GCC_BRANCH)
--mingw-w64-branch <branch> set MinGW-w64 branch (default: $MINGW_W64_BRANCH)
--linked-runtime <runtime> set MinGW Linked Runtime (default: $LINKED_RUNTIME)
--win32-winnt <version> 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
}

Expand Down Expand Up @@ -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" "" \
Expand Down Expand Up @@ -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
;;
Expand Down