diff -rupN --no-dereference Python-3.10.9/configure.ac Python-3.10.9-new/configure.ac --- Python-3.10.9/configure.ac 2022-12-08 09:36:56.552024798 +0100 +++ Python-3.10.9-new/configure.ac 2022-12-08 09:36:56.557024799 +0100 @@ -5660,11 +5660,20 @@ case $host in *-*-mingw*) dnl 'PC/frozen_dllmain.c' - not yet PYTHON_OBJS_FROZENMAIN= + dnl Required for windows builds as Objects/exceptions.c require + dnl "errmap.h" from $srcdir/PC. + dnl Note we cannot use BASECPPFLAGS as autogenerated pyconfig.h + dnl has to be before customized located in ../PC. + dnl (-I. at end is workaround for setup.py logic) + CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS -I." ;; esac AC_SUBST(SRCDIRS) SRCDIRS="Parser Objects Python Modules Modules/_io Programs" +case $host in + *-*-mingw*) SRCDIRS="$SRCDIRS PC";; +esac AC_MSG_CHECKING(for build directories) for dir in $SRCDIRS; do if test ! -d $dir; then @@ -5673,6 +5682,15 @@ for dir in $SRCDIRS; do done AC_MSG_RESULT(done) +# For mingw build need additional library for linking +case $host in + *-*-mingw*) + LIBS="$LIBS -lversion -lshlwapi" + ;; + *) + ;; +esac + # Availability of -O2: AC_MSG_CHECKING(for -O2) saved_cflags="$CFLAGS" diff -rupN --no-dereference Python-3.10.9/Include/fileobject.h Python-3.10.9-new/Include/fileobject.h --- Python-3.10.9/Include/fileobject.h 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/Include/fileobject.h 2022-12-08 09:36:56.558024799 +0100 @@ -30,7 +30,7 @@ PyAPI_DATA(int) Py_UTF8Mode; #endif /* A routine to check if a file descriptor can be select()-ed. */ -#ifdef _MSC_VER +#ifdef MS_WINDOWS /* On Windows, any socket fd can be select()-ed, no matter how high */ #define _PyIsSelectable_fd(FD) (1) #else diff -rupN --no-dereference Python-3.10.9/Makefile.pre.in Python-3.10.9-new/Makefile.pre.in --- Python-3.10.9/Makefile.pre.in 2022-12-08 09:36:55.983024786 +0100 +++ Python-3.10.9-new/Makefile.pre.in 2022-12-08 09:36:56.558024799 +0100 @@ -776,7 +776,7 @@ regen-all: regen-opcode regen-opcode-tar ############################################################################ # Special rules for object files -Modules/getbuildinfo.o: $(PARSER_OBJS) \ +Modules/getbuildinfo.o: pythonnt_rc.h $(PARSER_OBJS) \ $(OBJECT_OBJS) \ $(PYTHON_OBJS) \ $(MODULE_OBJS) \ diff -rupN --no-dereference Python-3.10.9/Modules/getpath.c Python-3.10.9-new/Modules/getpath.c --- Python-3.10.9/Modules/getpath.c 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/Modules/getpath.c 2022-12-08 09:36:56.558024799 +0100 @@ -418,7 +418,7 @@ add_exe_suffix(wchar_t **progpath_p) /* Check for already have an executable suffix */ size_t n = wcslen(progpath); size_t s = wcslen(EXE_SUFFIX); - if (wcsncasecmp(EXE_SUFFIX, progpath + n - s, s) == 0) { + if (_wcsnicmp(EXE_SUFFIX, progpath + n - s, s) == 0) { return _PyStatus_OK(); } diff -rupN --no-dereference Python-3.10.9/PC/dl_nt.c Python-3.10.9-new/PC/dl_nt.c --- Python-3.10.9/PC/dl_nt.c 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/PC/dl_nt.c 2022-12-08 09:36:56.558024799 +0100 @@ -10,6 +10,7 @@ forgotten) from the programmer. #include "Python.h" #include "windows.h" +#include "pythonnt_rc.h" #ifdef Py_ENABLE_SHARED diff -rupN --no-dereference Python-3.10.9/PC/errmap.h Python-3.10.9-new/PC/errmap.h --- Python-3.10.9/PC/errmap.h 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/PC/errmap.h 2022-12-08 09:36:56.559024799 +0100 @@ -1,3 +1,5 @@ +#include <windows.h> + int winerror_to_errno(int winerror) { diff -rupN --no-dereference Python-3.10.9/PC/python_nt.rc Python-3.10.9-new/PC/python_nt.rc --- Python-3.10.9/PC/python_nt.rc 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/PC/python_nt.rc 2022-12-08 09:36:56.559024799 +0100 @@ -39,7 +39,7 @@ BEGIN VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0" - VALUE "OriginalFilename", ORIGINAL_FILENAME "\0" + VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" VALUE "ProductVersion", PYTHON_VERSION END diff -rupN --no-dereference Python-3.10.9/PC/python_ver_rc.h Python-3.10.9-new/PC/python_ver_rc.h --- Python-3.10.9/PC/python_ver_rc.h 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/PC/python_ver_rc.h 2022-12-08 09:36:56.559024799 +0100 @@ -15,6 +15,7 @@ #else # define PYTHON_DEBUG_EXT #endif +#include "pythonnt_rc.h" /* e.g., 3.3.0a1 * PY_VERSION comes from patchlevel.h