diff -Naur Python-3.8.0-orig/configure.ac Python-3.8.0/configure.ac --- Python-3.8.0-orig/configure.ac 2019-10-22 10:00:34.321096900 +0300 +++ Python-3.8.0/configure.ac 2019-10-22 10:00:39.843506600 +0300 @@ -362,6 +362,17 @@ # Set name for machine-dependent library files AC_ARG_VAR([MACHDEP], [name for machine-dependent library files]) AC_MSG_CHECKING(MACHDEP) +case $host in + *-*-mingw*) + # On those hosts MACHDEP is 'win', as platform specific files + # go in plat-$(MACHDEP), but runtime platform is 'win32' + test -z "$MACHDEP" && MACHDEP=win + + dnl Configuration will be based only on "host triplet" as build + dnl must not depend from posix compatible environement. + ac_sys_system=ignore + ;; +esac if test -z "$MACHDEP" then # avoid using uname for cross builds @@ -431,12 +442,23 @@ *-*-vxworks*) _host_cpu=$host_cpu ;; + *-*-mingw*) + _host_cpu= + ;; *) # for now, limit cross builds to known configurations MACHDEP="unknown" AC_MSG_ERROR([cross build not supported for $host]) esac _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" + + case "$host_os" in + mingw*) + # As sys.platform() return 'win32' to build python and extantions + # we will use 'mingw' (in setup.py and etc.) + _PYTHON_HOST_PLATFORM=mingw + ;; + esac fi # Some systems cannot stand _XOPEN_SOURCE being defined at all; they diff -Naur Python-3.8.0-orig/Python/getplatform.c Python-3.8.0/Python/getplatform.c --- Python-3.8.0-orig/Python/getplatform.c 2019-10-14 16:34:47.000000000 +0300 +++ Python-3.8.0/Python/getplatform.c 2019-10-22 10:00:40.249107300 +0300 @@ -1,6 +1,12 @@ #include "Python.h" +#ifdef __MINGW32__ +# undef PLATFORM +/* see PC/pyconfig.h */ +# define PLATFORM "win32" +#endif + #ifndef PLATFORM #define PLATFORM "unknown" #endif