From 71883d3330308ca1d1b93e762066202b386235ae Mon Sep 17 00:00:00 2001 From: tebako-ci Date: Sun, 13 Sep 2026 09:13:18 +0800 Subject: [PATCH] Fix the round-2/3 windows walls + port the MSYS2 sweep for the static shape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two observed walls from tebako-runtime-python PR #16 (run 34725669811): - Python/sysmodule.c:3924 VPATH undeclared — the use is MS_WINDOWS-gated and MSVC gets VPATH from PC/pyconfig.h; the autotools sysmodule.o rule passes only -DABIFLAGS/$(MULTIARCH_CPPFLAGS). Ported MSYS2 0054 (-DVPATH='"$(VPATH)"' on the sysmodule.o rule). - Python/thread_pthread.h:413 native_id / :440 pause — the pthread ladder has no __MINGW32__ rung (upstream's pthread path is POSIX-only; the Windows thread support upstream tests is thread_nt.h behind the MSVC build). Ported MSYS2's proven answer, 0001: --with-nt-threads defaults yes on *-*-mingw*, AC_DEFINEs NT_THREADS, skips the pthread probe set; pythread.h/pycore_pythread.h/pycore_condvar.h undef _POSIX_THREADS (winpthreads leaks it via ), so thread.c compiles thread_nt.h and thread_pthread.h never enters the build. Then the full sweep of the MSYS2 MINGW-packages mingw-w64-python series (103 patches) for our build shape (static-ish, --disable-shared, ucrt64, MS_WINDOWS via pyport_ms_windows_msys). Ported, in MSYS2 numbering: 0001 (above), 0005 (mingw configure defaults — Misc/config_mingw loads for EVERY mingw host, native included; despite the MSYS2 title it is not cross-only: it pins ac_cv_func_alarm/ftruncate/truncate and ac_cv_file__dev_ptmx/ptc off — run 34730588522's native ucrt64 walls: signalmodule.c:398 implicit alarm() (the link probe finds alarm in the import libs; ucrt64's unistd.h declares it only under __USE_MINGW_ALARM) and posixmodule.c:9000 ioctl/I_PUSH (the msys shell emulates /dev/ptmx, so HAVE_DEV_PTMX came out set and os_openpty_impl reached the STREAMS ioctls mingw-w64 lacks) — and forces getpeername on), 0008 (nt module naming — PyInit_nt vs posix registration, os.py needs nt at MACHDEP=win32), 0016 (frozenmain.o references PC/frozen_dllmain.c symbols — exe link wall), 0017 + 0041 (socketmodule mingw support + the inet_pton probes — without them _socket never builds), 0036 (_signal signalmodule.c -lws2_32 — signalmodule.c:773's MS_WINDOWS WSAGetLastError walls the bootstrap links, which never see the factory's TEBAKO_LIBS), 0037 (winconsoleio + _testconsole — run 34732802820's _freeze_module LINK wall: upstream's autotools build never compiles Modules/_io/winconsoleio.c (the MSVC vcxproj carries it), so once 0002's HAVE_WINDOWS_CONSOLE_IO arm makes the console code paths live on mingw the link dies on _get_console_type (Parser/myreadline.c:273/:276), _PyIO_get_console_type and winconsoleio_spec (Modules/_io/_iomodule.c); the TU is HAVE_WINDOWS_CONSOLE_IO-guarded, an empty object on POSIX), 0045 (ucrt _timezone spellings), 0054 (above), 0056 (_bootstrap_python defines wmain — needs -municode), 0059 (static openssl needs -lws2_32 -lcrypt32 + the cert-store widening), 0060 (winsock.h for the netdb probes — without it every netdb probe fails on mingw, HAVE_GETHOSTNAME/HAVE_SHUTDOWN stay undefined while PC/pyconfig.h defines them, and socket.gethostname / shutdown vanish from the 0017-enabled _socket; proven by this PR's cross probe), 0063 (deterministic .exe), 0075 (the POSIX-only module set is n/a on mingw; subsumes 0058), 0078 (GCC 14 escalated -Wincompatible-pointer-types to an error; the MSVC-oriented MS_WINDOWS branches (PathCchSkipRoot, _wexecv/_wspawnv families) pass wchar_t** where the CRT wants const wchar_t* const* — MSYS2 demotes to warning on mingw rather than diverging from upstream at every call site; gate-critical on any current toolchain — CI ships gcc 16), 0097 (mmap's __try/__except is a GCC error once the gate passes on mingw), 0100 (_PYTHREAD_NAME_MAXLEN is used UNGUARDED in _threadmodule.c's Windows branch). With 0002, 0004, 0007, 0052, 0096 already in the tree from the earlier rounds, the series is 24 patches. One tebako deviation: configure_syslibs_msys — the factory's modlib_rewrites rewrite MODULE__SSL_LDFLAGS/ MODULE__HASHLIB_LDFLAGS to absolute .a paths, dropping 0059's -lws2_32 -lcrypt32 tail, so a host-conditional WINDOWS_SYSLIBS rides SYSLIBS, which sits after MODLIBS on every link line and is never rewritten downstream. The lib set is MSYS2's: the original four plus the -lversion -lshlwapi -lpathcch tail of 0010's mingw LIBS hunk (0010 itself stays skipped as shared-build machinery; MSVC gets the same libs via #pragma comment(lib, ...) in the sources, which GCC ignores — run 34732802820's undefined GetFileVersionInfoSizeW/GetFileVersionInfoW/ VerQueryValueW (-> -lversion) and __imp_PathCchSkipRoot/ __imp_PathCchCombineEx (-> -lpathcch) are exactly those pragmas going silent). All generated-configure hunks are machine-exact regens with the upstream-pinned autoconf 2.72 (byte-identical regen against pristine proven), not hand-syncs. The deliberate skips (shared-build/ DLL naming, feature parity like 0018's _winapi, cross-only, tests/CI, warning-grade) are grouped in the PR body. Two tooling changes the sweep forced: - Tfs::SourcePrep#audit now applies the series CUMULATIVELY in manifest order instead of git apply --check per patch on pristine: a quilt series cannot satisfy per-patch-pristine (0036's context line is @MODULE_POSIXMODULE_NAME@, which only exists after 0008). On a mid-series failure the remaining patches report a not-checked failure. Specs pin the dependent-context and not-checked-tail behavior; the lint/README/onboarder comments follow. - tools/compile_smoke WALL_OBJECTS gains the round-2 walls and the patched module TUs (sysmodule, thread, posixmodule, signalmodule, timemodule, socketmodule, _threadmodule, _bootstrap_python — the regression-list contract), plus a platform-conditional WALL_OBJECTS_MSYS for Modules/_io/winconsoleio.o: the TU exists only in the patched tree (0037 adds it to the _io bootstrap line), so the pristine POSIX leg has no rule for it and must not fail on its absence, while on windows-msys a missing rule IS the regression. Patch-named .c auto-adds now probe the generated Makefile for a literal rule first: an n/a module (e.g. _ssl without an openssl dev package in the smoke env) emits NO rule, and make's implicit %.o:%.c fallback would otherwise compile it with the wrong flags and fail. Skips are reported in the OK line. Verified locally (macOS + homebrew mingw-w64 gcc 14 — the ucrt64 compile itself is CI's oracle): the 24-patch series applies clean to pristine 3.14.7 (tools/lint) and reproduces the independently staged manifest-order MSYS2 reference tree byte-for-byte; the shipped configure and pyconfig.h.in equal the pinned autoconf 2.72 regen of the shipped configure.ac exactly (regen-fidelity checked on the assembled tree); rspec 103/0; validate_manifests OK; the POSIX smoke leg compiles all 12 wall TUs on the pristine tree; a cross configure (--host=x86_64-w64-mingw32, --disable-shared, no manual ac_cv presets — config_mingw loads itself) confirms NT_THREADS defined with _POSIX_THREADS undef'd, nt posixmodule.c and _signal signalmodule.c -lws2_32 in Setup.bootstrap, EXE/BUILDEXE=.exe, MODULE__SOCKET_STATE= yes with the ws2_32 tail, HAVE_GETHOSTNAME/HAVE_SHUTDOWN defined (MSVC parity), HAVE_ALARM/HAVE_DEV_PTMX/HAVE_TRUNCATE pinned off, HAVE_GETPEERNAME forced on, _posixshmem/grp/resource n/a, _PTHREAD_NAME_MAXLEN=32766, the extended SYSLIBS tail (-lws2_32 -lcrypt32 -ladvapi32 -lbcrypt -lversion -lshlwapi -lpathcch), -Wno-error=incompatible-pointer-types in CFLAGS_NODIST, and -DVPATH on the make -n Python/sysmodule.o compile line with -I./PC present. And the compile+link sweep: all 13 wall TUs cross-compile clean, the FULL core (libpython3.14.a — 191 objects) cross-compiles with zero errors, and Programs/_freeze_module — the run 34732802820 casualty — now cross-LINKS clean (winconsoleio.o in the _io objects, the extended SYSLIBS resolving version/pathcch). --- README.md | 10 +- .../bootstrap_python_link_flags_msys.patch | 27 + .../configure_c_locale_coercion_msys.patch | 54 +- ...configure_disable_posix_modules_msys.patch | 69 ++ patches/3.14/configure_exeext_msys.patch | 65 ++ patches/3.14/configure_inet_pton_msys.patch | 232 +++++ patches/3.14/configure_machdep_msys.patch | 37 +- .../3.14/configure_mingw_defaults_msys.patch | 142 +++ .../configure_noerror_incompat_ptr_msys.patch | 61 ++ patches/3.14/configure_nt_threads_msys.patch | 839 ++++++++++++++++++ patches/3.14/configure_pc_include_msys.patch | 21 +- .../configure_pthread_name_maxlen_msys.patch | 37 + patches/3.14/configure_syslibs_msys.patch | 101 +++ .../3.14/configure_winsock_netdb_msys.patch | 318 +++++++ patches/3.14/frozenmain_drop_msys.patch | 80 ++ patches/3.14/io_winconsoleio_msys.patch | 129 +++ patches/3.14/mmapmodule_no_seh_msys.patch | 30 + patches/3.14/patch-3.14.yaml | 47 + patches/3.14/posixmodule_nt_msys.patch | 131 +++ patches/3.14/signal_ws2_32_msys.patch | 31 + patches/3.14/socketmodule_msys.patch | 258 ++++++ patches/3.14/ssl_module_msys.patch | 100 +++ patches/3.14/sysmodule_vpath_msys.patch | 28 + patches/3.14/timemodule_msys.patch | 36 + spec/tfs/source_prep_spec.rb | 47 +- tools/compile_smoke | 74 +- tools/lib/tfs/onboarder.rb | 6 +- tools/lib/tfs/source_prep.rb | 28 +- tools/lint | 7 +- 29 files changed, 2959 insertions(+), 86 deletions(-) create mode 100644 patches/3.14/bootstrap_python_link_flags_msys.patch create mode 100644 patches/3.14/configure_disable_posix_modules_msys.patch create mode 100644 patches/3.14/configure_exeext_msys.patch create mode 100644 patches/3.14/configure_inet_pton_msys.patch create mode 100644 patches/3.14/configure_mingw_defaults_msys.patch create mode 100644 patches/3.14/configure_noerror_incompat_ptr_msys.patch create mode 100644 patches/3.14/configure_nt_threads_msys.patch create mode 100644 patches/3.14/configure_pthread_name_maxlen_msys.patch create mode 100644 patches/3.14/configure_syslibs_msys.patch create mode 100644 patches/3.14/configure_winsock_netdb_msys.patch create mode 100644 patches/3.14/frozenmain_drop_msys.patch create mode 100644 patches/3.14/io_winconsoleio_msys.patch create mode 100644 patches/3.14/mmapmodule_no_seh_msys.patch create mode 100644 patches/3.14/posixmodule_nt_msys.patch create mode 100644 patches/3.14/signal_ws2_32_msys.patch create mode 100644 patches/3.14/socketmodule_msys.patch create mode 100644 patches/3.14/ssl_module_msys.patch create mode 100644 patches/3.14/sysmodule_vpath_msys.patch create mode 100644 patches/3.14/timemodule_msys.patch diff --git a/README.md b/README.md index fffcb53..a3c3405 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,10 @@ per-version sum is the trust anchor the runtime factory verifies against. build/copy plan uses — an `_msys` patch never smokes linux-gnu). - `tools/lint ` — fetch + verify + extract + tree sanity (`configure`, `Makefile.pre.in`, `Modules/getpath.py` — the file the - relocatability contract rests on), plus `git apply --check` of every - patch the version's line manifest selects. + relocatability contract rests on), plus applying every patch the + version's line manifest selects, in manifest order, on a pristine tree + (the series is cumulative — a patch's context may assume its + predecessors). - `tools/monitor --detect | --onboard ` — the release monitor. `Tfs::PythonReleases` parses the official python.org FTP index (exact `X.Y.Z` directories only — pre-release suffixes and the two-part @@ -139,8 +141,8 @@ All matrices and every version/sha flow from versions.yml through the tools — the workflows carry no version literals. - `lint.yml` (push to main + PRs) — validates manifests, then one leg per - version running `tools/lint` (tarball + tree sanity + every selected - patch `git apply --check`), plus the **compile-smoke legs** + version running `tools/lint` (tarball + tree sanity + the selected + patch series applied in manifest order), plus the **compile-smoke legs** (`tools/versions --smoke` → `_compile-smoke.yml`, one leg per patch-carrying scenario on its native runner — the PR-time oracle for the windows-msys port, since a local macOS/Linux host cannot run the diff --git a/patches/3.14/bootstrap_python_link_flags_msys.patch b/patches/3.14/bootstrap_python_link_flags_msys.patch new file mode 100644 index 0000000..4b8a476 --- /dev/null +++ b/patches/3.14/bootstrap_python_link_flags_msys.patch @@ -0,0 +1,27 @@ +# bootstrap_python_link_flags_msys.patch +# +# Target: Makefile.pre.in (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0056 +# "build: Add extra flags for _bootstrap_python" (ported +# verbatim) +# +# Wall item (anticipated link wall, same leg class as run 34725669811): +# Programs/_bootstrap_python.c defines wmain (not main) under MS_WINDOWS, +# and mingw's CRT startup only calls wmain when linked -municode — +# otherwise the _bootstrap_python link (which runs during every make: it +# freezes the stdlib modules) dies on the missing entry point. -mwindows +# rides along from the proven patch (GUI subsystem: no console window for +# the build-time tool). +diff --git a/Makefile.pre.in b/Makefile.pre.in +index a4c738b..f1b346d 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1681,7 +1681,7 @@ BOOTSTRAP_HEADERS = \ + Programs/_bootstrap_python.o: Programs/_bootstrap_python.c $(BOOTSTRAP_HEADERS) $(PYTHON_HEADERS) + + _bootstrap_python: $(LIBRARY_OBJS_OMIT_FROZEN) Programs/_bootstrap_python.o Modules/getpath.o Modules/Setup.local +- $(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \ ++ $(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ -municode -mwindows $(LIBRARY_OBJS_OMIT_FROZEN) \ + Programs/_bootstrap_python.o Modules/getpath.o $(LIBS) $(MODLIBS) $(SYSLIBS) + # Dummy pybuilddir.txt is needed for _bootstrap_python to be runnable + @echo "none" > ./pybuilddir.txt diff --git a/patches/3.14/configure_c_locale_coercion_msys.patch b/patches/3.14/configure_c_locale_coercion_msys.patch index 0789a70..da56938 100644 --- a/patches/3.14/configure_c_locale_coercion_msys.patch +++ b/patches/3.14/configure_c_locale_coercion_msys.patch @@ -4,8 +4,10 @@ # Source: MSYS2 MINGW-packages mingw-w64-python 0052 # "configure: Default to --without-c-locale-coercion on Windows" # (configure.ac hunks ported verbatim; the generated-configure -# hunks are the hand-synced equivalents — this factory ships a -# configure-ready tarball, no autoreconf downstream) +# hunks are REGENERATED with the upstream-pinned autoconf 2.72 — +# byte-identical regen against the pristine 3.14.7 configure +# proven, so no hand-sync drift is possible; this factory ships +# a configure-ready tarball, no autoreconf downstream) # # Wall item (tebako-runtime-python PR #2, round 5): pylifecycle.c:258's # setenv is the first hard stop. --with-c-locale-coercion defaults to yes @@ -18,32 +20,11 @@ # compiles out. An explicit --with-c-locale-coercion still forces it on # (named opt-in, not a silent removal). -diff --git a/configure.ac b/configure.ac -index 967d34d..76a7fbb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -5140,11 +5140,14 @@ AC_MSG_RESULT([$with_pymalloc]) - AC_MSG_CHECKING([for --with-c-locale-coercion]) - AC_ARG_WITH( - [c-locale-coercion], -- [AS_HELP_STRING([--with-c-locale-coercion], [enable C locale coercion to a UTF-8 based locale (default is yes)])]) -+ [AS_HELP_STRING([--with-c-locale-coercion], [enable C locale coercion to a UTF-8 based locale (default is yes on Unix, no on Windows)])]) - - if test -z "$with_c_locale_coercion" - then -- with_c_locale_coercion="yes" -+ case $host in -+ *-*-mingw*) with_c_locale_coercion="no";; -+ *) with_c_locale_coercion="yes";; -+ esac - fi - if test "$with_c_locale_coercion" != "no" - then diff --git a/configure b/configure -index 2cb22a7..9f5920b 100755 +index 730c719..26e35e9 100755 --- a/configure +++ b/configure -@@ -1927,7 +1927,7 @@ Optional Packages: +@@ -1934,7 +1934,7 @@ Optional Packages: --with-pymalloc enable specialized mallocs (default is yes) --with-c-locale-coercion enable C locale coercion to a UTF-8 based locale @@ -52,7 +33,28 @@ index 2cb22a7..9f5920b 100755 --with-valgrind enable Valgrind support (default is no) --with-dtrace enable DTrace support (default is no) --with-libm=STRING override libm math library to STRING (default is -@@ -19096,7 +19096,10 @@ fi +@@ -19527,7 +19527,10 @@ fi + + if test -z "$with_c_locale_coercion" + then +- with_c_locale_coercion="yes" ++ case $host in ++ *-*-mingw*) with_c_locale_coercion="no";; ++ *) with_c_locale_coercion="yes";; ++ esac + fi + if test "$with_c_locale_coercion" != "no" + then +diff --git a/configure.ac b/configure.ac +index e1ae5b8..dd093fa 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -5258,11 +5258,14 @@ AC_MSG_RESULT([$with_pymalloc]) + AC_MSG_CHECKING([for --with-c-locale-coercion]) + AC_ARG_WITH( + [c-locale-coercion], +- [AS_HELP_STRING([--with-c-locale-coercion], [enable C locale coercion to a UTF-8 based locale (default is yes)])]) ++ [AS_HELP_STRING([--with-c-locale-coercion], [enable C locale coercion to a UTF-8 based locale (default is yes on Unix, no on Windows)])]) if test -z "$with_c_locale_coercion" then diff --git a/patches/3.14/configure_disable_posix_modules_msys.patch b/patches/3.14/configure_disable_posix_modules_msys.patch new file mode 100644 index 0000000..5e7df78 --- /dev/null +++ b/patches/3.14/configure_disable_posix_modules_msys.patch @@ -0,0 +1,69 @@ +# configure_disable_posix_modules_msys.patch +# +# Target: configure.ac + the generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0075 +# "configure: disable various modules on MINGW" (ported +# verbatim; configure regenerated with the pinned autoconf 2.72) +# +# Wall class killer: readline/_posixshmem/_posixsubprocess/fcntl/grp/pwd/ +# resource/syslog/termios/_scproxy are POSIX-only modules whose upstream +# gates key on headers/functions that mingw-w64 partially stubs (pwd.h +# and grp.h exist but lack the fields the modules need) — each is a +# latent compile wall the CI would otherwise meet one at a time. The NA +# set subsumes MSYS2 0058's _posixsubprocess gate (not ported separately: +# the NA arm already removes it on win32). The factory's own +# Setup.local *disabled* list overlaps deliberately (readline &co.); +# this patch covers the ones it does not name. +diff --git a/configure b/configure +index efadbf5..6dac703 100755 +--- a/configure ++++ b/configure +@@ -32340,6 +32340,23 @@ case $ac_sys_system in #( + + py_cv_module__scproxy=n/a + ;; #( ++ MINGW*) : ++ ++ ++ ++ py_cv_module_readline=n/a ++ py_cv_module__posixshmem=n/a ++ py_cv_module__posixsubprocess=n/a ++ py_cv_module_fcntl=n/a ++ py_cv_module_grp=n/a ++ py_cv_module_pwd=n/a ++ py_cv_module_resource=n/a ++ py_cv_module_syslog=n/a ++ py_cv_module_termios=n/a ++ py_cv_module__scproxy=n/a ++ py_cv_module_=n/a ++ ++ ;; #( + QNX*) : + + +diff --git a/configure.ac b/configure.ac +index 43c1417..d47bcda 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8112,6 +8112,20 @@ AS_CASE([$ac_sys_system], + ) + ], + [CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy])], ++ [MINGW*], [ ++ PY_STDLIB_MOD_SET_NA( ++ [readline], ++ [_posixshmem], ++ [_posixsubprocess], ++ [fcntl], ++ [grp], ++ [pwd], ++ [resource], ++ [syslog], ++ [termios], ++ [_scproxy], ++ ) ++ ], + [QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy])], + [FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy])], + [Emscripten], [ diff --git a/patches/3.14/configure_exeext_msys.patch b/patches/3.14/configure_exeext_msys.patch new file mode 100644 index 0000000..f138a7a --- /dev/null +++ b/patches/3.14/configure_exeext_msys.patch @@ -0,0 +1,65 @@ +# configure_exeext_msys.patch +# +# Target: configure.ac + the generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0063 +# "configure: set BUILDEXEEXT and EXEEXT" (ported verbatim; +# configure regenerated with the pinned autoconf 2.72) +# +# Determinism, not a compile wall: upstream leaves EXEEXT empty for +# non-wasm autotools hosts and derives BUILDEXEEXT from a +# case-insensitive-build-directory PROBE — the exe spelling then depends +# on the runner filesystem's case sensitivity (a case-sensitive windows +# mount flips it). The runtime factory reads BUILDEXE off the generated +# Makefile (PythonBuild#exe_path); the patch pins EXEEXT=.exe and +# BUILDEXEEXT=.exe for MINGW so the artifact name is probe-independent. +diff --git a/configure b/configure +index a621d6a..efadbf5 100755 +--- a/configure ++++ b/configure +@@ -7510,6 +7510,8 @@ else case e in #( + EXEEXT=.mjs ;; #( + WASI) : + EXEEXT=.wasm ;; #( ++ MINGW*) : ++ EXEEXT=.exe ;; #( + *) : + EXEEXT= + ;; +@@ -7545,6 +7547,14 @@ printf "%s\n" "no" >&6; } + fi + rmdir CaseSensitiveTestDir + ++case $ac_sys_system in #( ++ MINGW) : ++ BUILDEXEEXT=".exe" ++ ;; #( ++ *) : ++ ;; ++esac ++ + case $ac_sys_system in + hp*|HP*) + case $ac_cv_cc_name in +diff --git a/configure.ac b/configure.ac +index 19907c4..43c1417 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1391,6 +1391,7 @@ AC_ARG_WITH([suffix], + AS_CASE([$ac_sys_system], + [Emscripten], [EXEEXT=.mjs], + [WASI], [EXEEXT=.wasm], ++ [MINGW*], [EXEEXT=.exe], + [EXEEXT=] + ) + ]) +@@ -1417,6 +1418,10 @@ else + fi + rmdir CaseSensitiveTestDir + ++AS_CASE([$ac_sys_system], ++ [MINGW], [BUILDEXEEXT=".exe"] ++) ++ + case $ac_sys_system in + hp*|HP*) + case $ac_cv_cc_name in diff --git a/patches/3.14/configure_inet_pton_msys.patch b/patches/3.14/configure_inet_pton_msys.patch new file mode 100644 index 0000000..0e97b35 --- /dev/null +++ b/patches/3.14/configure_inet_pton_msys.patch @@ -0,0 +1,232 @@ +# configure_inet_pton_msys.patch +# +# Target: configure.ac + the generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0041 +# "configure: fix inet_pton check" (ported verbatim; configure +# regenerated with the pinned autoconf 2.72) +# +# The socket probe pair of socketmodule_msys (0017): PY_CHECK_SOCKET_FUNC +# (inet_aton/inet_pton) probes through the POSIX socket headers, which +# mingw-w64 lacks — the functions are misdetected as absent even though +# ws2tcpip.h provides them. socketmodule.c's HAVE_INET_PTON branches then +# compile the fallback (or fail to expose the function), a silent +# capability loss on a platform that has the API. Probe through +# ws2tcpip.h under _WIN32 instead. +diff --git a/configure b/configure +index 3675f6c..730c719 100755 +--- a/configure ++++ b/configure +@@ -23857,10 +23857,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -23903,10 +23907,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -23949,10 +23957,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -23995,10 +24007,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24041,10 +24057,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24087,10 +24107,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24133,10 +24157,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24179,10 +24207,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24225,10 +24257,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24271,10 +24307,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24317,10 +24357,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24363,10 +24407,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +@@ -24409,10 +24457,14 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + + int + main (void) +diff --git a/configure.ac b/configure.ac +index 0d73a2e..e1ae5b8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -5747,10 +5747,14 @@ PY_CHECK_NETDB_FUNC([getprotobyname]) + + dnl PY_CHECK_SOCKET_FUNC(FUNCTION) + AC_DEFUN([PY_CHECK_SOCKET_FUNC], [PY_CHECK_FUNC([$1], [ ++#ifdef _WIN32 ++#include ++#else + #include + #include + #include + #include ++#endif + ])]) + + PY_CHECK_SOCKET_FUNC([inet_aton]) diff --git a/patches/3.14/configure_machdep_msys.patch b/patches/3.14/configure_machdep_msys.patch index 2ad071b..7754b07 100644 --- a/patches/3.14/configure_machdep_msys.patch +++ b/patches/3.14/configure_machdep_msys.patch @@ -3,10 +3,11 @@ # Target: configure.ac + the generated configure (windows-msys scenario) # Source: MSYS2 MINGW-packages mingw-w64-python 0004 # "configure: add MACHDEP and platform on MINGW" (configure.ac -# hunks ported verbatim; the generated-configure hunks are the -# hand-synced equivalents — MSYS2 regenerates with autoreconf, -# this factory ships a configure-ready tarball so consumers never -# need autoconf) +# hunks ported verbatim; the generated-configure hunks are +# REGENERATED with the upstream-pinned autoconf 2.72 — +# byte-identical regen against the pristine 3.14.7 configure +# proven, so no hand-sync drift is possible; this factory ships +# a configure-ready tarball so consumers never need autoconf) # # Wall item (tebako-runtime-python PR #2, round 5): configure.ac carries # ZERO mingw cases. Without them a ucrt64 configure completes but leaves @@ -18,11 +19,11 @@ # *-*-mingw* → _host_cpu= (cross-compile allow-list: no # _host_ident suffix on mingw) -diff --git a/configure.ac b/configure.ac -index 967d34d..2d24cea 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -327,6 +327,9 @@ then +diff --git a/configure b/configure +index badddc9..e5329ce 100755 +--- a/configure ++++ b/configure +@@ -4118,6 +4118,9 @@ then *-*-cygwin*) ac_sys_system=Cygwin ;; @@ -32,7 +33,7 @@ index 967d34d..2d24cea 100644 *-apple-ios*) ac_sys_system=iOS ;; -@@ -370,6 +373,7 @@ then +@@ -4161,6 +4164,7 @@ then linux*) MACHDEP="linux";; cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; @@ -40,7 +41,7 @@ index 967d34d..2d24cea 100644 '') MACHDEP="unknown";; esac -@@ -812,6 +816,9 @@ if test "$cross_compiling" = yes; then +@@ -4637,6 +4641,9 @@ printf "%s\n" "$IPHONEOS_DEPLOYMENT_TARGET" >&6; } wasm32-*-* | wasm64-*-*) _host_ident=$host_cpu ;; @@ -50,11 +51,11 @@ index 967d34d..2d24cea 100644 *) # for now, limit cross builds to known configurations MACHDEP="unknown" -diff --git a/configure b/configure -index 2cb22a7..03a84d2 100755 ---- a/configure -+++ b/configure -@@ -4115,6 +4115,9 @@ then +diff --git a/configure.ac b/configure.ac +index b320f92..10a1152 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -327,6 +327,9 @@ then *-*-cygwin*) ac_sys_system=Cygwin ;; @@ -64,7 +65,7 @@ index 2cb22a7..03a84d2 100755 *-apple-ios*) ac_sys_system=iOS ;; -@@ -4158,6 +4161,7 @@ then +@@ -370,6 +373,7 @@ then linux*) MACHDEP="linux";; cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; @@ -72,7 +73,7 @@ index 2cb22a7..03a84d2 100755 '') MACHDEP="unknown";; esac -@@ -4634,6 +4638,9 @@ printf "%s\n" "$IPHONEOS_DEPLOYMENT_TARGET" >&6; } +@@ -812,6 +816,9 @@ if test "$cross_compiling" = yes; then wasm32-*-* | wasm64-*-*) _host_ident=$host_cpu ;; diff --git a/patches/3.14/configure_mingw_defaults_msys.patch b/patches/3.14/configure_mingw_defaults_msys.patch new file mode 100644 index 0000000..d908f8f --- /dev/null +++ b/patches/3.14/configure_mingw_defaults_msys.patch @@ -0,0 +1,142 @@ +# configure_mingw_defaults_msys.patch +# +# Target: configure.ac + the generated configure + the new +# Misc/config_mingw / Misc/cross_mingw32 (windows-msys +# scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0005 +# "build: Add default cross configuration for MINGW" (ported +# verbatim in content; the patch's FILE ORDER is rearranged — +# configure.ac first — so the repo's patch-target sanity check +# sees an existing file: the two Misc/ files are creations. +# The generated configure equivalent is REGENERATED with the +# upstream-pinned autoconf 2.72, byte-identical regen proven; +# pyconfig.h.in untouched — ac_cv presets, no AC_DEFINEs.) +# +# Despite the MSYS2 title, this is NOT cross-only: the configure.ac +# loader sources Misc/config_mingw for EVERY *-*-mingw* host, native +# included (only Misc/cross_mingw32 is cross-gated). Wall items +# (this PR's first CI leg, run 34730588522, native ucrt64): +# * Modules/signalmodule.c:398 implicit declaration of 'alarm' — +# the link probe finds alarm in the mingw import libs (HAVE_ALARM +# defined) but ucrt64's declares it only under +# __USE_MINGW_ALARM. MSVC's PC/pyconfig.h has no HAVE_ALARM. +# ac_cv_func_alarm=ignore pins the probe off. +# * Modules/posixmodule.c:9000 implicit declaration of 'ioctl' / +# 'I_PUSH' undeclared — under the MSYS2 shell /dev/ptmx EXISTS (the +# msys runtime emulates it), so the native probe defines +# HAVE_DEV_PTMX, os_openpty_impl compiles, and its +# !CYGWIN/!ANDROID/!HAVE_DEV_PTC arm reaches the STREAMS ioctls +# mingw-w64 does not have. ac_cv_file__dev_ptmx=ignore (+ptc=no) +# pins both off; os.openpty simply does not exist on Windows, +# matching MSVC. +# The same file pins ftruncate/truncate off (mingw-w64's are the wrong +# semantics; posixmodule then takes the _chsize path) and forces +# getpeername on (winsock2 has it; the plain link probe can't see it +# without -lws2_32 at probe time). +diff --git a/configure.ac b/configure.ac +index 10a1152..1aea917 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1270,6 +1270,28 @@ AC_CACHE_CHECK([for -Wl,--no-as-needed], [ac_cv_wl_no_as_needed], [ + ]) + AC_SUBST([NO_AS_NEEDED]) + ++# initialize default configuration ++py_config= ++case $host in ++ *-*-mingw*) py_config=mingw ;; ++esac ++if test -n "$py_config" ; then ++ AC_MSG_NOTICE([loading configure defaults from .../Misc/config_$py_config"]) ++ . "$srcdir/Misc/config_$py_config" ++fi ++ ++# initialize defaults for cross-builds ++if test "$cross_compiling" = yes; then ++ py_config=$host_os ++ case $py_config in ++ mingw32*) py_config=mingw32 ;; ++ esac ++ if test -f "$srcdir/Misc/cross_$py_config" ; then ++ AC_MSG_NOTICE([loading cross defaults from .../Misc/cross_$py_config"]) ++ . "$srcdir/Misc/cross_$py_config" ++ fi ++fi ++ + AC_MSG_CHECKING([for the Android API level]) + cat > conftest.c <&6; } + + ++# initialize default configuration ++py_config= ++case $host in ++ *-*-mingw*) py_config=mingw ;; ++esac ++if test -n "$py_config" ; then ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading configure defaults from .../Misc/config_$py_config\"" >&5 ++printf "%s\n" "$as_me: loading configure defaults from .../Misc/config_$py_config\"" >&6;} ++ . "$srcdir/Misc/config_$py_config" ++fi ++ ++# initialize defaults for cross-builds ++if test "$cross_compiling" = yes; then ++ py_config=$host_os ++ case $py_config in ++ mingw32*) py_config=mingw32 ;; ++ esac ++ if test -f "$srcdir/Misc/cross_$py_config" ; then ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cross defaults from .../Misc/cross_$py_config\"" >&5 ++printf "%s\n" "$as_me: loading cross defaults from .../Misc/cross_$py_config\"" >&6;} ++ . "$srcdir/Misc/cross_$py_config" ++ fi ++fi ++ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the Android API level" >&5 + printf %s "checking for the Android API level... " >&6; } + cat > conftest.c <&5 +diff --git a/configure.ac b/configure.ac +index 4a169da..d7ad919 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2587,6 +2587,14 @@ fi + AS_VAR_IF([ac_cv_gcc_compat], [yes], [ + CFLAGS_NODIST="$CFLAGS_NODIST -std=c11" + ++ # GCC 14 and later error out with incompatible-pointer-types ++ # this only occues on mingw ++ case $host in ++ *-*-mingw*) ++ CFLAGS_NODIST="$CFLAGS_NODIST -Wno-error=incompatible-pointer-types" ++ ;; ++ esac ++ + PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra]) + AS_VAR_IF([ac_cv_enable_extra_warning], [yes], + [CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"]) diff --git a/patches/3.14/configure_nt_threads_msys.patch b/patches/3.14/configure_nt_threads_msys.patch new file mode 100644 index 0000000..5d89964 --- /dev/null +++ b/patches/3.14/configure_nt_threads_msys.patch @@ -0,0 +1,839 @@ +# configure_nt_threads_msys.patch +# +# Target: configure.ac + the generated configure + pyconfig.h.in, +# Include/pythread.h, Include/internal/pycore_pythread.h, +# Include/internal/pycore_condvar.h, +# Modules/_multiprocessing/multiprocessing.h (windows-msys +# scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0001 +# "build: add --with-nt-threads and make it default on mingw" +# (ported verbatim; the generated configure/pyconfig.h.in +# equivalents are REGENERATED with the upstream-pinned autoconf +# 2.72 — byte-identical regen against the pristine 3.14.7 +# configure proven, so no hand-sync drift is possible; this +# factory ships a configure-ready tarball, no autoreconf +# downstream) +# +# Wall item (tebako-runtime-python PR #16, run 34725669811): +# Python/thread_pthread.h:413: 'native_id' undeclared and :440: implicit +# declaration of 'pause'. The pthread ladder has no __MINGW32__ rung +# (upstream's pthread path is POSIX-only; the Windows thread support +# upstream tests is thread_nt.h behind the MSVC build). MSYS2's proven +# answer is NOT to grow pthread rungs but to select the NT thread model +# on mingw: --with-nt-threads defaults to yes for *-*-mingw* hosts, +# AC_DEFINEs NT_THREADS, and skips the pthread/semaphore probe set; +# pythread.h/pycore_pythread.h/pycore_condvar.h then undef _POSIX_THREADS +# (winpthreads leaks it via ), so Python/thread.c compiles +# thread_nt.h — the upstream-supported Windows thread model — and +# thread_pthread.h never enters the build. +diff --git a/Include/internal/pycore_condvar.h b/Include/internal/pycore_condvar.h +index 55271f0..8b23568 100644 +--- a/Include/internal/pycore_condvar.h ++++ b/Include/internal/pycore_condvar.h +@@ -35,6 +35,10 @@ + # define WIN32_LEAN_AND_MEAN + #endif + #include // CRITICAL_SECTION ++/* winpthreads are involved via windows header, so need undef _POSIX_THREADS after header include */ ++#if defined(_POSIX_THREADS) ++#undef _POSIX_THREADS ++#endif + + /* options */ + /* emulated condition variables are provided for those that want +diff --git a/Include/internal/pycore_pythread.h b/Include/internal/pycore_pythread.h +index 8457b07..6148215 100644 +--- a/Include/internal/pycore_pythread.h ++++ b/Include/internal/pycore_pythread.h +@@ -16,6 +16,12 @@ extern "C" { + && !defined(_POSIX_SEMAPHORES)) + # include // _POSIX_THREADS, _POSIX_SEMAPHORES + #endif ++#ifdef __MINGW32__ ++# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS) ++# undef _POSIX_THREADS ++# endif ++#endif ++ + #if (defined(HAVE_PTHREAD_H) && !defined(_POSIX_THREADS) \ + && !defined(_POSIX_SEMAPHORES)) + // This means pthreads are not implemented in libc headers, hence the macro +diff --git a/Include/pythread.h b/Include/pythread.h +index 82247da..52fc8d2 100644 +--- a/Include/pythread.h ++++ b/Include/pythread.h +@@ -7,6 +7,12 @@ typedef void *PyThread_type_lock; + extern "C" { + #endif + ++#ifdef __MINGW32__ ++# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS) ++# undef _POSIX_THREADS ++# endif ++#endif ++ + /* Return status codes for Python lock acquisition. Chosen for maximum + * backwards compatibility, ie failure -> 0, success -> 1. */ + typedef enum PyLockStatus { +diff --git a/Modules/_multiprocessing/multiprocessing.h b/Modules/_multiprocessing/multiprocessing.h +index 099004b..ba80920 100644 +--- a/Modules/_multiprocessing/multiprocessing.h ++++ b/Modules/_multiprocessing/multiprocessing.h +@@ -31,6 +31,9 @@ + # define SEM_HANDLE HANDLE + # define SEM_VALUE_MAX LONG_MAX + # define HAVE_MP_SEMAPHORE ++# if defined(HAVE_SEM_OPEN) && defined(_POSIX_THREADS) ++# include ++# endif + #else + # include /* O_CREAT and O_EXCL */ + # if defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED) +diff --git a/configure b/configure +index 2cb22a7..badddc9 100755 +--- a/configure ++++ b/configure +@@ -1105,6 +1105,7 @@ with_strict_overflow + enable_safety + enable_slower_safety + enable_experimental_jit ++with_nt_threads + with_dsymutil + with_address_sanitizer + with_memory_sanitizer +@@ -1890,6 +1891,8 @@ Optional Packages: + is no) + --with-strict-overflow if 'yes', add -fstrict-overflow to CFLAGS, else add + -fno-strict-overflow (default is no) ++ --with-nt-threads build with windows threads (default is ++ system-dependent) + --with-dsymutil link debug information into final executable with + dsymutil in macOS (default is no) + --with-address-sanitizer +@@ -11075,6 +11078,66 @@ then + BASECFLAGS="$BASECFLAGS $ac_arch_flags" + fi + ++ ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-nt-threads" >&5 ++printf %s "checking for --with-nt-threads... " >&6; } ++ ++# Check whether --with-nt-threads was given. ++if test ${with_nt_threads+y} ++then : ++ withval=$with_nt_threads; ++ case $withval in ++ no) with_nt_threads=no;; ++ yes) with_nt_threads=yes;; ++ *) with_nt_threads=yes;; ++ esac ++ ++else case e in #( ++ e) ++ case $host in ++ *-*-mingw*) with_nt_threads=yes;; ++ *) with_nt_threads=no;; ++ esac ++ ;; ++esac ++fi ++ ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_nt_threads" >&5 ++printf "%s\n" "$with_nt_threads" >&6; } ++ ++if test $with_nt_threads = yes ; then ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether linking with nt-threads work" >&5 ++printf %s "checking whether linking with nt-threads work... " >&6; } ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++ #include ++int ++main (void) ++{ ++_beginthread(0, 0, 0); ++ ; ++ return 0; ++} ++ ++_ACEOF ++if ac_fn_c_try_link "$LINENO" ++then : ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++printf "%s\n" "yes" >&6; } ++else case e in #( ++ e) as_fn_error $? "failed to link with nt-threads" "$LINENO" 5 ;; ++esac ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ ++if test $with_nt_threads = yes ; then ++ ac_cv_pthread_is_default=no ++ ac_cv_kthread=no ++ ac_cv_pthread=no ++ else + # On some compilers, pthreads are available without further options + # (e.g. MacOS X). On some of these systems, the compiler will not + # complain if unaccepted options are passed (e.g. gcc on Mac OS X). +@@ -11297,6 +11360,8 @@ fi + printf "%s\n" "$ac_cv_pthread" >&6; } + fi + ++fi ++ + # If we have set a CC compiler flag for thread support then + # check if it works for CXX, too. + if test ! -z "$CXX" +@@ -11321,6 +11386,9 @@ elif test "$ac_cv_pthread" = "yes" + then + CXX="$CXX -pthread" + ac_cv_cxx_thread=yes ++elif test "$with_nt_threads" = "yes" ++then ++ ac_cv_cxx_thread=always + else + ac_cv_cxx_thread=no + fi +@@ -11538,24 +11606,12 @@ if test "x$ac_cv_header_process_h" = xyes + then : + printf "%s\n" "#define HAVE_PROCESS_H 1" >>confdefs.h + +-fi +-ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +-if test "x$ac_cv_header_pthread_h" = xyes +-then : +- printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h +- + fi + ac_fn_c_check_header_compile "$LINENO" "pty.h" "ac_cv_header_pty_h" "$ac_includes_default" + if test "x$ac_cv_header_pty_h" = xyes + then : + printf "%s\n" "#define HAVE_PTY_H 1" >>confdefs.h + +-fi +-ac_fn_c_check_header_compile "$LINENO" "sched.h" "ac_cv_header_sched_h" "$ac_includes_default" +-if test "x$ac_cv_header_sched_h" = xyes +-then : +- printf "%s\n" "#define HAVE_SCHED_H 1" >>confdefs.h +- + fi + ac_fn_c_check_header_compile "$LINENO" "setjmp.h" "ac_cv_header_setjmp_h" "$ac_includes_default" + if test "x$ac_cv_header_setjmp_h" = xyes +@@ -12076,6 +12132,315 @@ fi + fi + + ++# If using nt threads, don't look for pthread.h or thread.h ++if test "x$with_nt_threads" = xno ; then ++# Autoupdate added the next two lines to ensure that your configure ++# script's behavior did not change. They are probably safe to remove. ++ ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 ++printf %s "checking for egrep... " >&6; } ++if test ${ac_cv_path_EGREP+y} ++then : ++ printf %s "(cached) " >&6 ++else case e in #( ++ e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 ++ then ac_cv_path_EGREP="$GREP -E" ++ else ++ if test -z "$EGREP"; then ++ ac_path_EGREP_found=false ++ # Loop through the user's path and test for each of PROGNAME-LIST ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin ++do ++ IFS=$as_save_IFS ++ case $as_dir in #((( ++ '') as_dir=./ ;; ++ */) ;; ++ *) as_dir=$as_dir/ ;; ++ esac ++ for ac_prog in egrep ++ do ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" ++ as_fn_executable_p "$ac_path_EGREP" || continue ++# Check for GNU ac_path_EGREP and select it if it is found. ++ # Check for GNU $ac_path_EGREP ++case `"$ac_path_EGREP" --version 2>&1` in #( ++*GNU*) ++ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; ++#( ++*) ++ ac_count=0 ++ printf %s 0123456789 >"conftest.in" ++ while : ++ do ++ cat "conftest.in" "conftest.in" >"conftest.tmp" ++ mv "conftest.tmp" "conftest.in" ++ cp "conftest.in" "conftest.nl" ++ printf "%s\n" 'EGREP' >> "conftest.nl" ++ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break ++ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ++ as_fn_arith $ac_count + 1 && ac_count=$as_val ++ if test $ac_count -gt ${ac_path_EGREP_max-0}; then ++ # Best one so far, save it but keep looking for a better one ++ ac_cv_path_EGREP="$ac_path_EGREP" ++ ac_path_EGREP_max=$ac_count ++ fi ++ # 10*(2^10) chars as input seems more than enough ++ test $ac_count -gt 10 && break ++ done ++ rm -f conftest.in conftest.tmp conftest.nl conftest.out;; ++esac ++ ++ $ac_path_EGREP_found && break 3 ++ done ++ done ++ done ++IFS=$as_save_IFS ++ if test -z "$ac_cv_path_EGREP"; then ++ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 ++ fi ++else ++ ac_cv_path_EGREP=$EGREP ++fi ++ ++ fi ;; ++esac ++fi ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 ++printf "%s\n" "$ac_cv_path_EGREP" >&6; } ++ EGREP="$ac_cv_path_EGREP" ++ ++ EGREP_TRADITIONAL=$EGREP ++ ac_cv_path_EGREP_TRADITIONAL=$EGREP ++ ++ ++ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" ++if test "x$ac_cv_header_pthread_h" = xyes ++then : ++ printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h ++ ++fi ++ac_fn_c_check_header_compile "$LINENO" "sched.h" "ac_cv_header_sched_h" "$ac_includes_default" ++if test "x$ac_cv_header_sched_h" = xyes ++then : ++ printf "%s\n" "#define HAVE_SCHED_H 1" >>confdefs.h ++ ++fi ++ac_fn_c_check_header_compile "$LINENO" "thread.h" "ac_cv_header_thread_h" "$ac_includes_default" ++if test "x$ac_cv_header_thread_h" = xyes ++then : ++ printf "%s\n" "#define HAVE_THREAD_H 1" >>confdefs.h ++ ++fi ++ ++ac_header_dirent=no ++for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do ++ as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | sed "$as_sed_sh"` ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 ++printf %s "checking for $ac_hdr that defines DIR... " >&6; } ++if eval test \${$as_ac_Header+y} ++then : ++ printf %s "(cached) " >&6 ++else case e in #( ++ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++#include <$ac_hdr> ++ ++int ++main (void) ++{ ++if ((DIR *) 0) ++return 0; ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO" ++then : ++ eval "$as_ac_Header=yes" ++else case e in #( ++ e) eval "$as_ac_Header=no" ;; ++esac ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; ++esac ++fi ++eval ac_res=\$$as_ac_Header ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 ++printf "%s\n" "$ac_res" >&6; } ++if eval test \"x\$"$as_ac_Header"\" = x"yes" ++then : ++ cat >>confdefs.h <<_ACEOF ++#define `printf "%s\n" "HAVE_$ac_hdr" | sed "$as_sed_cpp"` 1 ++_ACEOF ++ ++ac_header_dirent=$ac_hdr; break ++fi ++ ++done ++# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. ++if test $ac_header_dirent = dirent.h; then ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 ++printf %s "checking for library containing opendir... " >&6; } ++if test ${ac_cv_search_opendir+y} ++then : ++ printf %s "(cached) " >&6 ++else case e in #( ++ e) ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. ++ The 'extern "C"' is for builds by C++ compilers; ++ although this is not generally supported in C code supporting it here ++ has little cost and some practical benefit (sr 110532). */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char opendir (void); ++int ++main (void) ++{ ++return opendir (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' dir ++do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO" ++then : ++ ac_cv_search_opendir=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam \ ++ conftest$ac_exeext ++ if test ${ac_cv_search_opendir+y} ++then : ++ break ++fi ++done ++if test ${ac_cv_search_opendir+y} ++then : ++ ++else case e in #( ++ e) ac_cv_search_opendir=no ;; ++esac ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ;; ++esac ++fi ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 ++printf "%s\n" "$ac_cv_search_opendir" >&6; } ++ac_res=$ac_cv_search_opendir ++if test "$ac_res" != no ++then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++fi ++ ++else ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 ++printf %s "checking for library containing opendir... " >&6; } ++if test ${ac_cv_search_opendir+y} ++then : ++ printf %s "(cached) " >&6 ++else case e in #( ++ e) ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. ++ The 'extern "C"' is for builds by C++ compilers; ++ although this is not generally supported in C code supporting it here ++ has little cost and some practical benefit (sr 110532). */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char opendir (void); ++int ++main (void) ++{ ++return opendir (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' x ++do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO" ++then : ++ ac_cv_search_opendir=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam \ ++ conftest$ac_exeext ++ if test ${ac_cv_search_opendir+y} ++then : ++ break ++fi ++done ++if test ${ac_cv_search_opendir+y} ++then : ++ ++else case e in #( ++ e) ac_cv_search_opendir=no ;; ++esac ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ;; ++esac ++fi ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 ++printf "%s\n" "$ac_cv_search_opendir" >&6; } ++ac_res=$ac_cv_search_opendir ++if test "$ac_res" != no ++then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++fi ++ ++fi ++ ++ ++ac_fn_c_check_header_compile "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" ++if test "x$ac_cv_header_sys_mkdev_h" = xyes ++then : ++ ++printf "%s\n" "#define MAJOR_IN_MKDEV 1" >>confdefs.h ++ ++fi ++ ++if test $ac_cv_header_sys_mkdev_h = no; then ++ ac_fn_c_check_header_compile "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" ++if test "x$ac_cv_header_sys_sysmacros_h" = xyes ++then : ++ ++printf "%s\n" "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h ++ ++fi ++ ++fi ++ ++fi ++ + # bluetooth/bluetooth.h has been known to not compile with -std=c99. + # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294 + SAVE_CFLAGS=$CFLAGS +@@ -13225,6 +13590,9 @@ elif test "$ac_cv_pthread" = "yes" + then CC="$CC -pthread" + fi + ++if test $with_nt_threads = yes ; then ++ ac_cv_have_pthread_t=skip ++else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_t" >&5 + printf %s "checking for pthread_t... " >&6; } + if test ${ac_cv_have_pthread_t+y} +@@ -13386,7 +13754,7 @@ printf "%s\n" "#define PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT 1" >>confdefs.h + + + fi +- ++fi + CC="$ac_save_cc" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --enable-framework" >&5 +@@ -14840,6 +15208,9 @@ printf "%s\n" "unstable" >&6; } + fi + fi + ++if test $with_nt_threads = yes ; then ++ : ++else + # 'Real Time' functions on Solaris + # posix4 on Solaris 2.6 + # pthread (first!) on Linux +@@ -14910,6 +15281,7 @@ then : + + fi + ++fi + + # check if we need libintl for locale functions + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 +@@ -17888,6 +18260,12 @@ then + CXX="$CXX -pthread" + fi + posix_threads=yes ++elif test $with_nt_threads = yes ++then ++ posix_threads=no ++ ++printf "%s\n" "#define NT_THREADS 1" >>confdefs.h ++ + else + if test ! -z "$withval" -a -d "$withval" + then LDFLAGS="$LDFLAGS -L$withval" +@@ -19373,6 +19751,11 @@ if test "$ac_sys_system" = "Linux-android"; then + fi + + # checks for library functions ++if test $with_nt_threads = yes ; then ++ ac_cv_func_pthread_kill=skip ++ ac_cv_func_sem_open=skip ++ ac_cv_func_sched_setscheduler=skip ++fi + ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4" + if test "x$ac_cv_func_accept4" = xyes + then : +@@ -26318,6 +26701,9 @@ fi + done + LIBS=$LIBS_SAVE + ++if test $with_nt_threads = yes ; then ++ ac_cv_posix_semaphores_enabled=no ++fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 + printf %s "checking whether POSIX semaphores are enabled... " >&6; } + if test ${ac_cv_posix_semaphores_enabled+y} +@@ -26377,6 +26763,9 @@ printf "%s\n" "#define POSIX_SEMAPHORES_NOT_ENABLED 1" >>confdefs.h + + fi + ++if test $with_nt_threads = yes ; then ++ ac_cv_broken_sem_getvalue=skip ++fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 + printf %s "checking for broken sem_getvalue... " >&6; } + if test ${ac_cv_broken_sem_getvalue+y} +diff --git a/configure.ac b/configure.ac +index 967d34d..b320f92 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2903,6 +2903,53 @@ then + BASECFLAGS="$BASECFLAGS $ac_arch_flags" + fi + ++dnl NOTE: ++dnl - GCC 4.4+ for mingw* require and use posix threads(pthreads-w32) ++dnl - Host may contain installed pthreads-w32. ++dnl - On windows platform only NT-thread model is supported. ++dnl To avoid miss detection scipt first will check for NT-thread model ++dnl and if is not found will try to detect build options for pthread ++dnl model. Autodetection could be overiden if variable with_nt_threads ++dnl is set in "Site Configuration" (see autoconf manual). ++dnl If NT-thread model is enabled script skips some checks that ++dnl impact build process. When a new functionality is added, developers ++dnl are responsible to update configure script to avoid thread models ++dnl to be mixed. ++ ++AC_MSG_CHECKING([for --with-nt-threads]) ++AC_ARG_WITH(nt-threads, ++ AS_HELP_STRING([--with-nt-threads], [build with windows threads (default is system-dependent)]), ++[ ++ case $withval in ++ no) with_nt_threads=no;; ++ yes) with_nt_threads=yes;; ++ *) with_nt_threads=yes;; ++ esac ++], [ ++ case $host in ++ *-*-mingw*) with_nt_threads=yes;; ++ *) with_nt_threads=no;; ++ esac ++]) ++AC_MSG_RESULT([$with_nt_threads]) ++ ++if test $with_nt_threads = yes ; then ++AC_MSG_CHECKING([whether linking with nt-threads work]) ++AC_LINK_IFELSE([ ++ AC_LANG_PROGRAM([[#include ]],[[_beginthread(0, 0, 0);]]) ++ ], ++ [AC_MSG_RESULT([yes])], ++ [AC_MSG_ERROR([failed to link with nt-threads])]) ++fi ++ ++if test $with_nt_threads = yes ; then ++ dnl temporary default flag to avoid additional pthread checks ++ dnl and initilize other ac..thread flags to no ++ ac_cv_pthread_is_default=no ++ ac_cv_kthread=no ++ ac_cv_pthread=no ++ dnl ac_cv_kpthread is set to no if default is yes (see below) ++else + # On some compilers, pthreads are available without further options + # (e.g. MacOS X). On some of these systems, the compiler will not + # complain if unaccepted options are passed (e.g. gcc on Mac OS X). +@@ -3014,6 +3061,8 @@ int main(void){ + CC="$ac_save_cc"]) + fi + ++fi ++ + # If we have set a CC compiler flag for thread support then + # check if it works for CXX, too. + if test ! -z "$CXX" +@@ -3033,6 +3082,10 @@ elif test "$ac_cv_pthread" = "yes" + then + CXX="$CXX -pthread" + ac_cv_cxx_thread=yes ++elif test "$with_nt_threads" = "yes" ++then ++ dnl set to always to skip extra pthread check below ++ ac_cv_cxx_thread=always + else + ac_cv_cxx_thread=no + fi +@@ -3074,8 +3127,8 @@ AC_CHECK_HEADERS([ \ + alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \ + io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \ + linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \ +- linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \ +- sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \ ++ linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pty.h \ ++ setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \ + sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \ + sys/loadavg.h sys/lock.h sys/memfd.h sys/mkdev.h sys/mman.h sys/modem.h sys/param.h sys/pidfd.h sys/poll.h \ + sys/random.h sys/resource.h sys/select.h sys/sendfile.h sys/socket.h sys/soundcard.h sys/stat.h \ +@@ -3087,6 +3140,14 @@ AC_CHECK_HEADERS([ \ + AC_HEADER_DIRENT + AC_HEADER_MAJOR + ++# If using nt threads, don't look for pthread.h or thread.h ++if test "x$with_nt_threads" = xno ; then ++AC_HEADER_STDC ++AC_CHECK_HEADERS(pthread.h sched.h thread.h) ++AC_HEADER_DIRENT ++AC_HEADER_MAJOR ++fi ++ + # bluetooth/bluetooth.h has been known to not compile with -std=c99. + # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294 + SAVE_CFLAGS=$CFLAGS +@@ -3290,6 +3351,10 @@ elif test "$ac_cv_pthread" = "yes" + then CC="$CC -pthread" + fi + ++if test $with_nt_threads = yes ; then ++ dnl skip check for pthread_t if NT-thread model is enabled ++ ac_cv_have_pthread_t=skip ++else + AC_CACHE_CHECK([for pthread_t], [ac_cv_have_pthread_t], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[@%:@include ]], [[pthread_t x; x = *(pthread_t*)0;]]) +@@ -3321,7 +3386,7 @@ AS_VAR_IF([ac_cv_pthread_key_t_is_arithmetic_type], [yes], [ + AC_DEFINE([PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT], [1], + [Define if pthread_key_t is compatible with int.]) + ]) +- ++fi + CC="$ac_save_cc" + + AC_MSG_CHECKING([for --enable-framework]) +@@ -3966,10 +4031,15 @@ then + fi + fi + ++if test $with_nt_threads = yes ; then ++ dnl do not search for sem_init if NT-thread model is enabled ++ : ++else + # 'Real Time' functions on Solaris + # posix4 on Solaris 2.6 + # pthread (first!) on Linux + AC_SEARCH_LIBS([sem_init], [pthread rt posix4]) ++fi + + # check if we need libintl for locale functions + AC_CHECK_LIB([intl], [textdomain], +@@ -4737,6 +4807,11 @@ then + CXX="$CXX -pthread" + fi + posix_threads=yes ++elif test $with_nt_threads = yes ++then ++ posix_threads=no ++ AC_DEFINE(NT_THREADS, 1, ++ [Define to 1 if you want to use native NT threads]) + else + if test ! -z "$withval" -a -d "$withval" + then LDFLAGS="$LDFLAGS -L$withval" +@@ -5318,6 +5393,15 @@ if test "$ac_sys_system" = "Linux-android"; then + fi + + # checks for library functions ++if test $with_nt_threads = yes ; then ++ dnl GCC(mingw) 4.4+ require and use posix threads(pthreads-w32) ++ dnl and host may contain installed pthreads-w32. ++ dnl Skip checks for some functions declared in pthreads-w32 if ++ dnl NT-thread model is enabled. ++ ac_cv_func_pthread_kill=skip ++ ac_cv_func_sem_open=skip ++ ac_cv_func_sched_setscheduler=skip ++fi + AC_CHECK_FUNCS([ \ + accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \ + copy_file_range ctermid dladdr dup execv explicit_bzero explicit_memset \ +@@ -6254,6 +6338,10 @@ dnl actually works. For FreeBSD versions <= 7.2, + dnl the kernel module that provides POSIX semaphores + dnl isn't loaded by default, so an attempt to call + dnl sem_open results in a 'Signal 12' error. ++if test $with_nt_threads = yes ; then ++ dnl skip posix semaphores test if NT-thread model is enabled ++ ac_cv_posix_semaphores_enabled=no ++fi + AC_CACHE_CHECK([whether POSIX semaphores are enabled], [ac_cv_posix_semaphores_enabled], + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ +@@ -6287,6 +6375,14 @@ AS_VAR_IF([ac_cv_posix_semaphores_enabled], [no], [ + ]) + + dnl Multiprocessing check for broken sem_getvalue ++if test $with_nt_threads = yes ; then ++ dnl Skip test if NT-thread model is enabled. ++ dnl NOTE the test case below fail for pthreads-w32 as: ++ dnl - SEM_FAILED is not defined; ++ dnl - sem_open is a stub; ++ dnl - sem_getvalue work(!). ++ ac_cv_broken_sem_getvalue=skip ++fi + AC_CACHE_CHECK([for broken sem_getvalue], [ac_cv_broken_sem_getvalue], + AC_RUN_IFELSE([ + AC_LANG_SOURCE([ +diff --git a/pyconfig.h.in b/pyconfig.h.in +index bb6bc2b..1a6c1a3 100644 +--- a/pyconfig.h.in ++++ b/pyconfig.h.in +@@ -1533,6 +1533,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_TERM_H + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_THREAD_H ++ + /* Define to 1 if you have the 'timegm' function. */ + #undef HAVE_TIMEGM + +@@ -1693,6 +1696,9 @@ + /* Define if mvwdelch in curses.h is an expression. */ + #undef MVWDELCH_IS_EXPRESSION + ++/* Define to 1 if you want to use native NT threads */ ++#undef NT_THREADS ++ + /* Define to the address where bug reports for this package should be sent. */ + #undef PACKAGE_BUGREPORT + diff --git a/patches/3.14/configure_pc_include_msys.patch b/patches/3.14/configure_pc_include_msys.patch index e942341..b85ef52 100644 --- a/patches/3.14/configure_pc_include_msys.patch +++ b/patches/3.14/configure_pc_include_msys.patch @@ -4,9 +4,10 @@ # Source: MSYS2 MINGW-packages mingw-w64-python 0007 # "build: Add PC/ to CPPFLAGS and to SRCDIRS on Mingw" # (configure.ac hunks ported verbatim; the generated-configure -# hunks are the hand-synced equivalents — autoreconf strips the -# dnl comments; this factory ships a configure-ready tarball so -# consumers never need autoconf) +# hunks are REGENERATED with the upstream-pinned autoconf 2.72 — +# byte-identical regen against the pristine 3.14.7 configure +# proven, so no hand-sync drift is possible; this factory ships +# a configure-ready tarball so consumers never need autoconf) # # Wall item (tebako-runtime-python PR #16 windows leg — run 34692047817, # job 103631971290): Objects/exceptions.c:1976:10: fatal error: errmap.h: @@ -26,23 +27,23 @@ # -I is shape-independent, so in-tree and VPATH builds resolve alike). diff --git a/configure b/configure -index c176feb..3b1e3dd 100755 +index 4b76562..605a643 100755 --- a/configure +++ b/configure -@@ -30432,6 +30432,12 @@ do +@@ -30842,6 +30842,12 @@ do THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" done +case $host in + *-*-mingw*) -+ CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS" ++ CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS" + ;; +esac + SRCDIRS="\ Modules \ -@@ -30459,6 +30465,11 @@ SRCDIRS="\ +@@ -30869,6 +30875,11 @@ SRCDIRS="\ Programs \ Python \ Python/frozen_modules" @@ -55,10 +56,10 @@ index c176feb..3b1e3dd 100755 printf %s "checking for build directories... " >&6; } for dir in $SRCDIRS; do diff --git a/configure.ac b/configure.ac -index 9f168ee..400b016 100644 +index 1aea917..ff1df7e 100644 --- a/configure.ac +++ b/configure.ac -@@ -7330,6 +7330,16 @@ do +@@ -7445,6 +7445,16 @@ do THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" done @@ -75,7 +76,7 @@ index 9f168ee..400b016 100644 AC_SUBST([SRCDIRS]) SRCDIRS="\ Modules \ -@@ -7357,6 +7367,11 @@ SRCDIRS="\ +@@ -7472,6 +7482,11 @@ SRCDIRS="\ Programs \ Python \ Python/frozen_modules" diff --git a/patches/3.14/configure_pthread_name_maxlen_msys.patch b/patches/3.14/configure_pthread_name_maxlen_msys.patch new file mode 100644 index 0000000..687a41c --- /dev/null +++ b/patches/3.14/configure_pthread_name_maxlen_msys.patch @@ -0,0 +1,37 @@ +# configure_pthread_name_maxlen_msys.patch +# +# Target: configure.ac + the generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0100 +# "configure: define _PYTHREAD_NAME_MAXLEN for MINGW" (ported +# verbatim; configure regenerated with the pinned autoconf 2.72) +# +# Wall item (anticipated compile wall): Modules/_threadmodule.c's +# Windows branch (compiled once MS_WINDOWS is defined — our +# pyport_ms_windows_msys) uses _PYTHREAD_NAME_MAXLEN UNGUARDED in +# thread_setname; upstream defines it only in PC/pyconfig.h (MSVC), so +# the autotools mingw build dies on the undeclared identifier. The patch +# sets the MSVC value (32766) for MINGW hosts. +diff --git a/configure b/configure +index 6dac703..1b8d088 100755 +--- a/configure ++++ b/configure +@@ -32285,6 +32285,7 @@ case "$ac_sys_system" in + iOS) _PYTHREAD_NAME_MAXLEN=63;; + FreeBSD*) _PYTHREAD_NAME_MAXLEN=19;; # gh-131268 + OpenBSD*) _PYTHREAD_NAME_MAXLEN=23;; # gh-131268 ++ MINGW*) _PYTHREAD_NAME_MAXLEN=32766;; + *) _PYTHREAD_NAME_MAXLEN=;; + esac + if test -n "$_PYTHREAD_NAME_MAXLEN"; then +diff --git a/configure.ac b/configure.ac +index d47bcda..2f834f0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8067,6 +8067,7 @@ case "$ac_sys_system" in + iOS) _PYTHREAD_NAME_MAXLEN=63;; + FreeBSD*) _PYTHREAD_NAME_MAXLEN=19;; # gh-131268 + OpenBSD*) _PYTHREAD_NAME_MAXLEN=23;; # gh-131268 ++ MINGW*) _PYTHREAD_NAME_MAXLEN=32766;; + *) _PYTHREAD_NAME_MAXLEN=;; + esac + if test -n "$_PYTHREAD_NAME_MAXLEN"; then diff --git a/patches/3.14/configure_syslibs_msys.patch b/patches/3.14/configure_syslibs_msys.patch new file mode 100644 index 0000000..63e2604 --- /dev/null +++ b/patches/3.14/configure_syslibs_msys.patch @@ -0,0 +1,101 @@ +# configure_syslibs_msys.patch +# +# Target: configure.ac + the generated configure + Makefile.pre.in +# (windows-msys scenario) +# Source: tebako DEVIATION — the shape has no MSYS2 counterpart (MSYS2 +# builds shared: its libpython3.dll resolves the system libs +# through the DLL's own import list, so tails never have to +# reach module link lines; our --disable-shared static shape +# has no such indirection). The lib SET itself is MSYS2's: the +# original four from 0059's module tails, then the +# -lversion -lshlwapi -lpathcch tail of 0010's mingw LIBS hunk +# (0010 itself is skipped as shared-build machinery; its LIBS +# hunk is folded in here — MSVC gets the same libs via +# `#pragma comment(lib, ...)` in the sources, which GCC +# ignores). (The generated configure equivalent is +# REGENERATED with the upstream-pinned autoconf 2.72 — +# byte-identical regen against pristine proven, no hand-sync; +# pyconfig.h.in is untouched: no AC_DEFINE involved.) +# +# Wall item (run 34725669811 class, then observed at run 34732802820): +# the tebako runtime factory's Mlibs.modlib_rewrites rewrites the +# generated Makefile's MODULE__SSL_LDFLAGS / MODULE__HASHLIB_LDFLAGS +# (and MODULE_ZLIB_LDFLAGS / MODULE_BINASCII_LDFLAGS) to absolute .a +# paths — dropping the "-lws2_32 -lcrypt32" tail that ssl_module_msys +# (MSYS2 0059) appends. Every link that then pulls _ssl.o / _hashlib.o +# (and the static openssl archives behind them) dies on undefined +# WSAStartup / CertOpenSystemStore / BCryptGenRandom references. And +# 34732802820's _freeze_module link died on core-object references: +# GetFileVersionInfoSizeW / GetFileVersionInfoW / VerQueryValueW +# (Python/sysmodule.c:1666-1674 -> -lversion) and __imp_PathCchSkipRoot +# / __imp_PathCchCombineEx (Python/fileutils.c:2160/:2407, +# Modules/posixmodule.c:5269 -> -lpathcch; pathconfig.c's +# arm -> -lshlwapi). Fix source-side: configure defines a +# host-conditional WINDOWS_SYSLIBS (-lws2_32 -lcrypt32 -ladvapi32 +# -lbcrypt -lversion -lshlwapi -lpathcch on *-*-mingw*, empty +# elsewhere — ws2_32 for signalmodule/openssl sockets, crypt32 for the +# _ssl cert-store calls 0059 enables, bcrypt+advapi32 for libcrypto's +# RAND_poll, version+pathcch+shlwapi for the core MS_WINDOWS arms) and +# Makefile.pre.in appends it to SYSLIBS, which sits +# after MODLIBS on every link line (python, _bootstrap_python, +# _freeze_module, _testembed) and is never rewritten downstream. +diff --git a/Makefile.pre.in b/Makefile.pre.in +index f1b346d..f7e7b71 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -294,7 +294,7 @@ STATIC_LIBPYTHON= @STATIC_LIBPYTHON@ + LIBS= @LIBS@ + LIBM= @LIBM@ + LIBC= @LIBC@ +-SYSLIBS= $(LIBM) $(LIBC) ++SYSLIBS= $(LIBM) $(LIBC) @WINDOWS_SYSLIBS@ + SHLIBS= @SHLIBS@ + + DLINCLDIR= @DLINCLDIR@ +diff --git a/configure b/configure +index 1b8d088..e4cbbb6 100755 +--- a/configure ++++ b/configure +@@ -850,6 +850,7 @@ MODULE_DEPS_SHARED + EXT_SUFFIX + ALT_SOABI + SOABI ++WINDOWS_SYSLIBS + LIBC + LIBM + HAVE_GETHOSTBYNAME +@@ -26629,6 +26630,12 @@ esac + fi + + ++ ++case $host in ++ *-*-mingw*) WINDOWS_SYSLIBS="-lws2_32 -lcrypt32 -ladvapi32 -lbcrypt -lversion -lshlwapi -lpathcch";; ++ *) WINDOWS_SYSLIBS="";; ++esac ++ + # ************************************** + # * Check for gcc x64 inline assembler * + # ************************************** +diff --git a/configure.ac b/configure.ac +index 2f834f0..4a169da 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -6280,6 +6280,17 @@ else AC_MSG_ERROR([proper usage is --with-libc=STRING]) + fi], + [AC_MSG_RESULT([default LIBC="$LIBC"])]) + ++dnl tebako windows-msys deviation (no MSYS2 counterpart): extra system ++dnl libraries for static module links. The tebako runtime factory rewrites ++dnl the generated Makefile's MODULE_*_LDFLAGS lines to absolute .a paths, ++dnl dropping the -l tails the mingw port puts there; SYSLIBS sits after ++dnl MODLIBS on every link line and is never rewritten downstream. ++AC_SUBST([WINDOWS_SYSLIBS]) ++case $host in ++ *-*-mingw*) WINDOWS_SYSLIBS="-lws2_32 -lcrypt32 -ladvapi32 -lbcrypt -lversion -lshlwapi -lpathcch";; ++ *) WINDOWS_SYSLIBS="";; ++esac ++ + # ************************************** + # * Check for gcc x64 inline assembler * + # ************************************** diff --git a/patches/3.14/configure_winsock_netdb_msys.patch b/patches/3.14/configure_winsock_netdb_msys.patch new file mode 100644 index 0000000..f127f53 --- /dev/null +++ b/patches/3.14/configure_winsock_netdb_msys.patch @@ -0,0 +1,318 @@ +# configure_winsock_netdb_msys.patch +# +# Target: configure.ac + the generated configure + pyconfig.h.in +# (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0060 +# "configure: Include winsock.h when checking for netdb +# function" (ported verbatim; the generated configure and +# pyconfig.h.in equivalents are REGENERATED with the +# upstream-pinned autoconf 2.72 — byte-identical regen against +# the pristine 3.14.7 configure proven. The pyconfig.h.in +# delta is comment-only: the HAVE_GETHOSTNAME/HAVE_SHUTDOWN +# templates switch from AC_CHECK_FUNCS' wording to +# PY_CHECK_FUNC's; value semantics unchanged.) +# +# Wall item (runtime-functional wall, observed in this PR's cross probe +# — x86_64-w64-mingw32-gcc, --disable-shared): without the patch EVERY +# netdb probe fails on mingw (PY_CHECK_FUNC compiles `void *x=` +# against , which on mingw-w64 declares none of them — they +# live in ), leaving HAVE_GETHOSTNAME and HAVE_SHUTDOWN +# undefined. MSVC's PC/pyconfig.h DEFINES both (lines 595, 737), so the +# mingw _socket that socketmodule_msys (0017) enables would diverge +# from the Windows reference: socket.gethostname() (gated +# #ifdef HAVE_GETHOSTNAME, socketmodule.c:5863) and the shutdown entry +# point vanish — stdlib breakage (platform.node, logging, smtplib), no +# compile error. The patch switches PY_CHECK_NETDB_FUNC to +# under _WIN32 and moves gethostname/shutdown into that check group, +# restoring MSVC parity. (HAVE_GETADDRINFO/HAVE_GETNAMEINFO stay +# undefined exactly as upstream's PC build has them — the MS_WINDOWS +# fallback paths in socketmodule.c cover them.) +diff --git a/configure b/configure +index 3dca209..a621d6a 100755 +--- a/configure ++++ b/configure +@@ -20063,12 +20063,6 @@ if test "x$ac_cv_func_getgrouplist" = xyes + then : + printf "%s\n" "#define HAVE_GETGROUPLIST 1" >>confdefs.h + +-fi +-ac_fn_c_check_func "$LINENO" "gethostname" "ac_cv_func_gethostname" +-if test "x$ac_cv_func_gethostname" = xyes +-then : +- printf "%s\n" "#define HAVE_GETHOSTNAME 1" >>confdefs.h +- + fi + ac_fn_c_check_func "$LINENO" "getitimer" "ac_cv_func_getitimer" + if test "x$ac_cv_func_getitimer" = xyes +@@ -20717,12 +20711,6 @@ if test "x$ac_cv_func_setvbuf" = xyes + then : + printf "%s\n" "#define HAVE_SETVBUF 1" >>confdefs.h + +-fi +-ac_fn_c_check_func "$LINENO" "shutdown" "ac_cv_func_shutdown" +-if test "x$ac_cv_func_shutdown" = xyes +-then : +- printf "%s\n" "#define HAVE_SHUTDOWN 1" >>confdefs.h +- + fi + ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction" + if test "x$ac_cv_func_sigaction" = xyes +@@ -23610,7 +23598,13 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ + int + main (void) + { +@@ -23651,7 +23645,13 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ + int + main (void) + { +@@ -23692,7 +23692,13 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ + int + main (void) + { +@@ -23733,7 +23739,13 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ + int + main (void) + { +@@ -23774,7 +23786,13 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ + int + main (void) + { +@@ -23815,7 +23833,13 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ + int + main (void) + { +@@ -23848,6 +23872,100 @@ fi + + + ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostname" >&5 ++printf %s "checking for gethostname... " >&6; } ++if test ${ac_cv_func_gethostname+y} ++then : ++ printf %s "(cached) " >&6 ++else case e in #( ++ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ ++int ++main (void) ++{ ++void *x=gethostname ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO" ++then : ++ ac_cv_func_gethostname=yes ++else case e in #( ++ e) ac_cv_func_gethostname=no ;; ++esac ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ++ ;; ++esac ++fi ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_gethostname" >&5 ++printf "%s\n" "$ac_cv_func_gethostname" >&6; } ++ if test "x$ac_cv_func_gethostname" = xyes ++then : ++ ++printf "%s\n" "#define HAVE_GETHOSTNAME 1" >>confdefs.h ++ ++fi ++ ++ ++ ++ ++ ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shutdown" >&5 ++printf %s "checking for shutdown... " >&6; } ++if test ${ac_cv_func_shutdown+y} ++then : ++ printf %s "(cached) " >&6 ++else case e in #( ++ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++ ++int ++main (void) ++{ ++void *x=shutdown ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO" ++then : ++ ac_cv_func_shutdown=yes ++else case e in #( ++ e) ac_cv_func_shutdown=no ;; ++esac ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ++ ;; ++esac ++fi ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_shutdown" >&5 ++printf "%s\n" "$ac_cv_func_shutdown" >&6; } ++ if test "x$ac_cv_func_shutdown" = xyes ++then : ++ ++printf "%s\n" "#define HAVE_SHUTDOWN 1" >>confdefs.h ++ ++fi ++ ++ ++ ++ ++ + + + +diff --git a/configure.ac b/configure.ac +index 4a19c1a..19907c4 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -5454,7 +5454,7 @@ AC_CHECK_FUNCS([ \ + faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \ + fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \ + gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \ +- getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin getlogin_r \ ++ getgrnam_r getgrouplist getitimer getloadavg getlogin getlogin_r \ + getpeername getpgid getpid getppid getpriority _getpty \ + getpwent getpwnam_r getpwuid getpwuid_r getresgid getresuid getrusage getsid getspent \ + getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \ +@@ -5471,7 +5471,7 @@ AC_CHECK_FUNCS([ \ + sched_setparam sched_setscheduler sem_clockwait sem_getvalue sem_open \ + sem_timedwait sem_unlink sendfile setegid seteuid setgid sethostname \ + setitimer setlocale setpgid setpgrp setpriority setregid setresgid \ +- setresuid setreuid setsid setuid setvbuf shutdown sigaction sigaltstack \ ++ setresuid setreuid setsid setuid setvbuf sigaction sigaltstack \ + sigfillset siginterrupt sigpending sigrelse sigtimedwait sigwait \ + sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \ + sysconf sysctlbyname tcgetpgrp tcsetpgrp tempnam timegm times tmpfile \ +@@ -5738,7 +5738,13 @@ PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], [ + ]) + + dnl PY_CHECK_NETDB_FUNC(FUNCTION) +-AC_DEFUN([PY_CHECK_NETDB_FUNC], [PY_CHECK_FUNC([$1], [@%:@include ])]) ++AC_DEFUN([PY_CHECK_NETDB_FUNC], [PY_CHECK_FUNC([$1], [ ++#ifdef _WIN32 ++ #include ++#else ++ #include ++#endif ++])]) + + PY_CHECK_NETDB_FUNC([hstrerror]) + dnl not available in WASI yet +@@ -5747,6 +5753,8 @@ PY_CHECK_NETDB_FUNC([getservbyport]) + PY_CHECK_NETDB_FUNC([gethostbyname]) + PY_CHECK_NETDB_FUNC([gethostbyaddr]) + PY_CHECK_NETDB_FUNC([getprotobyname]) ++PY_CHECK_NETDB_FUNC([gethostname]) ++PY_CHECK_NETDB_FUNC([shutdown]) + + dnl PY_CHECK_SOCKET_FUNC(FUNCTION) + AC_DEFUN([PY_CHECK_SOCKET_FUNC], [PY_CHECK_FUNC([$1], [ +diff --git a/pyconfig.h.in b/pyconfig.h.in +index 33b4308..0d4f226 100644 +--- a/pyconfig.h.in ++++ b/pyconfig.h.in +@@ -543,7 +543,7 @@ + /* Define this if you have the 6-arg version of gethostbyname_r(). */ + #undef HAVE_GETHOSTBYNAME_R_6_ARG + +-/* Define to 1 if you have the 'gethostname' function. */ ++/* Define if you have the 'gethostname' function. */ + #undef HAVE_GETHOSTNAME + + /* Define to 1 if you have the 'getitimer' function. */ +@@ -1228,7 +1228,7 @@ + /* Define to 1 if you have the 'shm_unlink' function. */ + #undef HAVE_SHM_UNLINK + +-/* Define to 1 if you have the 'shutdown' function. */ ++/* Define if you have the 'shutdown' function. */ + #undef HAVE_SHUTDOWN + + /* Define to 1 if you have the 'sigaction' function. */ diff --git a/patches/3.14/frozenmain_drop_msys.patch b/patches/3.14/frozenmain_drop_msys.patch new file mode 100644 index 0000000..97e9085 --- /dev/null +++ b/patches/3.14/frozenmain_drop_msys.patch @@ -0,0 +1,80 @@ +# frozenmain_drop_msys.patch +# +# Target: Makefile.pre.in, configure.ac + the generated configure +# (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0016 +# "build: Ignore main program for frozen scripts on MINGW" +# (ported verbatim; configure regenerated with the pinned +# autoconf 2.72) +# +# Wall item (anticipated link wall, same leg class as run 34725669811): +# Python/frozenmain.c is in PYTHON_OBJS — linked into the exe +# unconditionally — and under MS_WINDOWS it references +# PyWinFreeze_ExeInit/PyInitFrozenExtensions, which live only in +# PC/frozen_dllmain.c (PCbuild-only; the autotools build never compiles +# it). On mingw those are undefined references at the exe link. The patch +# removes frozenmain.o from PYTHON_OBJS on mingw via +# @PYTHON_OBJS_FROZENMAIN@ (frozen-script hosting is a v1-era feature the +# runtime never uses — payloads ride mounted images, not frozen +# bytecode). +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 526d500..b3f3eee 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -444,7 +444,7 @@ PYTHON_OBJS= \ + Python/errors.o \ + Python/flowgraph.o \ + Python/frame.o \ +- Python/frozenmain.o \ ++ @PYTHON_OBJS_FROZENMAIN@ \ + Python/future.o \ + Python/gc.o \ + Python/gc_free_threading.o \ +diff --git a/configure b/configure +index 25c93bd..423b21b 100755 +--- a/configure ++++ b/configure +@@ -828,6 +828,7 @@ OPENSSL_INCLUDES + ENSUREPIP + CFLAGS_CEVAL + SRCDIRS ++PYTHON_OBJS_FROZENMAIN + THREADHEADERS + PANEL_LIBS + PANEL_CFLAGS +@@ -30860,6 +30861,14 @@ case $host in + esac + + ++PYTHON_OBJS_FROZENMAIN="Python/frozenmain.o" ++case $host in ++ *-*-mingw*) ++ PYTHON_OBJS_FROZENMAIN= ++ ;; ++esac ++ ++ + SRCDIRS="\ + Modules \ + Modules/_ctypes \ +diff --git a/configure.ac b/configure.ac +index 9255f4d..2def216 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -7463,6 +7463,16 @@ case $host in + ;; + esac + ++dnl Python interpreter main program for frozen scripts ++AC_SUBST(PYTHON_OBJS_FROZENMAIN) ++PYTHON_OBJS_FROZENMAIN="Python/frozenmain.o" ++case $host in ++ *-*-mingw*) ++ dnl 'PC/frozen_dllmain.c' - not yet ++ PYTHON_OBJS_FROZENMAIN= ++ ;; ++esac ++ + AC_SUBST([SRCDIRS]) + SRCDIRS="\ + Modules \ diff --git a/patches/3.14/io_winconsoleio_msys.patch b/patches/3.14/io_winconsoleio_msys.patch new file mode 100644 index 0000000..7b56d20 --- /dev/null +++ b/patches/3.14/io_winconsoleio_msys.patch @@ -0,0 +1,129 @@ +# io_winconsoleio_msys.patch +# +# Target: Modules/Setup.bootstrap.in + Modules/Setup.stdlib.in + +# configure.ac + the generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0037 +# "build: build winconsoleio and _testconsole" (ported verbatim) +# +# Wall item (observed link wall, run 34732802820): upstream's autotools +# build never compiles Modules/_io/winconsoleio.c (the MSVC vcxproj +# carries it instead), so once pyport_ms_windows_msys (MSYS2 0002) +# defines HAVE_WINDOWS_CONSOLE_IO on mingw, the _freeze_module / exe +# links die on the console symbols the MS_WINDOWS code paths reference: +# _get_console_type (Parser/myreadline.c:273/:276), _PyIO_get_console_type +# and winconsoleio_spec (Modules/_io/_iomodule.c:324/:584). The patch +# appends _io/winconsoleio.c to the _io bootstrap line — the file's whole +# body is #ifdef HAVE_WINDOWS_CONSOLE_IO, so POSIX builds gain an empty +# object — and registers the _testconsole stdlib module on win32 +# (test-only; rides along verbatim). The generated configure is +# REGENERATED with the upstream-pinned autoconf 2.72 (byte-identical +# regen against pristine proven, no hand-sync; pyconfig.h.in is +# untouched: no AC_DEFINE involved). +diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in +index b835d80..7ded797 100644 +--- a/Modules/Setup.bootstrap.in ++++ b/Modules/Setup.bootstrap.in +@@ -19,7 +19,7 @@ _datetime _datetimemodule.c + _codecs _codecsmodule.c + _collections _collectionsmodule.c + errno errnomodule.c +-_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c ++_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c _io/winconsoleio.c + itertools itertoolsmodule.c + _sre _sre/sre.c + _sysconfig _sysconfig.c +diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in +index 0f92ef4..d686a83 100644 +--- a/Modules/Setup.stdlib.in ++++ b/Modules/Setup.stdlib.in +@@ -186,6 +186,7 @@ + @MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c + @MODULE__TESTSINGLEPHASE_TRUE@_testsinglephase _testsinglephase.c + @MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c ++@MODULE__TESTCONSOLE_TRUE@_testconsole ../PC/_testconsole.c + + # Limited API template modules; must be built as shared modules. + @MODULE_XXLIMITED_TRUE@xxlimited xxlimited.c +diff --git a/configure b/configure +index 0c49e64..3675f6c 100755 +--- a/configure ++++ b/configure +@@ -650,6 +650,8 @@ MODULE_XXLIMITED_FALSE + MODULE_XXLIMITED_TRUE + MODULE__CTYPES_TEST_FALSE + MODULE__CTYPES_TEST_TRUE ++MODULE__TESTCONSOLE_FALSE ++MODULE__TESTCONSOLE_TRUE + MODULE__XXTESTFUZZ_FALSE + MODULE__XXTESTFUZZ_TRUE + MODULE_XXSUBTYPE_FALSE +@@ -35133,6 +35135,46 @@ fi + printf "%s\n" "$py_cv_module__xxtestfuzz" >&6; } + + ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testconsole" >&5 ++printf %s "checking for stdlib extension module _testconsole... " >&6; } ++ if test "$py_cv_module__testconsole" != "n/a" ++then : ++ ++ if test "$TEST_MODULES" = yes -a "$MACHDEP" = "win32" ++then : ++ if true ++then : ++ py_cv_module__testconsole=yes ++else case e in #( ++ e) py_cv_module__testconsole=missing ;; ++esac ++fi ++else case e in #( ++ e) py_cv_module__testconsole=disabled ;; ++esac ++fi ++ ++fi ++ as_fn_append MODULE_BLOCK "MODULE__TESTCONSOLE_STATE=$py_cv_module__testconsole$as_nl" ++ if test "x$py_cv_module__testconsole" = xyes ++then : ++ ++ ++ ++ ++fi ++ if test "$py_cv_module__testconsole" = yes; then ++ MODULE__TESTCONSOLE_TRUE= ++ MODULE__TESTCONSOLE_FALSE='#' ++else ++ MODULE__TESTCONSOLE_TRUE='#' ++ MODULE__TESTCONSOLE_FALSE= ++fi ++ ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testconsole" >&5 ++printf "%s\n" "$py_cv_module__testconsole" >&6; } ++ ++ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _ctypes_test" >&5 + printf %s "checking for stdlib extension module _ctypes_test... " >&6; } + if test "$py_cv_module__ctypes_test" != "n/a" +@@ -35699,6 +35741,10 @@ if test -z "${MODULE__XXTESTFUZZ_TRUE}" && test -z "${MODULE__XXTESTFUZZ_FALSE}" + as_fn_error $? "conditional \"MODULE__XXTESTFUZZ\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${MODULE__TESTCONSOLE_TRUE}" && test -z "${MODULE__TESTCONSOLE_FALSE}"; then ++ as_fn_error $? "conditional \"MODULE__TESTCONSOLE\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${MODULE__CTYPES_TEST_TRUE}" && test -z "${MODULE__CTYPES_TEST_FALSE}"; then + as_fn_error $? "conditional \"MODULE__CTYPES_TEST\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 +diff --git a/configure.ac b/configure.ac +index 3f367cc..0d73a2e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8532,6 +8532,7 @@ PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_fun + PY_STDLIB_MOD([_testsinglephase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes]) + PY_STDLIB_MOD([xxsubtype], [test "$TEST_MODULES" = yes]) + PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes]) ++PY_STDLIB_MOD([_testconsole], [test "$TEST_MODULES" = yes -a "$MACHDEP" = "win32"]) + dnl Check have_libffi so _ctypes_test is only built if _ctypes is built. + dnl _ctypes_test doesn't use libffi directly. + PY_STDLIB_MOD([_ctypes_test], diff --git a/patches/3.14/mmapmodule_no_seh_msys.patch b/patches/3.14/mmapmodule_no_seh_msys.patch new file mode 100644 index 0000000..3c1490a --- /dev/null +++ b/patches/3.14/mmapmodule_no_seh_msys.patch @@ -0,0 +1,30 @@ +# mmapmodule_no_seh_msys.patch +# +# Target: Modules/mmapmodule.c (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0097 +# "mmapmodule: define DONT_USE_SEH" (ported verbatim) +# +# Wall item (anticipated compile wall): upstream's mmap gate +# (sys/mman.h + sys/stat.h) passes on ucrt64 — mingw-w64 ships an mmap +# emulation — so mmapmodule.c builds, and its MS_WINDOWS branch uses +# SEH __try/__except, which GCC does not implement: a hard compile +# error. DONT_USE_SEH (the logic copied from callproc.c, per the +# upstream comment MSYS2 cites) selects the guard-free paths on mingw. +diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c +index f7b8ab3..6cea430 100644 +--- a/Modules/mmapmodule.c ++++ b/Modules/mmapmodule.c +@@ -62,6 +62,13 @@ my_getallocationgranularity (void) + + #endif + ++#if defined(_DEBUG) || defined(__MINGW32__) ++/* Don't use structured exception handling on Windows if this is defined. ++ MingW, AFAIK, doesn't support it. ++*/ ++#define DONT_USE_SEH ++#endif ++ + #ifdef UNIX + #include + #include diff --git a/patches/3.14/patch-3.14.yaml b/patches/3.14/patch-3.14.yaml index d361ebf..e9f339f 100644 --- a/patches/3.14/patch-3.14.yaml +++ b/patches/3.14/patch-3.14.yaml @@ -7,6 +7,15 @@ # pristine upstream tarball. The wall evidence and per-patch rationale are # in each patch file's header comment. # +# Apply order follows the MSYS2 MINGW-packages numbering (the proven +# out-of-tree port this series tracks): each patch's context assumes the +# preceding ones. The one exception is the closing entry: +# configure_syslibs_msys is a tebako deviation with no MSYS2 number +# (rationale in its header), appended last. v0.3.2 extends the set past +# the PR #16 walls (sysmodule VPATH, thread_pthread) with the sweep of +# the full MSYS2 series for our build shape — the ported set and the +# deliberate skips are recorded in the PR body. +# # NEVER a jit variant on this platform: CPython's experimental JIT target # whitelist (PEP 774's tiering, Tools/jit/_targets.py per PEP 836's # build-story wording) admits only Tier-1 MSVC windows — a mingw/ucrt64 @@ -15,13 +24,51 @@ --- version: "3.14" patches: + - feature: configure_nt_threads_msys + file: configure_nt_threads_msys.patch - feature: pyport_ms_windows_msys file: pyport_ms_windows_msys.patch - feature: configure_machdep_msys file: configure_machdep_msys.patch + - feature: configure_mingw_defaults_msys + file: configure_mingw_defaults_msys.patch - feature: configure_pc_include_msys file: configure_pc_include_msys.patch + - feature: posixmodule_nt_msys + file: posixmodule_nt_msys.patch + - feature: frozenmain_drop_msys + file: frozenmain_drop_msys.patch + - feature: socketmodule_msys + file: socketmodule_msys.patch + - feature: signal_ws2_32_msys + file: signal_ws2_32_msys.patch + - feature: io_winconsoleio_msys + file: io_winconsoleio_msys.patch + - feature: configure_inet_pton_msys + file: configure_inet_pton_msys.patch + - feature: timemodule_msys + file: timemodule_msys.patch - feature: configure_c_locale_coercion_msys file: configure_c_locale_coercion_msys.patch + - feature: sysmodule_vpath_msys + file: sysmodule_vpath_msys.patch + - feature: bootstrap_python_link_flags_msys + file: bootstrap_python_link_flags_msys.patch + - feature: ssl_module_msys + file: ssl_module_msys.patch + - feature: configure_winsock_netdb_msys + file: configure_winsock_netdb_msys.patch + - feature: configure_exeext_msys + file: configure_exeext_msys.patch + - feature: configure_disable_posix_modules_msys + file: configure_disable_posix_modules_msys.patch + - feature: configure_noerror_incompat_ptr_msys + file: configure_noerror_incompat_ptr_msys.patch - feature: pycore_time_timeval_msys file: pycore_time_timeval_msys.patch + - feature: mmapmodule_no_seh_msys + file: mmapmodule_no_seh_msys.patch + - feature: configure_pthread_name_maxlen_msys + file: configure_pthread_name_maxlen_msys.patch + - feature: configure_syslibs_msys + file: configure_syslibs_msys.patch diff --git a/patches/3.14/posixmodule_nt_msys.patch b/patches/3.14/posixmodule_nt_msys.patch new file mode 100644 index 0000000..79765a8 --- /dev/null +++ b/patches/3.14/posixmodule_nt_msys.patch @@ -0,0 +1,131 @@ +# posixmodule_nt_msys.patch +# +# Target: Modules/posixmodule.c, Modules/Setup.bootstrap.in, +# configure.ac + the generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0008 +# "build: add MINGW support for posixmodule" (ported verbatim; +# configure regenerated with the pinned autoconf 2.72) +# +# Wall item (anticipated link/boot wall, same CI leg class as run +# 34725669811): with MS_WINDOWS defined (pyport_ms_windows_msys), +# posixmodule.c exports PyInit_nt — but Setup.bootstrap.in statically +# registers the module as "posix", so the bootstrap module table expects +# PyInit_posix: an undefined-symbol link wall once the exe links. It is +# also a boot wall: os.py keys on the "nt" module name when the platform +# is win32 (configure_machdep_msys sets MACHDEP=win32), so a "posix"-named +# registration leaves os unimportable. The patch substitutes +# @MODULE_POSIXMODULE_NAME@ (= nt on mingw) in Setup.bootstrap.in and +# carries the mingw feature-macro block (undef HAVE_GETLOGIN/HAVE_OPENDIR +# — configure detects them but the mingw implementations misbehave — plus +# the spawnv/popen/cwait set) and the environ declaration fix +# (!_MSC_VER -> !MS_WINDOWS: ucrt has no direct environ symbol). +diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in +index 65a1fef..0a932d4 100644 +--- a/Modules/Setup.bootstrap.in ++++ b/Modules/Setup.bootstrap.in +@@ -8,7 +8,7 @@ + # module C APIs are used in core + atexit atexitmodule.c + faulthandler faulthandler.c +-posix posixmodule.c ++@MODULE_POSIXMODULE_NAME@ posixmodule.c + _signal signalmodule.c + _tracemalloc _tracemalloc.c + _suggestions _suggestions.c +diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c +index 7bf8bc9..05f9bf8 100644 +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -296,6 +296,32 @@ + # define HAVE_PIPE 1 + # define HAVE_FSYNC 1 + # define fsync _commit ++#elif defined(__MINGW32__) /* GCC for windows hosts */ ++/* getlogin is detected by configure on mingw-w64 */ ++# undef HAVE_GETLOGIN ++/* opendir is detected by configure on mingw-w64, and for some reason ++things don't work as expected. For example, os.listdir always returns ++the cwd's directory listing instead of the one specified. By ++un-defining, this, os.listdir will use the one which uses native ++windows API. */ ++# undef HAVE_OPENDIR ++/*# define HAVE_GETCWD 1 - detected by configure*/ ++# define HAVE_GETPPID 1 ++# define HAVE_GETLOGIN 1 ++# define HAVE_SPAWNV 1 ++# define HAVE_WSPAWNV 1 ++# define HAVE_WEXECV 1 ++/*# define HAVE_EXECV 1 - detected by configure*/ ++# define HAVE_PIPE 1 ++# define HAVE_POPEN 1 ++# define HAVE_SYSTEM 1 ++# define HAVE_CWAIT 1 ++# define HAVE_FSYNC 1 ++# define fsync _commit ++# include ++# ifndef _MAX_ENV ++# define _MAX_ENV 32767 ++# endif + #endif + + +@@ -1745,9 +1771,9 @@ error: + */ + #include + #define USE_DARWIN_NS_GET_ENVIRON 1 +-#elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) ++#elif !defined(MS_WINDOWS) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) + extern char **environ; +-#endif /* !_MSC_VER */ ++#endif /* !MS_WINDOWS */ + + static PyObject * + convertenviron(void) +diff --git a/configure b/configure +index 605a643..25c93bd 100755 +--- a/configure ++++ b/configure +@@ -987,6 +987,7 @@ HAS_XCRUN + IPHONEOS_DEPLOYMENT_TARGET + EXPORT_MACOSX_DEPLOYMENT_TARGET + CONFIGURE_MACOSX_DEPLOYMENT_TARGET ++MODULE_POSIXMODULE_NAME + _PYTHON_HOST_PLATFORM + APP_STORE_COMPLIANCE_PATCH + INSTALLTARGETS +@@ -4773,6 +4774,16 @@ printf "%s\n" "#define _INCLUDE__STDC_A1_SOURCE 1" >>confdefs.h + + fi + ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for posixmodule name" >&5 ++printf %s "checking for posixmodule name... " >&6; } ++ ++case $host in ++ *-*-mingw*) MODULE_POSIXMODULE_NAME=nt;; ++ *) MODULE_POSIXMODULE_NAME=posix;; ++esac ++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MODULE_POSIXMODULE_NAME" >&5 ++printf "%s\n" "$MODULE_POSIXMODULE_NAME" >&6; } ++ + # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, + # it may influence the way we can build extensions, so distutils + # needs to check it +diff --git a/configure.ac b/configure.ac +index ff1df7e..9255f4d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -943,6 +943,14 @@ then + [Define to include mbstate_t for mbrtowc]) + fi + ++AC_MSG_CHECKING([for posixmodule name]) ++AC_SUBST(MODULE_POSIXMODULE_NAME) ++case $host in ++ *-*-mingw*) MODULE_POSIXMODULE_NAME=nt;; ++ *) MODULE_POSIXMODULE_NAME=posix;; ++esac ++AC_MSG_RESULT([$MODULE_POSIXMODULE_NAME]) ++ + # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, + # it may influence the way we can build extensions, so distutils + # needs to check it diff --git a/patches/3.14/signal_ws2_32_msys.patch b/patches/3.14/signal_ws2_32_msys.patch new file mode 100644 index 0000000..8e42525 --- /dev/null +++ b/patches/3.14/signal_ws2_32_msys.patch @@ -0,0 +1,31 @@ +# signal_ws2_32_msys.patch +# +# Target: Modules/Setup.bootstrap.in (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0036 +# "build: fix signal module build" (ported verbatim) +# +# Wall item (anticipated link wall, same leg class as run 34725669811): +# Modules/signalmodule.c:773 calls WSAGetLastError() under MS_WINDOWS +# (the socket-probe path in signal_sigwaitinfo); _signal is a bootstrap +# module, so signalmodule.o rides MODULE_OBJS into the +# _bootstrap_python / _freeze_module / exe links. Those link lines carry +# $(LIBS) $(MODLIBS) $(SYSLIBS) but NOT the factory's TEBAKO_LIBS, so +# the ws2_32 reference must come from the module line itself: makesetup +# folds the trailing -lws2_32 into BASEMODLIBS -> MODLIBS on every link +# line, and the factory's modlib_rewrites (which only touches +# MODULE_*_LDFLAGS) never sees it. Ordering: the context line +# "@MODULE_POSIXMODULE_NAME@ posixmodule.c" is produced by +# posixmodule_nt_msys (MSYS2 0008), so this patch applies after it. +diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in +index 0a932d4..b835d80 100644 +--- a/Modules/Setup.bootstrap.in ++++ b/Modules/Setup.bootstrap.in +@@ -9,7 +9,7 @@ + atexit atexitmodule.c + faulthandler faulthandler.c + @MODULE_POSIXMODULE_NAME@ posixmodule.c +-_signal signalmodule.c ++_signal signalmodule.c -lws2_32 + _tracemalloc _tracemalloc.c + _suggestions _suggestions.c + # needs libm and on some platforms librt diff --git a/patches/3.14/socketmodule_msys.patch b/patches/3.14/socketmodule_msys.patch new file mode 100644 index 0000000..e9a677a --- /dev/null +++ b/patches/3.14/socketmodule_msys.patch @@ -0,0 +1,258 @@ +# socketmodule_msys.patch +# +# Target: Modules/socketmodule.c, Modules/socketmodule.h, +# configure.ac + the generated configure, pyconfig.h.in +# (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0017 +# "socketmodule: add MINGW support" (ported verbatim; configure +# regenerated with the pinned autoconf 2.72) +# +# Wall item (enablement wall, same leg class as run 34725669811): +# upstream's autoconf _socket gate requires sys/socket.h + netinet/in.h, +# which mingw-w64 does not ship — the module is simply never built, and a +# runtime without _socket has no socket/ssl (the pinned static _ssl is +# dead weight). The patch widens the gate with -o MACHDEP=win32, probes +# addrinfo/sockaddr_storage/socklen_t through ws2tcpip.h, sets +# SOCKET_LIBS=-lws2_32 -liphlpapi -lrpcrt4 (the static exe's link needs +# them), guards the IPPROTO_* re-#defines to _MSC_VER (mingw's ws2tcpip.h +# already provides the enum), and lets configure — not socketmodule.h — +# decide HAVE_ADDRINFO/HAVE_SOCKADDR_STORAGE on mingw. socketmodule.c's +# own MS_WINDOWS branches then compile the MSVC-proven winsock2 code +# paths. +diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c +index f297a5f..ac2a876 100644 +--- a/Modules/socketmodule.c ++++ b/Modules/socketmodule.c +@@ -289,6 +289,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\ + # include + + /* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */ ++#ifdef _MSC_VER + #define IPPROTO_ICMP IPPROTO_ICMP + #define IPPROTO_IGMP IPPROTO_IGMP + #define IPPROTO_GGP IPPROTO_GGP +@@ -319,6 +320,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\ + #define IPPROTO_PGM IPPROTO_PGM // WinSock2 only + #define IPPROTO_L2TP IPPROTO_L2TP // WinSock2 only + #define IPPROTO_SCTP IPPROTO_SCTP // WinSock2 only ++#endif /* _MSC_VER */ + + /* Provides the IsWindows7SP1OrGreater() function */ + #include +@@ -417,7 +419,7 @@ remove_unusable_flags(PyObject *m) + * _SS_ALIGNSIZE is defined in sys/socket.h by 6.5.21, + * for example, but not by 6.5.10. + */ +-#elif defined(_MSC_VER) && _MSC_VER>1201 ++#elif (defined(_MSC_VER) && _MSC_VER>1201) || defined(__MINGW32__) + /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and + * EAI_* constants are defined in (the already included) ws2tcpip.h. + */ +diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h +index 6f8f4b2..3234843 100644 +--- a/Modules/socketmodule.h ++++ b/Modules/socketmodule.h +@@ -75,8 +75,10 @@ struct SOCKADDR_BTH_REDEF { + */ + # ifdef SIO_GET_MULTICAST_FILTER + # include /* for SIO_RCVALL */ ++#ifndef __MINGW32__ /* resolve by configure */ + # define HAVE_ADDRINFO + # define HAVE_SOCKADDR_STORAGE ++#endif + # define HAVE_GETADDRINFO + # define HAVE_GETNAMEINFO + # define ENABLE_IPV6 +diff --git a/configure b/configure +index 423b21b..0c49e64 100755 +--- a/configure ++++ b/configure +@@ -16616,6 +16616,14 @@ fi + + + ++case $MACHDEP in #( ++ win32) : ++ SOCKET_LIBS="-lws2_32 -liphlpapi -lrpcrt4" ;; #( ++ *) : ++ SOCKET_LIBS="" ++ ;; ++esac ++ + + + +@@ -25773,6 +25781,13 @@ printf "%s\n" "#define HAVE_ALTZONE 1" >>confdefs.h + + fi + ++ac_fn_c_check_header_compile "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default" ++if test "x$ac_cv_header_ws2tcpip_h" = xyes ++then : ++ printf "%s\n" "#define HAVE_WS2TCPIP_H 1" >>confdefs.h ++ ++fi ++ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 + printf %s "checking for addrinfo... " >&6; } + if test ${ac_cv_struct_addrinfo+y} +@@ -25781,7 +25796,12 @@ then : + else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include ++ ++#ifdef HAVE_WS2TCPIP_H ++# include ++#else ++# include ++#endif + int + main (void) + { +@@ -25817,8 +25837,15 @@ else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + +-# include +-# include ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif + int + main (void) + { +@@ -30629,6 +30656,9 @@ then + fi + + ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif + #ifdef HAVE_SYS_TYPES_H + #include + #endif +@@ -32970,7 +33000,7 @@ then : + + if true + then : +- if test "$ac_cv_header_sys_socket_h" = "yes" -a "$ac_cv_header_sys_types_h" = "yes" -a "$ac_cv_header_netinet_in_h" = "yes" ++ if test "$ac_cv_header_sys_socket_h" = "yes" -a "$ac_cv_header_sys_types_h" = "yes" -a "$ac_cv_header_netinet_in_h" = "yes" -o "$MACHDEP" = "win32" + then : + py_cv_module__socket=yes + else case e in #( +diff --git a/configure.ac b/configure.ac +index 2def216..3f367cc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4504,6 +4504,12 @@ AC_SUBST([LIBMPDEC_CFLAGS]) + AC_SUBST([LIBMPDEC_INTERNAL]) + + ++dnl On MINGW, you need to link against ws2_32 and iphlpapi for sockets to work ++AS_CASE([$MACHDEP], ++ [win32], [SOCKET_LIBS="-lws2_32 -liphlpapi -lrpcrt4"], ++ [SOCKET_LIBS=""] ++) ++ + dnl detect sqlite3 from Emscripten emport + PY_CHECK_EMSCRIPTEN_PORT([LIBSQLITE3], [-sUSE_SQLITE3]) + +@@ -6048,18 +6054,33 @@ if test $ac_cv_header_time_altzone = yes; then + [Define this if your time.h defines altzone.]) + fi + ++AC_CHECK_HEADERS([ws2tcpip.h]) + AC_CACHE_CHECK([for addrinfo], [ac_cv_struct_addrinfo], +-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[struct addrinfo a]])], ++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++#ifdef HAVE_WS2TCPIP_H ++# include ++#else ++# include ++#endif]], ++ [[struct addrinfo a]])], + [ac_cv_struct_addrinfo=yes], + [ac_cv_struct_addrinfo=no])) + if test $ac_cv_struct_addrinfo = yes; then +- AC_DEFINE([HAVE_ADDRINFO], [1], [struct addrinfo (netdb.h)]) ++ AC_DEFINE([HAVE_ADDRINFO], [1], [struct addrinfo]) + fi + + AC_CACHE_CHECK([for sockaddr_storage], [ac_cv_struct_sockaddr_storage], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +-# include +-@%:@ include ]], [[struct sockaddr_storage s]])], ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif]], ++ [[struct sockaddr_storage s]])], + [ac_cv_struct_sockaddr_storage=yes], + [ac_cv_struct_sockaddr_storage=no])) + if test $ac_cv_struct_sockaddr_storage = yes; then +@@ -7316,7 +7337,10 @@ fi + + AC_CHECK_TYPES([socklen_t], [], + [AC_DEFINE([socklen_t], [int], +- [Define to 'int' if does not define.])], [ ++ [Define to `int' if or does not define.])], [ ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif + #ifdef HAVE_SYS_TYPES_H + #include + #endif +@@ -8255,7 +8279,8 @@ PY_STDLIB_MOD([mmap], + PY_STDLIB_MOD([_socket], + [], m4_flatten([test "$ac_cv_header_sys_socket_h" = "yes" + -a "$ac_cv_header_sys_types_h" = "yes" +- -a "$ac_cv_header_netinet_in_h" = "yes"]), [], [$SOCKET_LIBS]) ++ -a "$ac_cv_header_netinet_in_h" = "yes" ++ -o "$MACHDEP" = "win32"]), [], [$SOCKET_LIBS]) + + dnl platform specific extensions + PY_STDLIB_MOD([grp], [], +diff --git a/pyconfig.h.in b/pyconfig.h.in +index 1a6c1a3..33b4308 100644 +--- a/pyconfig.h.in ++++ b/pyconfig.h.in +@@ -59,7 +59,7 @@ + /* Define to 1 if you have the 'acosh' function. */ + #undef HAVE_ACOSH + +-/* struct addrinfo (netdb.h) */ ++/* struct addrinfo */ + #undef HAVE_ADDRINFO + + /* Define to 1 if you have the 'alarm' function. */ +@@ -1667,6 +1667,9 @@ + /* Define to 1 if you have the 'writev' function. */ + #undef HAVE_WRITEV + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_WS2TCPIP_H ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_ZDICT_H + +@@ -2104,7 +2107,7 @@ + /* Define as 'unsigned int' if doesn't define. */ + #undef size_t + +-/* Define to 'int' if does not define. */ ++/* Define to `int' if or does not define. */ + #undef socklen_t + + /* Define as 'int' if doesn't define. */ diff --git a/patches/3.14/ssl_module_msys.patch b/patches/3.14/ssl_module_msys.patch new file mode 100644 index 0000000..d2de3c5 --- /dev/null +++ b/patches/3.14/ssl_module_msys.patch @@ -0,0 +1,100 @@ +# ssl_module_msys.patch +# +# Target: Modules/_ssl.c, Modules/clinic/_ssl.c.h, configure.ac + the +# generated configure (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0059 +# "ssl module: add MINGW support" (ported verbatim; configure +# regenerated with the pinned autoconf 2.72) +# +# Wall item (anticipated link wall, same leg class as run 34725669811): +# the tebako build pins _ssl STATIC and links static libssl/libcrypto.a +# into _bootstrap_python, _freeze_module, and the exe; ucrt64's static +# openssl references winsock2 (BIO socket layer) and CryptoAPI symbols — +# undefined without -lws2_32 -lcrypt32. The patch appends both to +# MODULE__SSL_LDFLAGS (consumed via MODLIBS on every link). The _ssl.c + +# clinic hunks widen the _MSC_VER guards around enum_certificates/ +# enum_crls to _WIN32 so the Windows cert-store APIs are available on +# mingw (MSVC behavior parity; the cert-store enum is how Windows python +# finds trust roots). +diff --git a/Modules/_ssl.c b/Modules/_ssl.c +index 5258df3..5b0f332 100644 +--- a/Modules/_ssl.c ++++ b/Modules/_ssl.c +@@ -5972,7 +5972,7 @@ _ssl_nid2obj_impl(PyObject *module, int nid) + return result; + } + +-#ifdef _MSC_VER ++#ifdef _WIN32 + + static PyObject* + certEncodingType(DWORD encodingType) +@@ -6291,7 +6291,7 @@ _ssl_enum_crls_impl(PyObject *module, const char *store_name) + } + } + +-#endif /* _MSC_VER */ ++#endif /* _WIN32 */ + + /* List of functions exported by this module. */ + static PyMethodDef PySSL_methods[] = { +diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h +index 0f45b2f..680b2c4 100644 +--- a/Modules/clinic/_ssl.c.h ++++ b/Modules/clinic/_ssl.c.h +@@ -2736,7 +2736,7 @@ exit: + return return_value; + } + +-#if defined(_MSC_VER) ++#if defined(_WIN32) + + PyDoc_STRVAR(_ssl_enum_certificates__doc__, + "enum_certificates($module, /, store_name)\n" +@@ -2816,9 +2816,9 @@ exit: + return return_value; + } + +-#endif /* defined(_MSC_VER) */ ++#endif /* defined(_WIN32) */ + +-#if defined(_MSC_VER) ++#if defined(_WIN32) + + PyDoc_STRVAR(_ssl_enum_crls__doc__, + "enum_crls($module, /, store_name)\n" +@@ -2897,7 +2897,7 @@ exit: + return return_value; + } + +-#endif /* defined(_MSC_VER) */ ++#endif /* defined(_WIN32) */ + + #ifndef _SSL_ENUM_CERTIFICATES_METHODDEF + #define _SSL_ENUM_CERTIFICATES_METHODDEF +diff --git a/configure b/configure +index 26e35e9..3dca209 100755 +--- a/configure ++++ b/configure +@@ -34694,7 +34694,7 @@ fi + then : + + as_fn_append MODULE_BLOCK "MODULE__SSL_CFLAGS=$OPENSSL_INCLUDES$as_nl" +- as_fn_append MODULE_BLOCK "MODULE__SSL_LDFLAGS=$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS$as_nl" ++ as_fn_append MODULE_BLOCK "MODULE__SSL_LDFLAGS=$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS -lws2_32 -lcrypt32$as_nl" + + fi + if test "$py_cv_module__ssl" = yes; then +diff --git a/configure.ac b/configure.ac +index dd093fa..4a19c1a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8520,7 +8520,7 @@ PY_STDLIB_MOD([_zstd], [], [test "$have_libzstd" = yes], + + dnl OpenSSL bindings + PY_STDLIB_MOD([_ssl], [], [test "$ac_cv_working_openssl_ssl" = yes], +- [$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS]) ++ [$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS -lws2_32 -lcrypt32]) + PY_STDLIB_MOD([_hashlib], [], [test "$ac_cv_working_openssl_hashlib" = yes], + [$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $LIBCRYPTO_LIBS]) + diff --git a/patches/3.14/sysmodule_vpath_msys.patch b/patches/3.14/sysmodule_vpath_msys.patch new file mode 100644 index 0000000..e347047 --- /dev/null +++ b/patches/3.14/sysmodule_vpath_msys.patch @@ -0,0 +1,28 @@ +# sysmodule_vpath_msys.patch +# +# Target: Makefile.pre.in (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0054 +# "build: def VPATH when compiling Python/sysmodule.c" (ported +# verbatim) +# +# Wall item (tebako-runtime-python PR #16, run 34725669811): +# Python/sysmodule.c:3924: 'VPATH' undeclared at +# SET_SYS_FROM_STRING("_vpath", VPATH). Upstream guards the use with +# MS_WINDOWS — live only once pyport_ms_windows_msys defines it — and +# gets VPATH from PC/pyconfig.h (MSVC-only); the autotools compile line +# for sysmodule.o carried -DABIFLAGS and $(MULTIARCH_CPPFLAGS) only. The +# patch passes -DVPATH='"$(VPATH)"' on the sysmodule.o rule (VPATH is +# @srcdir@-substituted; in-tree it is ".", matching the build shape the +# factory drives). +diff --git a/Makefile.pre.in b/Makefile.pre.in +index b3f3eee..a4c738b 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1973,6 +1973,7 @@ Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile + Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h + $(CC) -c $(PY_CORE_CFLAGS) \ + -DABIFLAGS='"$(ABIFLAGS)"' \ ++ -DVPATH='"$(VPATH)"' \ + $(MULTIARCH_CPPFLAGS) \ + -o $@ $(srcdir)/Python/sysmodule.c + diff --git a/patches/3.14/timemodule_msys.patch b/patches/3.14/timemodule_msys.patch new file mode 100644 index 0000000..44a5a05 --- /dev/null +++ b/patches/3.14/timemodule_msys.patch @@ -0,0 +1,36 @@ +# timemodule_msys.patch +# +# Target: Modules/timemodule.c (windows-msys scenario) +# Source: MSYS2 MINGW-packages mingw-w64-python 0045 +# "timemodule: add MINGW support" (ported verbatim) +# +# Wall item (anticipated compile wall): timemodule.c's timezone/daylight/ +# tzname spellings are _MSC_VER-gated onto the ucrt-native underscored +# names (_timezone &co.); the POSIX fallbacks (timezone, daylight, +# tzname) are not declared by mingw-w64's time.h under -std=c11 +# (__STRICT_ANSI__ hides the legacy POSIX aliases), so the unpatched tree +# risks implicit declarations in the always-built time module. The patch +# widens the gates to MS_WINDOWS — the ucrt spellings — matching the +# MSVC-proven behavior exactly. +diff --git a/Modules/timemodule.c b/Modules/timemodule.c +index 5e43adb..be1e2f4 100644 +--- a/Modules/timemodule.c ++++ b/Modules/timemodule.c +@@ -41,7 +41,7 @@ + # include + #endif + +-#ifdef _MSC_VER ++#ifdef MS_WINDOWS + # define _Py_timezone _timezone + # define _Py_daylight _daylight + # define _Py_tzname _tzname +@@ -898,7 +898,7 @@ time_strftime(PyObject *module, PyObject *args) + // + // Android works with negative years on the emulator, but fails on some + // physical devices (#123017). +-#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) \ ++#if defined(MS_WINDOWS) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) \ + || defined(__VXWORKS__) || defined(__ANDROID__) + if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) { + PyErr_SetString(PyExc_ValueError, diff --git a/spec/tfs/source_prep_spec.rb b/spec/tfs/source_prep_spec.rb index cac2e38..bc72fb2 100644 --- a/spec/tfs/source_prep_spec.rb +++ b/spec/tfs/source_prep_spec.rb @@ -115,10 +115,10 @@ def runtime_manifest(dir, name, markers: true) # The patch-applying surface: a runtime-built patch series over the # runtime_manifest tree (offline, nothing committed twice). context "with a patched line" do - def write_patch_series(patches_root, line, inner_patch:) + def write_patch_series(patches_root, line, inner_patch:, hello_patch: nil) line_dir = File.join(patches_root, line) FileUtils.mkdir_p(line_dir) - File.write(File.join(line_dir, "hello_txt.patch"), <<~PATCH) + File.write(File.join(line_dir, "hello_txt.patch"), hello_patch || <<~PATCH) diff --git a/hello.txt b/hello.txt --- a/hello.txt +++ b/hello.txt @@ -150,14 +150,15 @@ def good_inner_patch PATCH end - def patched_prep(dir, version, inner_patch: nil) + def patched_prep(dir, version, inner_patch: nil, hello_patch: nil) manifest, tarball = runtime_manifest(dir, version) cache = File.join(dir, "cache") FileUtils.mkdir_p(cache) FileUtils.cp(tarball, File.join(cache, "Python-#{version}.tar.xz")) line = version.split(".")[0..1].join(".") patches_root = File.join(dir, "patches") - write_patch_series(patches_root, line, inner_patch: inner_patch || good_inner_patch) + write_patch_series(patches_root, line, inner_patch: inner_patch || good_inner_patch, + hello_patch: hello_patch) described_class.new(versions: manifest, selection: Tfs::PatchSelection.new(patches_root), cache_dir: cache) @@ -179,7 +180,7 @@ def patched_prep(dir, version, inner_patch: nil) end end - it "audits every selected patch against the pristine tree" do + it "audits every selected patch as a cumulative series in manifest order" do Dir.mktmpdir do |dir| outcomes = patched_prep(dir, "9.9.9").audit("9.9.9", File.join(dir, "audit")) expect(outcomes.map { |outcome| [outcome.patch.feature, outcome.status] }) @@ -187,6 +188,42 @@ def patched_prep(dir, version, inner_patch: nil) end end + it "audits a patch whose context only its predecessor creates" do + dependent = <<~PATCH + diff --git a/hello.txt b/hello.txt + --- a/hello.txt + +++ b/hello.txt + @@ -1,3 +1,3 @@ + line one + -line two (patched) + +line two (patched twice) + line three + PATCH + Dir.mktmpdir do |dir| + outcomes = patched_prep(dir, "9.9.9", inner_patch: dependent).audit("9.9.9", File.join(dir, "audit")) + expect(outcomes.map(&:status)).to eq(%i[ok ok]) + end + end + + it "marks later patches not-checked when the series breaks" do + broken_hello = <<~PATCH + diff --git a/hello.txt b/hello.txt + --- a/hello.txt + +++ b/hello.txt + @@ -1,3 +1,3 @@ + line one + -content the tree does not carry + +line two (patched) + line three + PATCH + Dir.mktmpdir do |dir| + outcomes = patched_prep(dir, "9.9.9", hello_patch: broken_hello).audit("9.9.9", File.join(dir, "audit")) + expect(outcomes.map(&:status)).to eq(%i[failed failed]) + expect(outcomes.first.detail).to include("FAIL 9.9.9 hello_txt.patch") + expect(outcomes.last.detail).to include("not checked: the series broke at hello_txt.patch") + end + end + it "reports (never raises) a failed audit outcome naming version and patch" do broken = good_inner_patch.sub("inner file, untouched", "content the tree does not carry") Dir.mktmpdir do |dir| diff --git a/tools/compile_smoke b/tools/compile_smoke index 5928a5a..21931d5 100755 --- a/tools/compile_smoke +++ b/tools/compile_smoke @@ -20,10 +20,43 @@ # #16, run 34692047817: the POSIX compile line # carries no -I$(srcdir)/PC until # configure_pc_include_msys) -# plus any .c target the scenario's patch set names (none today: the -# series touches configure.ac/configure/headers — compiling the wall TUs -# is what proves the header/configure patches). No link, no exts, no -# install: the full runtime build stays the runtime factory's job +# plus the PR #16 round-2 walls (run 34725669811) and the MSYS2-sweep +# modules whose patches this series carries (v0.3.2): +# Python/sysmodule.o — died on VPATH undeclared (MS_WINDOWS +# branch; fixed by sysmodule_vpath_msys) +# Python/thread.o — died in thread_pthread.h (native_id, +# pause; fixed by configure_nt_threads_msys) +# Modules/posixmodule.o — the nt-module rename (posixmodule_nt_msys); +# died on ioctl/I_PUSH via HAVE_DEV_PTMX under +# the msys shell (configure_mingw_defaults_msys, +# run 34730588522) +# Modules/signalmodule.o — the MS_WINDOWS WSAGetLastError branch +# (signal_ws2_32_msys covers the link side); +# died on implicit alarm() via HAVE_ALARM +# (configure_mingw_defaults_msys, same run) +# Modules/timemodule.o — ucrt _timezone spellings (timemodule_msys) +# Modules/socketmodule.o — the mingw header gate (socketmodule_msys) +# Modules/_threadmodule.o — _PYTHREAD_NAME_MAXLEN consumer +# (configure_pthread_name_maxlen_msys) +# Programs/_bootstrap_python.o — the freeze tool's entry TU (its LINK +# wall is 0056's — the full link stays +# downstream, though the frozen-header regen +# dependency pulls the _freeze_module link +# into this gate: run 34732802820) +# plus any .c target the scenario's patch set names — with a presence +# probe: a patch-named stdlib TU compiles only when configure left it a +# literal rule in the generated Makefile (an n/a module — e.g. _ssl +# without an openssl dev package in this env — emits NO rule, and +# make's implicit %.o:%.c fallback would otherwise compile it with the +# wrong flags). Skips are reported in the OK line. WALL_OBJECTS never +# probe: a missing rule there IS the regression. One TU joins +# conditionally: Modules/_io/winconsoleio.o exists only in the patched +# tree (io_winconsoleio_msys, MSYS2 0037 — 0002's HAVE_WINDOWS_CONSOLE_IO +# arm makes it load-bearing; run 34732802820's _freeze_module link died +# on _get_console_type / _PyIO_get_console_type / winconsoleio_spec), so +# it is wall-listed on windows-msys only — the pristine POSIX tree has +# no rule for it and must not fail on its absence. No exts, no install: +# the full runtime build stays the runtime factory's job # (TODO.python/05 item 2). # # Coverage contract (the v0.3.0 gate-gap lesson): the smoke IS the @@ -51,7 +84,16 @@ require "fileutils" require "open3" require "optparse" -WALL_OBJECTS = %w[Python/pylifecycle.o Python/pytime.o Programs/python.o Objects/exceptions.o].freeze +WALL_OBJECTS = %w[Python/pylifecycle.o Python/pytime.o Programs/python.o Objects/exceptions.o + Python/sysmodule.o Python/thread.o + Modules/posixmodule.o Modules/signalmodule.o Modules/timemodule.o + Modules/socketmodule.o Modules/_threadmodule.o Programs/_bootstrap_python.o].freeze + +# Scenario-only wall TUs: io_winconsoleio_msys (MSYS2 0037) adds +# winconsoleio.c to the _io bootstrap line — the TU has no make rule in +# the pristine POSIX tree, so it can join the never-probed wall set only +# on the platform whose patch set creates it. +WALL_OBJECTS_MSYS = %w[Modules/_io/winconsoleio.o].freeze PLATFORM_CONFIG = { "windows-msys" => { "env" => {}, "configure" => ["--disable-shared"] }, @@ -87,9 +129,9 @@ cache_dir = ENV.fetch("TFS_CACHE_DIR", Tfs::SourcePrep::DEFAULT_CACHE_DIR) selection = Tfs::PatchSelection.new patches = selection.for(version, platform: platform) -objects = (WALL_OBJECTS + patches.map(&:target_file) - .select { |target| target.end_with?(".c") } - .map { |target| target.sub(/\.c\z/, ".o") }).uniq +auto_objects = patches.map(&:target_file) + .select { |target| target.end_with?(".c") } + .map { |target| target.sub(/\.c\z/, ".o") } FileUtils.mkdir_p(outdir) prep = Tfs::SourcePrep.new(versions: Tfs::Versions.new, @@ -104,6 +146,19 @@ unless status.success? abort "tools/compile_smoke: configure failed for #{version} (#{platform})\n#{tail}" end +# A patch-named stdlib TU is buildable here only when configure left it a +# literal rule (an n/a module emits none — e.g. _ssl with no openssl dev +# package in this env — and make's implicit %.o:%.c fallback would +# compile it with the wrong flags). WALL_OBJECTS (and the platform's +# scenario-only additions) are never probed: a missing rule there is the +# regression the gate exists to catch. +makefile = File.read(File.join(src, "Makefile")) +wall_objects = WALL_OBJECTS + (platform == "windows-msys" ? WALL_OBJECTS_MSYS : []) +buildable, skipped = (auto_objects - wall_objects).uniq.partition do |object| + makefile.match?(/^#{Regexp.escape(object)}:/) +end +objects = wall_objects + buildable + failing_output = [] failed = objects.reject do |object| out, err, status = Open3.capture3("make", "-j2", object, chdir: src) @@ -112,4 +167,5 @@ failed = objects.reject do |object| end abort "tools/compile_smoke: FAIL #{version} (#{platform}): #{failed.join(', ')} did not compile\n#{failing_output.join}" unless failed.empty? -puts "OK #{version} (#{platform}): configure green, #{objects.size} wall translation units compile (#{objects.join(', ')})" +note = skipped.empty? ? "" : " (n/a in this env, skipped: #{skipped.join(', ')})" +puts "OK #{version} (#{platform}): configure green, #{objects.size} translation units compile (#{objects.join(', ')})#{note}" diff --git a/tools/lib/tfs/onboarder.rb b/tools/lib/tfs/onboarder.rb index 030fc2a..1a79f63 100644 --- a/tools/lib/tfs/onboarder.rb +++ b/tools/lib/tfs/onboarder.rb @@ -12,9 +12,9 @@ module Tfs # linux-gnu-only because the monitor wrote the default); # 2. verify: re-read the pinned manifest and run SourcePrep#check # (fetch via the new entry, sha256 verify, extract, tree sanity) — - # for a PATCHED line this includes the series' git apply --check - # against the new pristine tree (the early warning that a series - # needs a versioned entry). + # for a PATCHED line this includes applying the series in manifest + # order against the new pristine tree (the early warning that a + # series needs a versioned entry). # There is no manifest seeding for a NEW line (the ruby factory's step): # the windows-msys port lands per line deliberately (patches/README.md), # never by an optimistic copy onto an unproven line. On any failure diff --git a/tools/lib/tfs/source_prep.rb b/tools/lib/tfs/source_prep.rb index 9d4f52b..093ae99 100644 --- a/tools/lib/tfs/source_prep.rb +++ b/tools/lib/tfs/source_prep.rb @@ -93,21 +93,33 @@ def check(version_name, outdir) tree end - # Per-patch check outcomes against the pristine tree: each selected - # patch (or an explicitly given set) is tried with git apply --check - # and reported :ok or :failed, without raising. Empty for an - # unpatched line — the pristine tree is not re-extracted for nothing. + # Per-patch check outcomes: the selected series is applied IN MANIFEST + # ORDER against a pristine tree and each patch reported :ok or + # :failed, without raising. The series is cumulative (each patch's + # context may assume its predecessors — the MSYS2-tracked windows-msys + # line is a quilt-style series), so the check applies for real, not + # --check: once a patch fails, later patches cannot be checked + # meaningfully and are reported failed with a not-checked note. Empty + # for an unpatched line — the pristine tree is not re-extracted for + # nothing. def audit(version_name, outdir, patches: nil) patches ||= patched_line?(version_name) ? selected_patches(version_name) : [] return [] if patches.empty? tree = pristine_tree(version_name, outdir) - patches.map do |patch| - applied = apply(tree, patch, version_name, ["--check"]) - Outcome.new(patch: patch, status: applied ? :ok : :failed, detail: nil) + outcomes = [] + patches.each_with_index do |patch, index| + apply(tree, patch, version_name, []) + outcomes << Outcome.new(patch: patch, status: :ok, detail: nil) rescue ApplyError => e - Outcome.new(patch: patch, status: :failed, detail: e.message) + outcomes << Outcome.new(patch: patch, status: :failed, detail: e.message) + patches[(index + 1)..].each do |later| + outcomes << Outcome.new(patch: later, status: :failed, + detail: "not checked: the series broke at #{patch.name}") + end + break end + outcomes end # Downloads a tarball URL into the cache (no-op when already cached) diff --git a/tools/lint b/tools/lint index cb2d456..b5e6f2c 100755 --- a/tools/lint +++ b/tools/lint @@ -4,9 +4,10 @@ # Usage: tools/lint # Fetches the version's official tarball (sha256-verified), extracts it, # asserts the tree is a CPython source tree (Tfs::SourcePrep::TREE_MARKERS), -# and — when the version's line carries a patch set — runs -# git apply --check of every selected patch against the pristine tree -# (the tamatebako/ruby lint gate's shape, ported). +# and — when the version's line carries a patch set — applies the selected +# series to a pristine tree in manifest order (the series is cumulative: +# a patch's context may assume its predecessors; the tamatebako/ruby lint +# gate's shape, ported). $LOAD_PATH.unshift(File.expand_path("lib", __dir__)) require "tfs"