From edb56a11533743a6daa4cf48b25d258fa5e0b6b0 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 28 Sep 2025 13:47:54 -0600 Subject: [PATCH] python312: workaround for missing CLOCK_THREAD_CPUTIME_ID --- recipes/dev/python312/redox.patch | 62 ++++++++++++++++++------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/recipes/dev/python312/redox.patch b/recipes/dev/python312/redox.patch index 292c43db9..9ead63c55 100644 --- a/recipes/dev/python312/redox.patch +++ b/recipes/dev/python312/redox.patch @@ -1,7 +1,7 @@ diff -ruwN source/configure source-new/configure ---- source/configure 2025-02-04 21:38:38.000000000 +0700 -+++ source-new/configure 2025-09-17 20:20:00.088297027 +0700 -@@ -4283,6 +4283,9 @@ +--- source/configure 2023-10-02 05:48:14.000000000 -0600 ++++ source-new/configure 2025-09-28 13:44:57.914820310 -0600 +@@ -4276,6 +4276,9 @@ *-*-wasi) ac_sys_system=WASI ;; @@ -11,7 +11,7 @@ diff -ruwN source/configure source-new/configure *) # for now, limit cross builds to known configurations MACHDEP="unknown" -@@ -4307,6 +4310,7 @@ +@@ -4300,6 +4303,7 @@ case $MACHDEP in aix*) MACHDEP="aix";; linux*) MACHDEP="linux";; @@ -19,7 +19,7 @@ diff -ruwN source/configure source-new/configure cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; '') MACHDEP="unknown";; -@@ -4327,7 +4331,7 @@ +@@ -4311,7 +4315,7 @@ if test "$cross_compiling" = yes; then case "$host" in @@ -28,7 +28,7 @@ diff -ruwN source/configure source-new/configure case "$host_cpu" in arm*) _host_cpu=arm -@@ -6762,6 +6766,7 @@ +@@ -6746,6 +6750,7 @@ #undef cris #undef fr30 #undef linux @@ -36,7 +36,7 @@ diff -ruwN source/configure source-new/configure #undef hppa #undef hpux #undef i386 -@@ -6907,6 +6912,18 @@ +@@ -6891,6 +6896,18 @@ # endif #elif defined(__gnu_hurd__) i386-gnu @@ -55,7 +55,7 @@ diff -ruwN source/configure source-new/configure #elif defined(__APPLE__) darwin #elif defined(__VXWORKS__) -@@ -7507,7 +7524,7 @@ +@@ -7488,7 +7505,7 @@ PY3LIBRARY=libpython3.so fi ;; @@ -64,8 +64,8 @@ diff -ruwN source/configure source-new/configure LDLIBRARY='libpython$(LDVERSION).so' BLDLIBRARY='-L. -lpython$(LDVERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} -@@ -12815,7 +12832,7 @@ - Emscripten*|WASI*) +@@ -12753,7 +12770,7 @@ + Emscripten|WASI) LDSHARED='$(CC) -shared' LDCXXSHARED='$(CXX) -shared';; - Linux*|GNU*|QNX*|VxWorks*|Haiku*) @@ -73,7 +73,7 @@ diff -ruwN source/configure source-new/configure LDSHARED='$(CC) -shared' LDCXXSHARED='$(CXX) -shared';; FreeBSD*) -@@ -12901,7 +12918,7 @@ +@@ -12839,7 +12856,7 @@ else CCSHARED="+z"; fi;; Linux-android*) ;; @@ -82,7 +82,7 @@ diff -ruwN source/configure source-new/configure Emscripten*|WASI*) if test "x$enable_wasm_dynamic_linking" = xyes then : -@@ -12939,7 +12956,7 @@ +@@ -12877,7 +12894,7 @@ LINKFORSHARED="-Wl,-E -Wl,+s";; # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; @@ -92,8 +92,8 @@ diff -ruwN source/configure source-new/configure Darwin/*) LINKFORSHARED="$extra_undefs -framework CoreFoundation" diff -ruwN source/Include/pyport.h source-new/Include/pyport.h ---- source/Include/pyport.h 2025-02-04 21:38:38.000000000 +0700 -+++ source-new/Include/pyport.h 2025-09-08 00:58:51.645114412 +0700 +--- source/Include/pyport.h 2023-10-02 05:48:14.000000000 -0600 ++++ source-new/Include/pyport.h 2025-09-28 13:44:57.916856922 -0600 @@ -684,7 +684,7 @@ # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" #endif @@ -104,8 +104,8 @@ diff -ruwN source/Include/pyport.h source-new/Include/pyport.h // See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale() // and PyUnicode_EncodeLocale(). diff -ruwN source/Modules/_cryptmodule.c source-new/Modules/_cryptmodule.c ---- source/Modules/_cryptmodule.c 2025-02-04 21:38:38.000000000 +0700 -+++ source-new/Modules/_cryptmodule.c 2025-09-08 01:08:47.321046272 +0700 +--- source/Modules/_cryptmodule.c 2023-10-02 05:48:14.000000000 -0600 ++++ source-new/Modules/_cryptmodule.c 2025-09-28 13:44:57.917139387 -0600 @@ -38,13 +38,7 @@ /*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/ { @@ -121,9 +121,9 @@ diff -ruwN source/Modules/_cryptmodule.c source-new/Modules/_cryptmodule.c return PyErr_SetFromErrno(PyExc_OSError); } diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c ---- source/Modules/posixmodule.c 2025-02-04 21:38:38.000000000 +0700 -+++ source-new/Modules/posixmodule.c 2025-09-08 01:06:48.400701428 +0700 -@@ -2695,8 +2695,7 @@ +--- source/Modules/posixmodule.c 2023-10-02 05:48:14.000000000 -0600 ++++ source-new/Modules/posixmodule.c 2025-09-28 13:44:57.918070573 -0600 +@@ -2610,8 +2610,7 @@ #ifdef HAVE_FSTATAT if ((dir_fd != DEFAULT_DIR_FD) || !follow_symlinks) { if (HAVE_FSTATAT_RUNTIME) { @@ -133,7 +133,7 @@ diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c } else { fstatat_unavailable = 1; -@@ -3186,8 +3185,6 @@ +@@ -3083,8 +3082,6 @@ if (HAVE_FACCESSAT_RUNTIME) { int flags = 0; @@ -142,7 +142,7 @@ diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c if (effective_ids) flags |= AT_EACCESS; result = faccessat(dir_fd, path->narrow, mode, flags); -@@ -3472,8 +3469,7 @@ +@@ -3369,8 +3366,7 @@ * support dir_fd and follow_symlinks=False. (Hopefully.) * Until then, we need to be careful what exception we raise. */ @@ -152,7 +152,7 @@ diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c /* * But wait! We can't throw the exception without allowing threads, * and we can't do that in this nested scope. (Macro trickery, sigh.) -@@ -3850,8 +3846,7 @@ +@@ -3747,8 +3743,7 @@ #ifdef HAVE_FCHOWNAT if ((dir_fd != DEFAULT_DIR_FD) || (!follow_symlinks)) { if (HAVE_FCHOWNAT_RUNTIME) { @@ -162,7 +162,7 @@ diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c } else { fchownat_unsupported = 1; } -@@ -14727,8 +14722,7 @@ +@@ -14598,8 +14593,7 @@ #ifdef HAVE_FSTATAT if (HAVE_FSTATAT_RUNTIME) { Py_BEGIN_ALLOW_THREADS @@ -173,8 +173,8 @@ diff -ruwN source/Modules/posixmodule.c source-new/Modules/posixmodule.c } else diff -ruwN source/Modules/resource.c source-new/Modules/resource.c ---- source/Modules/resource.c 2025-02-04 21:38:38.000000000 +0700 -+++ source-new/Modules/resource.c 2025-09-08 01:10:18.427310454 +0700 +--- source/Modules/resource.c 2023-10-02 05:48:14.000000000 -0600 ++++ source-new/Modules/resource.c 2025-09-28 13:44:57.919295094 -0600 @@ -216,7 +216,7 @@ { struct rlimit rl; @@ -202,3 +202,15 @@ diff -ruwN source/Modules/resource.c source-new/Modules/resource.c PyErr_SetString(PyExc_ValueError, "invalid resource specified"); return NULL; +diff -ruwN source/Modules/timemodule.c source-new/Modules/timemodule.c +--- source/Modules/timemodule.c 2023-10-02 05:48:14.000000000 -0600 ++++ source-new/Modules/timemodule.c 2025-09-28 13:45:28.513234796 -0600 +@@ -1494,7 +1494,7 @@ + + #elif defined(HAVE_CLOCK_GETTIME) && \ + defined(CLOCK_PROCESS_CPUTIME_ID) && \ +- !defined(__EMSCRIPTEN__) && !defined(__wasi__) ++ !defined(__EMSCRIPTEN__) && !defined(__wasi__) && !defined(__redox__) + #define HAVE_THREAD_TIME + + #if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)