aboutsummaryrefslogtreecommitdiff
path: root/tools/depends
diff options
context:
space:
mode:
Diffstat (limited to 'tools/depends')
-rw-r--r--tools/depends/Makefile.include.in2
-rw-r--r--tools/depends/native/Mako/MAKO-VERSION4
-rw-r--r--tools/depends/native/Mako/Makefile10
-rw-r--r--tools/depends/native/MarkupSafe/01-all-GH399-removedistutils.patch48
-rw-r--r--tools/depends/native/MarkupSafe/MARKUPSAFE-VERSION4
-rw-r--r--tools/depends/native/MarkupSafe/Makefile12
-rw-r--r--tools/depends/native/python3/01-distutil-flags.patch12
-rw-r--r--tools/depends/native/python3/Makefile7
-rw-r--r--tools/depends/native/python3/PYTHON3-VERSION4
-rw-r--r--tools/depends/target/mesa/01-all-py312-setuptools.patch10
-rw-r--r--tools/depends/target/mesa/Makefile4
-rw-r--r--tools/depends/target/python3/01-py312-cpython118618-1.patch369
-rw-r--r--tools/depends/target/python3/01-py312-cpython118618-2.patch71
-rw-r--r--tools/depends/target/python3/02-android-cpython114875.patch36
-rw-r--r--tools/depends/target/python3/10-linux-modules.patch11
-rw-r--r--tools/depends/target/python3/10-osx-modules.patch11
-rw-r--r--tools/depends/target/python3/Makefile78
-rw-r--r--tools/depends/target/python3/PYTHON3-VERSION4
-rw-r--r--tools/depends/target/python3/apple.patch9
-rw-r--r--tools/depends/target/python3/crosscompile.patch64
-rw-r--r--tools/depends/target/python3/darwin_embedded.patch11
-rw-r--r--tools/depends/target/python3/modules.setup304
-rw-r--r--tools/depends/target/pythonmodule-setuptools/PYTHONMODULE-SETUPTOOLS-VERSION4
-rw-r--r--tools/depends/target/samba-gplv3/08-py312-distutils.patch11
-rw-r--r--tools/depends/target/samba-gplv3/Makefile2
25 files changed, 629 insertions, 473 deletions
diff --git a/tools/depends/Makefile.include.in b/tools/depends/Makefile.include.in
index 1903fecd85..8a42fea4bc 100644
--- a/tools/depends/Makefile.include.in
+++ b/tools/depends/Makefile.include.in
@@ -108,7 +108,7 @@ VERSION.TXT := $(CMAKE_SOURCE_DIR)/version.txt
APP_NAME=$(shell awk '/APP_NAME/ {print tolower($$2)}' $(VERSION.TXT))
# Python related vars
-PYTHON_VERSION=3.11
+PYTHON_VERSION=3.12
PYTHON_SITE_PKG=@prefix@/@deps_dir@/lib/python${PYTHON_VERSION}/site-packages
ifeq ($(CPU), arm64)
diff --git a/tools/depends/native/Mako/MAKO-VERSION b/tools/depends/native/Mako/MAKO-VERSION
new file mode 100644
index 0000000000..d863d172c7
--- /dev/null
+++ b/tools/depends/native/Mako/MAKO-VERSION
@@ -0,0 +1,4 @@
+LIBNAME=Mako
+VERSION=1.3.5
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+SHA512=9a2f96bcb650f40cc2a9daa05904e54efca1fa30022ab641c850f6e32b84a38368d4c5d328f94ac4495ed97778d6ab0b661bc93a14740ed7e5d518f03bc9a59f
diff --git a/tools/depends/native/Mako/Makefile b/tools/depends/native/Mako/Makefile
index c31e462db4..559c88b0f2 100644
--- a/tools/depends/native/Mako/Makefile
+++ b/tools/depends/native/Mako/Makefile
@@ -1,14 +1,8 @@
-include ../../Makefile.include
+include ../../Makefile.include MAKO-VERSION ../../download-files.include
PREFIX=$(NATIVEPREFIX)
PLATFORM=$(NATIVEPLATFORM)
-DEPS = ../../Makefile.include Makefile ../../download-files.include
+DEPS = ../../Makefile.include Makefile MAKO-VERSION ../../download-files.include
-# lib name, version
-LIBNAME=Mako
-VERSION=1.1.3
-ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
-SHA512=a9b94fa34a61e7794b6e4549fa0bada6ff84dfb0d9edb8d5c7f9b95d12184fa4499f42303cfee720b576a9f7e986a57d91ad3aeb26c9f93154dbc08fb2975952
-include ../../download-files.include
all: .installed-$(PLATFORM)
diff --git a/tools/depends/native/MarkupSafe/01-all-GH399-removedistutils.patch b/tools/depends/native/MarkupSafe/01-all-GH399-removedistutils.patch
new file mode 100644
index 0000000000..029157b33f
--- /dev/null
+++ b/tools/depends/native/MarkupSafe/01-all-GH399-removedistutils.patch
@@ -0,0 +1,48 @@
+From 1f6697fcb27824fefd02b5c0890a319cf17fa3de Mon Sep 17 00:00:00 2001
+From: David Lord <davidism@gmail.com>
+Date: Thu, 7 Sep 2023 10:17:17 -0700
+Subject: [PATCH] import from setuptools instead of distutils
+
+---
+ setup.py | 14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 7208cdd7..d19a4faa 100644
+--- a/setup.py
++++ b/setup.py
+@@ -2,12 +2,12 @@
+ import platform
+ import sys
+
+-from distutils.errors import CCompilerError
+-from distutils.errors import DistutilsExecError
+-from distutils.errors import DistutilsPlatformError
+ from setuptools import Extension
+ from setuptools import setup
+ from setuptools.command.build_ext import build_ext
++from setuptools.errors import CCompilerError
++from setuptools.errors import ExecError
++from setuptools.errors import PlatformError
+
+ ext_modules = [Extension("markupsafe._speedups", ["src/markupsafe/_speedups.c"])]
+
+@@ -21,14 +21,14 @@ class ve_build_ext(build_ext):
+
+ def run(self):
+ try:
+- build_ext.run(self)
+- except DistutilsPlatformError as e:
++ super().run()
++ except PlatformError as e:
+ raise BuildFailed() from e
+
+ def build_extension(self, ext):
+ try:
+- build_ext.build_extension(self, ext)
+- except (CCompilerError, DistutilsExecError, DistutilsPlatformError) as e:
++ super().build_extension(ext)
++ except (CCompilerError, ExecError, PlatformError) as e:
+ raise BuildFailed() from e
+ except ValueError as e:
+ # this can happen on Windows 64 bit, see Python issue 7511
diff --git a/tools/depends/native/MarkupSafe/MARKUPSAFE-VERSION b/tools/depends/native/MarkupSafe/MARKUPSAFE-VERSION
new file mode 100644
index 0000000000..d7b442fa7e
--- /dev/null
+++ b/tools/depends/native/MarkupSafe/MARKUPSAFE-VERSION
@@ -0,0 +1,4 @@
+LIBNAME=MarkupSafe
+VERSION=2.1.5
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+SHA512=3ba5af43d23c266377f5d32b11e1faa7955ea8c67eb1c32886c308527f93e75e387294d0eec7794c0c20aad0c705b27f3d1f86b04202f3b63068d12d4053cc71
diff --git a/tools/depends/native/MarkupSafe/Makefile b/tools/depends/native/MarkupSafe/Makefile
index fa4372735e..358e5ccb39 100644
--- a/tools/depends/native/MarkupSafe/Makefile
+++ b/tools/depends/native/MarkupSafe/Makefile
@@ -1,14 +1,9 @@
-include ../../Makefile.include
+include ../../Makefile.include MARKUPSAFE-VERSION ../../download-files.include
PREFIX=$(NATIVEPREFIX)
PLATFORM=$(NATIVEPLATFORM)
-DEPS = ../../Makefile.include Makefile ../../download-files.include
+DEPS = ../../Makefile.include Makefile MARKUPSAFE-VERSION ../../download-files.include \
+ 01-all-GH399-removedistutils.patch
-# lib name, version
-LIBNAME=MarkupSafe
-VERSION=1.1.1
-ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
-SHA512=f3014e6131a3ab866914c5635b5397ef71906bffb1b6f8c5f2ed2acf167429ff7914236d38943e872683a57a9be9669f4c5aace6274f3307ab21ef25373db0b6
-include ../../download-files.include
all: .installed-$(PLATFORM)
@@ -17,6 +12,7 @@ $(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
.installed-$(PLATFORM): $(PLATFORM)
+ cd $(PLATFORM); patch -p1 -i ../01-all-GH399-removedistutils.patch
cd $(PLATFORM); $(PREFIX)/bin/python3 setup.py install --prefix=$(PREFIX)
touch $@
diff --git a/tools/depends/native/python3/01-distutil-flags.patch b/tools/depends/native/python3/01-distutil-flags.patch
deleted file mode 100644
index 28cd2f98ba..0000000000
--- a/tools/depends/native/python3/01-distutil-flags.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/Lib/distutils/sysconfig.py
-+++ b/Lib/distutils/sysconfig.py
-@@ -214,6 +214,9 @@
- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
-+ # get_config_vars returns host vars. clear cflags, ldshared for crosscompile use
-+ cflags = ""
-+ ldshared = cc + " -shared"
-
- if 'CC' in os.environ:
- newcc = os.environ['CC']
diff --git a/tools/depends/native/python3/Makefile b/tools/depends/native/python3/Makefile
index 74ebe061a0..bb93cc87e7 100644
--- a/tools/depends/native/python3/Makefile
+++ b/tools/depends/native/python3/Makefile
@@ -1,7 +1,6 @@
include ../../Makefile.include PYTHON3-VERSION ../../download-files.include
PLATFORM=$(NATIVEPLATFORM)
-DEPS = ../../Makefile.include Makefile PYTHON3-VERSION ../../download-files.include \
- 01-distutil-flags.patch
+DEPS = ../../Makefile.include Makefile PYTHON3-VERSION ../../download-files.include
CONFIGURE=./configure --prefix=$(NATIVEPREFIX) \
--disable-shared \
@@ -32,11 +31,7 @@ $(LIBDYLIB): $(PLATFORM)
cd $(PLATFORM); $(MAKE)
.installed-$(PLATFORM): $(LIBDYLIB)
- cd $(PLATFORM); patch -p1 -i ../01-distutil-flags.patch
cd $(PLATFORM); $(MAKE) install
-# Sed patch setuptools that is installed via ensurepip as we cant patch the source
- cd $(NATIVE_SITEPACKAGES); sed -ie "s|cflags = cflags + ' ' + os.environ\['CFLAGS'\]|cflags = os.environ\['CFLAGS'\]|" setuptools/_distutils/sysconfig.py
- touch $(LIBDYLIB)
touch $@
clean:
diff --git a/tools/depends/native/python3/PYTHON3-VERSION b/tools/depends/native/python3/PYTHON3-VERSION
index c5e1760fb2..9c97bd4018 100644
--- a/tools/depends/native/python3/PYTHON3-VERSION
+++ b/tools/depends/native/python3/PYTHON3-VERSION
@@ -1,4 +1,4 @@
LIBNAME=Python
-VERSION=3.11.7
+VERSION=3.12.5
ARCHIVE=$(LIBNAME)-$(VERSION).tar.xz
-SHA512=11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63
+SHA512=7a1c30d798434fe24697bc253f6010d75145e7650f66803328425c8525331b9fa6b63d12a652687582db205f8d4c8279c8f73c338168592481517b063351c921
diff --git a/tools/depends/target/mesa/01-all-py312-setuptools.patch b/tools/depends/target/mesa/01-all-py312-setuptools.patch
new file mode 100644
index 0000000000..fda2061207
--- /dev/null
+++ b/tools/depends/target/mesa/01-all-py312-setuptools.patch
@@ -0,0 +1,10 @@
+--- a/meson.build
++++ b/meson.build
+@@ -1022,6 +1022,7 @@
+ has_mako = run_command(
+ prog_python, '-c',
+ '''
++import setuptools
+ from distutils.version import StrictVersion
+ import mako
+ assert StrictVersion(mako.__version__) > StrictVersion("0.8.0")
diff --git a/tools/depends/target/mesa/Makefile b/tools/depends/target/mesa/Makefile
index f24b673ccf..9312d35512 100644
--- a/tools/depends/target/mesa/Makefile
+++ b/tools/depends/target/mesa/Makefile
@@ -1,5 +1,6 @@
include ../../Makefile.include
-DEPS =../../Makefile.include Makefile ../../download-files.include
+DEPS =../../Makefile.include Makefile ../../download-files.include \
+ 01-all-py312-setuptools.patch
LIBNAME=mesa
VERSION=23.0.1
@@ -76,6 +77,7 @@ $(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); rm -rf build; mkdir -p build
+ cd $(PLATFORM); patch -p1 -i ../01-all-py312-setuptools.patch
cd $(PLATFORM); $(CONFIGURE) . build
$(LIBDYLIB): $(PLATFORM)
diff --git a/tools/depends/target/python3/01-py312-cpython118618-1.patch b/tools/depends/target/python3/01-py312-cpython118618-1.patch
new file mode 100644
index 0000000000..5055a39779
--- /dev/null
+++ b/tools/depends/target/python3/01-py312-cpython118618-1.patch
@@ -0,0 +1,369 @@
+From 21f8fbaa7c01a8ec2fa2420f44f5cb05a54f55b6 Mon Sep 17 00:00:00 2001
+From: Neil Schemenauer <nas@arctrix.com>
+Date: Wed, 27 Mar 2024 09:54:02 -0700
+Subject: [PATCH] Use pointer for interp->obmalloc state.
+
+For interpreters that share state with the main interpreter, this points
+to the same static memory structure. For interpreters with their own
+obmalloc state, it is heap allocated. Add free_obmalloc_arenas() which
+will free the obmalloc arenas and radix tree structures for interpreters
+with their own obmalloc state.
+---
+ Include/internal/pycore_interp.h | 12 +-
+ Include/internal/pycore_obmalloc.h | 2 +
+ Include/internal/pycore_obmalloc_init.h | 7 -
+ Include/internal/pycore_runtime_init.h | 1 -
+ ...-12-22-13-21-39.gh-issue-113055.47xBMF.rst | 5 +
+ Objects/obmalloc.c | 121 +++++++++++++++++-
+ Python/pylifecycle.c | 16 +++
+ Python/pystate.c | 13 +-
+ Tools/c-analyzer/cpython/ignored.tsv | 3 +-
+ 9 files changed, 157 insertions(+), 23 deletions(-)
+ create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst
+
+diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
+index 37cc88ed081b72..a0ef5990259e29 100644
+--- a/Include/internal/pycore_interp.h
++++ b/Include/internal/pycore_interp.h
+@@ -178,7 +178,17 @@ struct _is {
+ struct _warnings_runtime_state warnings;
+ struct atexit_state atexit;
+
+- struct _obmalloc_state obmalloc;
++ // Per-interpreter state for the obmalloc allocator. For the main
++ // interpreter and for all interpreters that don't have their
++ // own obmalloc state, this points to the static structure in
++ // obmalloc.c obmalloc_state_main. For other interpreters, it is
++ // heap allocated by _PyMem_init_obmalloc() and freed when the
++ // interpreter structure is freed. In the case of a heap allocated
++ // obmalloc state, it is not safe to hold on to or use memory after
++ // the interpreter is freed. The obmalloc state corresponding to
++ // that allocated memory is gone. See free_obmalloc_arenas() for
++ // more comments.
++ struct _obmalloc_state *obmalloc;
+
+ PyObject *audit_hooks;
+ PyType_WatchCallback type_watchers[TYPE_MAX_WATCHERS];
+diff --git a/Include/internal/pycore_obmalloc.h b/Include/internal/pycore_obmalloc.h
+index b1c00654ac1c5d..38427e194956ac 100644
+--- a/Include/internal/pycore_obmalloc.h
++++ b/Include/internal/pycore_obmalloc.h
+@@ -686,6 +686,8 @@ extern Py_ssize_t _Py_GetGlobalAllocatedBlocks(void);
+ _Py_GetGlobalAllocatedBlocks()
+ extern Py_ssize_t _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *);
+ extern void _PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *);
++extern int _PyMem_init_obmalloc(PyInterpreterState *interp);
++extern bool _PyMem_obmalloc_state_on_heap(PyInterpreterState *interp);
+
+
+ #ifdef WITH_PYMALLOC
+diff --git a/Include/internal/pycore_obmalloc_init.h b/Include/internal/pycore_obmalloc_init.h
+index 8ee72ff2d4126f..e6811b7aeca73c 100644
+--- a/Include/internal/pycore_obmalloc_init.h
++++ b/Include/internal/pycore_obmalloc_init.h
+@@ -59,13 +59,6 @@ extern "C" {
+ .dump_debug_stats = -1, \
+ }
+
+-#define _obmalloc_state_INIT(obmalloc) \
+- { \
+- .pools = { \
+- .used = _obmalloc_pools_INIT(obmalloc.pools), \
+- }, \
+- }
+-
+
+ #ifdef __cplusplus
+ }
+diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
+index e5f9e17efff24b..d3a64b3d4a7895 100644
+--- a/Include/internal/pycore_runtime_init.h
++++ b/Include/internal/pycore_runtime_init.h
+@@ -88,7 +88,6 @@ extern PyTypeObject _PyExc_MemoryError;
+ { \
+ .id_refcount = -1, \
+ .imports = IMPORTS_INIT, \
+- .obmalloc = _obmalloc_state_INIT(INTERP.obmalloc), \
+ .ceval = { \
+ .recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \
+ }, \
+diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst b/Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst
+new file mode 100644
+index 00000000000000..90f49272218c96
+--- /dev/null
++++ b/Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst
+@@ -0,0 +1,5 @@
++Make interp->obmalloc a pointer. For interpreters that share state with the
++main interpreter, this points to the same static memory structure. For
++interpreters with their own obmalloc state, it is heap allocated. Add
++free_obmalloc_arenas() which will free the obmalloc arenas and radix tree
++structures for interpreters with their own obmalloc state.
+diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
+index 9620a8fbb44cac..acbefef614195c 100644
+--- a/Objects/obmalloc.c
++++ b/Objects/obmalloc.c
+@@ -3,6 +3,7 @@
+ #include "Python.h"
+ #include "pycore_code.h" // stats
+ #include "pycore_pystate.h" // _PyInterpreterState_GET
++#include "pycore_obmalloc_init.h"
+
+ #include "pycore_obmalloc.h"
+ #include "pycore_pymem.h"
+@@ -852,6 +853,13 @@ static int running_on_valgrind = -1;
+
+ typedef struct _obmalloc_state OMState;
+
++/* obmalloc state for main interpreter and shared by all interpreters without
++ * their own obmalloc state. By not explicitly initalizing this structure, it
++ * will be allocated in the BSS which is a small performance win. The radix
++ * tree arrays are fairly large but are sparsely used. */
++static struct _obmalloc_state obmalloc_state_main;
++static bool obmalloc_state_initialized;
++
+ static inline int
+ has_own_state(PyInterpreterState *interp)
+ {
+@@ -864,10 +872,8 @@ static inline OMState *
+ get_state(void)
+ {
+ PyInterpreterState *interp = _PyInterpreterState_GET();
+- if (!has_own_state(interp)) {
+- interp = _PyInterpreterState_Main();
+- }
+- return &interp->obmalloc;
++ assert(interp->obmalloc != NULL); // otherwise not initialized or freed
++ return interp->obmalloc;
+ }
+
+ // These macros all rely on a local "state" variable.
+@@ -893,7 +899,11 @@ _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *interp)
+ "the interpreter doesn't have its own allocator");
+ }
+ #endif
+- OMState *state = &interp->obmalloc;
++ OMState *state = interp->obmalloc;
++
++ if (state == NULL) {
++ return 0;
++ }
+
+ Py_ssize_t n = raw_allocated_blocks;
+ /* add up allocated blocks for used pools */
+@@ -915,13 +925,25 @@ _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *interp)
+ return n;
+ }
+
++static void free_obmalloc_arenas(PyInterpreterState *interp);
++
+ void
+ _PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *interp)
+ {
+- if (has_own_state(interp)) {
++ if (has_own_state(interp) && interp->obmalloc != NULL) {
+ Py_ssize_t leaked = _PyInterpreterState_GetAllocatedBlocks(interp);
+ assert(has_own_state(interp) || leaked == 0);
+ interp->runtime->obmalloc.interpreter_leaks += leaked;
++ if (_PyMem_obmalloc_state_on_heap(interp) && leaked == 0) {
++ // free the obmalloc arenas and radix tree nodes. If leaked > 0
++ // then some of the memory allocated by obmalloc has not been
++ // freed. It might be safe to free the arenas in that case but
++ // it's possible that extension modules are still using that
++ // memory. So, it is safer to not free and to leak. Perhaps there
++ // should be warning when this happens. It should be possible to
++ // use a tool like "-fsanitize=address" to track down these leaks.
++ free_obmalloc_arenas(interp);
++ }
+ }
+ }
+
+@@ -2511,9 +2533,96 @@ _PyDebugAllocatorStats(FILE *out,
+ (void)printone(out, buf2, num_blocks * sizeof_block);
+ }
+
++// Return true if the obmalloc state structure is heap allocated,
++// by PyMem_RawCalloc(). For the main interpreter, this structure
++// allocated in the BSS. Allocating that way gives some memory savings
++// and a small performance win (at least on a demand paged OS). On
++// 64-bit platforms, the obmalloc structure is 256 kB. Most of that
++// memory is for the arena_map_top array. Since normally only one entry
++// of that array is used, only one page of resident memory is actually
++// used, rather than the full 256 kB.
++bool _PyMem_obmalloc_state_on_heap(PyInterpreterState *interp)
++{
++#if WITH_PYMALLOC
++ return interp->obmalloc && interp->obmalloc != &obmalloc_state_main;
++#else
++ return false;
++#endif
++}
++
++#ifdef WITH_PYMALLOC
++static void
++init_obmalloc_pools(PyInterpreterState *interp)
++{
++ // initialize the obmalloc->pools structure. This must be done
++ // before the obmalloc alloc/free functions can be called.
++ poolp temp[OBMALLOC_USED_POOLS_SIZE] =
++ _obmalloc_pools_INIT(interp->obmalloc->pools);
++ memcpy(&interp->obmalloc->pools.used, temp, sizeof(temp));
++}
++#endif /* WITH_PYMALLOC */
++
++int _PyMem_init_obmalloc(PyInterpreterState *interp)
++{
++#ifdef WITH_PYMALLOC
++ /* Initialize obmalloc, but only for subinterpreters,
++ since the main interpreter is initialized statically. */
++ if (_Py_IsMainInterpreter(interp)
++ || _PyInterpreterState_HasFeature(interp,
++ Py_RTFLAGS_USE_MAIN_OBMALLOC)) {
++ interp->obmalloc = &obmalloc_state_main;
++ if (!obmalloc_state_initialized) {
++ init_obmalloc_pools(interp);
++ obmalloc_state_initialized = true;
++ }
++ } else {
++ interp->obmalloc = PyMem_RawCalloc(1, sizeof(struct _obmalloc_state));
++ if (interp->obmalloc == NULL) {
++ return -1;
++ }
++ init_obmalloc_pools(interp);
++ }
++#endif /* WITH_PYMALLOC */
++ return 0; // success
++}
++
+
+ #ifdef WITH_PYMALLOC
+
++static void
++free_obmalloc_arenas(PyInterpreterState *interp)
++{
++ OMState *state = interp->obmalloc;
++ for (uint i = 0; i < maxarenas; ++i) {
++ // free each obmalloc memory arena
++ struct arena_object *ao = &allarenas[i];
++ _PyObject_Arena.free(_PyObject_Arena.ctx,
++ (void *)ao->address, ARENA_SIZE);
++ }
++ // free the array containing pointers to all arenas
++ PyMem_RawFree(allarenas);
++#if WITH_PYMALLOC_RADIX_TREE
++#ifdef USE_INTERIOR_NODES
++ // Free the middle and bottom nodes of the radix tree. These are allocated
++ // by arena_map_mark_used() but not freed when arenas are freed.
++ for (int i1 = 0; i1 < MAP_TOP_LENGTH; i1++) {
++ arena_map_mid_t *mid = arena_map_root.ptrs[i1];
++ if (mid == NULL) {
++ continue;
++ }
++ for (int i2 = 0; i2 < MAP_MID_LENGTH; i2++) {
++ arena_map_bot_t *bot = arena_map_root.ptrs[i1]->ptrs[i2];
++ if (bot == NULL) {
++ continue;
++ }
++ PyMem_RawFree(bot);
++ }
++ PyMem_RawFree(mid);
++ }
++#endif
++#endif
++}
++
+ #ifdef Py_DEBUG
+ /* Is target in the list? The list is traversed via the nextpool pointers.
+ * The list may be NULL-terminated, or circular. Return 1 if target is in
+diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
+index a0130fde15d574..fb833ba61cbd9b 100644
+--- a/Python/pylifecycle.c
++++ b/Python/pylifecycle.c
+@@ -28,6 +28,7 @@
+ #include "pycore_typeobject.h" // _PyTypes_InitTypes()
+ #include "pycore_typevarobject.h" // _Py_clear_generic_types()
+ #include "pycore_unicodeobject.h" // _PyUnicode_InitTypes()
++#include "pycore_obmalloc.h" // _PyMem_init_obmalloc()
+ #include "opcode.h"
+
+ #include <locale.h> // setlocale()
+@@ -636,6 +637,13 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
+ return status;
+ }
+
++ // initialize the interp->obmalloc state. This must be done after
++ // the settings are loaded (so that feature_flags are set) but before
++ // any calls are made to obmalloc functions.
++ if (_PyMem_init_obmalloc(interp) < 0) {
++ return _PyStatus_NO_MEMORY();
++ }
++
+ /* Auto-thread-state API */
+ status = _PyGILState_Init(interp);
+ if (_PyStatus_EXCEPTION(status)) {
+@@ -2051,6 +2059,14 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config)
+ return _PyStatus_OK();
+ }
+
++ // initialize the interp->obmalloc state. This must be done after
++ // the settings are loaded (so that feature_flags are set) but before
++ // any calls are made to obmalloc functions.
++ if (_PyMem_init_obmalloc(interp) < 0) {
++ status = _PyStatus_NO_MEMORY();
++ goto error;
++ }
++
+ PyThreadState *tstate = _PyThreadState_New(interp);
+ if (tstate == NULL) {
+ PyInterpreterState_Delete(interp);
+diff --git a/Python/pystate.c b/Python/pystate.c
+index 1337516aa59cbc..a25c3dcf9d09ea 100644
+--- a/Python/pystate.c
++++ b/Python/pystate.c
+@@ -14,6 +14,7 @@
+ #include "pycore_pystate.h"
+ #include "pycore_runtime_init.h" // _PyRuntimeState_INIT
+ #include "pycore_sysmodule.h"
++#include "pycore_obmalloc.h" // _PyMem_obmalloc_state_on_heap()
+
+ /* --------------------------------------------------------------------------
+ CAUTION
+@@ -636,6 +637,11 @@ free_interpreter(PyInterpreterState *interp)
+ // The main interpreter is statically allocated so
+ // should not be freed.
+ if (interp != &_PyRuntime._main_interpreter) {
++ if (_PyMem_obmalloc_state_on_heap(interp)) {
++ // interpreter has its own obmalloc state, free it
++ PyMem_RawFree(interp->obmalloc);
++ interp->obmalloc = NULL;
++ }
+ PyMem_RawFree(interp);
+ }
+ }
+@@ -679,13 +685,6 @@ init_interpreter(PyInterpreterState *interp,
+ assert(next != NULL || (interp == runtime->interpreters.main));
+ interp->next = next;
+
+- /* Initialize obmalloc, but only for subinterpreters,
+- since the main interpreter is initialized statically. */
+- if (interp != &runtime->_main_interpreter) {
+- poolp temp[OBMALLOC_USED_POOLS_SIZE] = \
+- _obmalloc_pools_INIT(interp->obmalloc.pools);
+- memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp));
+- }
+ _PyObject_InitState(interp);
+
+ _PyEval_InitState(interp, pending_lock);
+diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv
+index 9f36c47ca7ea03..7bcca27ecc32f6 100644
+--- a/Tools/c-analyzer/cpython/ignored.tsv
++++ b/Tools/c-analyzer/cpython/ignored.tsv
+@@ -318,7 +318,8 @@ Objects/obmalloc.c - _PyMem_Debug -
+ Objects/obmalloc.c - _PyMem_Raw -
+ Objects/obmalloc.c - _PyObject -
+ Objects/obmalloc.c - last_final_leaks -
+-Objects/obmalloc.c - usedpools -
++Objects/obmalloc.c - obmalloc_state_main -
++Objects/obmalloc.c - obmalloc_state_initialized -
+ Objects/typeobject.c - name_op -
+ Objects/typeobject.c - slotdefs -
+ Objects/unicodeobject.c - stripfuncnames -
diff --git a/tools/depends/target/python3/01-py312-cpython118618-2.patch b/tools/depends/target/python3/01-py312-cpython118618-2.patch
new file mode 100644
index 0000000000..bbd7a5e0d1
--- /dev/null
+++ b/tools/depends/target/python3/01-py312-cpython118618-2.patch
@@ -0,0 +1,71 @@
+From a867732a619e1cc02369cf0185b53a484d049369 Mon Sep 17 00:00:00 2001
+From: Neil Schemenauer <nas@arctrix.com>
+Date: Mon, 6 May 2024 10:02:17 -0700
+Subject: [PATCH] Fix merge, move _PyMem_init_obmalloc() calls.
+
+---
+ Python/pylifecycle.c | 30 +++++++++++++++---------------
+ 1 file changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
+index fb833ba61cbd9b..31a24d4a65aebf 100644
+--- a/Python/pylifecycle.c
++++ b/Python/pylifecycle.c
+@@ -637,13 +637,6 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
+ return status;
+ }
+
+- // initialize the interp->obmalloc state. This must be done after
+- // the settings are loaded (so that feature_flags are set) but before
+- // any calls are made to obmalloc functions.
+- if (_PyMem_init_obmalloc(interp) < 0) {
+- return _PyStatus_NO_MEMORY();
+- }
+-
+ /* Auto-thread-state API */
+ status = _PyGILState_Init(interp);
+ if (_PyStatus_EXCEPTION(status)) {
+@@ -658,6 +651,13 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
+ return status;
+ }
+
++ // initialize the interp->obmalloc state. This must be done after
++ // the settings are loaded (so that feature_flags are set) but before
++ // any calls are made to obmalloc functions.
++ if (_PyMem_init_obmalloc(interp) < 0) {
++ return _PyStatus_NO_MEMORY();
++ }
++
+ PyThreadState *tstate = _PyThreadState_New(interp);
+ if (tstate == NULL) {
+ return _PyStatus_ERR("can't make first thread");
+@@ -2059,14 +2059,6 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config)
+ return _PyStatus_OK();
+ }
+
+- // initialize the interp->obmalloc state. This must be done after
+- // the settings are loaded (so that feature_flags are set) but before
+- // any calls are made to obmalloc functions.
+- if (_PyMem_init_obmalloc(interp) < 0) {
+- status = _PyStatus_NO_MEMORY();
+- goto error;
+- }
+-
+ PyThreadState *tstate = _PyThreadState_New(interp);
+ if (tstate == NULL) {
+ PyInterpreterState_Delete(interp);
+@@ -2110,6 +2102,14 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config)
+ goto error;
+ }
+
++ // initialize the interp->obmalloc state. This must be done after
++ // the settings are loaded (so that feature_flags are set) but before
++ // any calls are made to obmalloc functions.
++ if (_PyMem_init_obmalloc(interp) < 0) {
++ status = _PyStatus_NO_MEMORY();
++ goto error;
++ }
++
+ status = init_interp_create_gil(tstate, config->gil);
+ if (_PyStatus_EXCEPTION(status)) {
+ goto error;
diff --git a/tools/depends/target/python3/02-android-cpython114875.patch b/tools/depends/target/python3/02-android-cpython114875.patch
new file mode 100644
index 0000000000..edf2335a8f
--- /dev/null
+++ b/tools/depends/target/python3/02-android-cpython114875.patch
@@ -0,0 +1,36 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -4906,7 +4906,7 @@
+ copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
+ faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
+ fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
+- gai_strerror getegid getentropy geteuid getgid getgrgid getgrgid_r \
++ gai_strerror getegid getentropy geteuid getgid getgrent getgrgid getgrgid_r \
+ getgrnam_r getgrouplist getgroups gethostname getitimer getloadavg getlogin \
+ getpeername getpgid getpid getppid getpriority _getpty \
+ getpwent getpwnam_r getpwuid getpwuid_r getresgid getresuid getrusage getsid getspent \
+@@ -7445,7 +7445,9 @@
+ -a "$ac_cv_header_netinet_in_h" = "yes"]))
+
+ dnl platform specific extensions
+-PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
++PY_STDLIB_MOD([grp], [],
++ [test "$ac_cv_func_getgrent" = "yes" &&
++ { test "$ac_cv_func_getgrgid" = "yes" || test "$ac_cv_func_getgrgid_r" = "yes"; }])
+ PY_STDLIB_MOD([ossaudiodev],
+ [], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes],
+ [], [$OSSAUDIODEV_LIBS])
+diff --git a/pyconfig.h.in b/pyconfig.h.in
+index d8a9f68951afbd..36a46b1d14909f 100644
+--- a/pyconfig.h.in
++++ b/pyconfig.h.in
+@@ -477,6 +477,9 @@
+ /* Define to 1 if you have the `getgid' function. */
+ #undef HAVE_GETGID
+
++/* Define to 1 if you have the `getgrent' function. */
++#undef HAVE_GETGRENT
++
+ /* Define to 1 if you have the `getgrgid' function. */
+ #undef HAVE_GETGRGID
+
diff --git a/tools/depends/target/python3/10-linux-modules.patch b/tools/depends/target/python3/10-linux-modules.patch
deleted file mode 100644
index 97753d9aa7..0000000000
--- a/tools/depends/target/python3/10-linux-modules.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/Modules/Setup
-+++ b/Modules/Setup
-@@ -182,7 +182,7 @@
- # Modules with some UNIX dependencies
-
- _posixsubprocess _posixsubprocess.c
--_posixshmem -I$(srcdir)/Modules/_multiprocessing _multiprocessing/posixshmem.c # -lrt # _posixshmem
-+_posixshmem -I$(srcdir)/Modules/_multiprocessing _multiprocessing/posixshmem.c -lrt # _posixshmem
- fcntl fcntlmodule.c
- #grp grpmodule.c
- #ossaudiodev ossaudiodev.c
diff --git a/tools/depends/target/python3/10-osx-modules.patch b/tools/depends/target/python3/10-osx-modules.patch
deleted file mode 100644
index 8050f5ae5d..0000000000
--- a/tools/depends/target/python3/10-osx-modules.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/Modules/Setup
-+++ b/Modules/Setup
-@@ -270,7 +270,7 @@
-
- # macOS specific module, needs SystemConfiguration and CoreFoundation framework
- # _scproxy _scproxy.c
--$(OSX_SCPROXY)
-+_scproxy _scproxy.c -framework SystemConfiguration -framework CoreFoundation
-
- # Examples
-
diff --git a/tools/depends/target/python3/Makefile b/tools/depends/target/python3/Makefile
index 53942259aa..c8682f6029 100644
--- a/tools/depends/target/python3/Makefile
+++ b/tools/depends/target/python3/Makefile
@@ -1,16 +1,14 @@
include ../../Makefile.include PYTHON3-VERSION ../../download-files.include
DEPS = ../../Makefile.include Makefile PYTHON3-VERSION ../../download-files.include \
+ 01-py312-cpython118618-1.patch \
+ 01-py312-cpython118618-2.patch \
+ 02-android-cpython114875.patch \
apple.patch \
- crosscompile.patch \
darwin_embedded.patch \
- 10-android-modules.patch \
- 10-linux-modules.patch \
- 10-osx-modules.patch \
- modules.setup
+ 10-android-modules.patch
ifeq ($(findstring apple-darwin, $(HOST)), apple-darwin)
HOSTPLATFORM=_PYTHON_HOST_PLATFORM="darwin"
- LINK_ICONV=-liconv
ifeq ($(OS), darwin_embedded)
EXTRA_CONFIGURE=ac_cv_func_wait3=no ac_cv_func_wait4=no ac_cv_func_waitpid=no \
ac_cv_func_execv=no ac_cv_func_fexecv=no ac_cv_func_getentropy=no \
@@ -19,23 +17,64 @@ ifeq ($(findstring apple-darwin, $(HOST)), apple-darwin)
ac_cv_func_forkpty=no ac_cv_lib_util_forkpty=no \
ac_cv_func_getgroups=no \
ac_cv_func_system=no
+ export SDKROOT
+ endif
+ ifeq ($(OS), osx)
+ export SDKROOT
endif
# required for _localemodule
EXTRA_CONFIGURE+= ac_cv_lib_intl_textdomain=yes
- # uses SDK ffi
- EXTRA_CONFIGURE+= --with-system-ffi
endif
ifeq ($(OS),android)
- LDFLAGS+= -liconv
+ LIBS=-liconv
endif
ifeq ($(OS), linux)
EXTRA_CONFIGURE=ac_cv_pthread=yes
ifeq ($(TARGET_PLATFORM),webos)
- LDFLAGS+= -liconv
+ # Force intl check to succeed
+ EXTRA_CONFIGURE+=ac_cv_lib_intl_textdomain=yes
+ # Export iconv as LIBS for link ordering (After -lintl from configure search)
+ LIBS=-liconv
endif
+endif
+
+# Disabled c extension modules for all platforms
+PY_MODULES = py_cv_module_audioop=n/a \
+ py_cv_module_grp=n/a \
+ py_cv_module_ossaudiodev=n/a \
+ py_cv_module_spwd=n/a \
+ py_cv_module_syslog=n/a \
+ py_cv_module__crypt=n/a \
+ py_cv_module_nis=n/a \
+ py_cv_module__dbm=n/a \
+ py_cv_module__gdbm=n/a \
+ py_cv_module__uuid=n/a \
+ py_cv_module_readline=n/a \
+ py_cv_module__curses=n/a \
+ py_cv_module__curses_panel=n/a \
+ py_cv_module__scproxy=n/a \
+ py_cv_module_xx=n/a \
+ py_cv_module_xxlimited=n/a \
+ py_cv_module_xxlimited_35=n/a \
+ py_cv_module_xxsubtype=n/a \
+ py_cv_module__xxsubinterpreters=n/a \
+ py_cv_module__tkinter=n/a \
+ py_cv_module__curses=n/a \
+ py_cv_module__codecs_jp=n/a \
+ py_cv_module__codecs_kr=n/a \
+ py_cv_module__codecs_tw=n/a
+
+# These modules use "internal" libs for building. The required static archives
+# are not installed outside of the cpython build tree, and cause failure in kodi linking
+# If we wish to support them in the future, we should create "system libs" for them
+PY_MODULES+= py_cv_module__decimal=n/a \
+ py_cv_module__sha2=n/a
+
+ifeq ($(OS), darwin_embedded)
+ PY_MODULES+= py_cv_module__posixsubprocess=n/a
endif
# configuration settings
@@ -49,9 +88,11 @@ CONFIGURE=./configure --prefix=$(PREFIX) \
--with-system-expat=yes \
--disable-test-modules \
MODULE_BUILDTYPE=static \
+ $(PY_MODULES) \
$(EXTRA_CONFIGURE)
export LDFLAGS
+export LIBS
LIBDYLIB=$(PLATFORM)/libpython$(PYTHON_VERSION).a
@@ -60,32 +101,27 @@ all: .installed-$(PLATFORM)
$(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
- cd $(PLATFORM); patch -p1 -i ../crosscompile.patch
+ cd $(PLATFORM); patch -p1 -i ../01-py312-cpython118618-1.patch
+ cd $(PLATFORM); patch -p1 -i ../01-py312-cpython118618-2.patch
cd $(PLATFORM); patch -p1 -i ../apple.patch
ifeq ($(OS),darwin_embedded)
cd $(PLATFORM); patch -p1 -i ../darwin_embedded.patch
endif
- cp modules.setup $(PLATFORM)/Modules/Setup
ifeq ($(OS),android)
+ cd $(PLATFORM); patch -p1 -i ../02-android-cpython114875.patch
cd $(PLATFORM); patch -p1 -i ../10-android-modules.patch
endif
-ifeq ($(OS),linux)
- cd $(PLATFORM); patch -p1 -i ../10-linux-modules.patch
-endif
-ifeq ($(OS),osx)
- cd $(PLATFORM); patch -p1 -i ../10-osx-modules.patch
-endif
-
cd $(PLATFORM); $(AUTORECONF)
cd $(PLATFORM); $(CONFIGURE)
$(LIBDYLIB): $(PLATFORM)
- $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) CROSS_COMPILE_TARGET=yes libpython$(PYTHON_VERSION).a
+ $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) libpython$(PYTHON_VERSION).a
touch $@
.installed-$(PLATFORM): $(LIBDYLIB)
- $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) CROSS_COMPILE_TARGET=yes install
+# We specifically use -j1 as some threading issues can occur with install directory creation
+ $(MAKE) -C $(PLATFORM) $(HOSTPLATFORM) install -j1
find $(PREFIX)/lib/python$(PYTHON_VERSION) -type f -name "*.pyc" -delete
touch $(LIBDYLIB)
touch $@
diff --git a/tools/depends/target/python3/PYTHON3-VERSION b/tools/depends/target/python3/PYTHON3-VERSION
index c5e1760fb2..9c97bd4018 100644
--- a/tools/depends/target/python3/PYTHON3-VERSION
+++ b/tools/depends/target/python3/PYTHON3-VERSION
@@ -1,4 +1,4 @@
LIBNAME=Python
-VERSION=3.11.7
+VERSION=3.12.5
ARCHIVE=$(LIBNAME)-$(VERSION).tar.xz
-SHA512=11e06f2ffe1f66888cb5b4e9f607de815294d6863a77eda6ec6d7c724ef158df9f51881f4a956d4a6fa973c2fb6fd031d495e3496e9b0bb53793fb1cc8434c63
+SHA512=7a1c30d798434fe24697bc253f6010d75145e7650f66803328425c8525331b9fa6b63d12a652687582db205f8d4c8279c8f73c338168592481517b063351c921
diff --git a/tools/depends/target/python3/apple.patch b/tools/depends/target/python3/apple.patch
index 4deda311fb..1cad7696d2 100644
--- a/tools/depends/target/python3/apple.patch
+++ b/tools/depends/target/python3/apple.patch
@@ -28,12 +28,3 @@
# On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
# defining NI_NUMERICHOST.
QNX/6.3.2)
-@@ -2947,7 +2947,7 @@
- return 1;
- }
- }
-- ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
-+ ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=no])
-
- if test "${ac_osx_32bit}" = "yes"; then
- case `/usr/bin/arch` in
diff --git a/tools/depends/target/python3/crosscompile.patch b/tools/depends/target/python3/crosscompile.patch
deleted file mode 100644
index 6757c75ace..0000000000
--- a/tools/depends/target/python3/crosscompile.patch
+++ /dev/null
@@ -1,64 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -1625,15 +1625,6 @@
- ARFLAGS="rcs"
- fi
-
--AC_CHECK_TOOLS([READELF], [readelf], [:])
--if test "$cross_compiling" = yes; then
-- case "$READELF" in
-- readelf|:)
-- AC_MSG_ERROR([readelf for the host is required for cross builds])
-- ;;
-- esac
--fi
--AC_SUBST(READELF)
-
-
- case $MACHDEP in
---- a/Makefile.pre.in
-+++ b/Makefile.pre.in
-@@ -2233,10 +2233,11 @@
- # This goes into $(exec_prefix)
- sharedinstall: all
- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
-+ --skip-build \
- --prefix=$(prefix) \
-- --install-scripts=$(BINDIR) \
-- --install-platlib=$(DESTSHARED) \
-- --root=$(DESTDIR)/
-+ --install-scripts=$(DESTDIR)$(BINDIR) \
-+ --install-platlib=$(DESTDIR)$(DESTSHARED) \
-+ --root=/
- -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
- -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
-
---- a/setup.py
-+++ b/setup.py
-@@ -77,7 +77,7 @@
- return sys.platform
-
-
--CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ)
-+CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('CROSS_COMPILE_TARGET' in os.environ)
- HOST_PLATFORM = get_platform()
- MS_WINDOWS = (HOST_PLATFORM == 'win32')
- CYGWIN = (HOST_PLATFORM == 'cygwin')
-@@ -488,6 +488,7 @@
- self.compiler.set_executables(**args)
-
- def build_extensions(self):
-+ return
- self.set_srcdir()
- self.set_compiler_executables()
- self.configure_compiler()
-@@ -1343,7 +1343,7 @@
- # These are extensions are required to bootstrap the interpreter or
- # build process.
- self.detect_simple_extensions()
-- self.detect_test_extensions()
-+ #self.detect_test_extensions()
- self.detect_readline_curses()
- self.detect_crypt()
- self.detect_openssl_hashlib()
-
diff --git a/tools/depends/target/python3/darwin_embedded.patch b/tools/depends/target/python3/darwin_embedded.patch
index 77c9d0f30a..bd27f7ef1f 100644
--- a/tools/depends/target/python3/darwin_embedded.patch
+++ b/tools/depends/target/python3/darwin_embedded.patch
@@ -1,14 +1,3 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -6827,7 +6827,7 @@
- AS_CASE([$ac_sys_system],
- [AIX], [PY_STDLIB_MOD_SET_NA([_scproxy], [spwd])],
- [VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [_crypt], [termios], [grp])],
-- [Darwin], [PY_STDLIB_MOD_SET_NA([ossaudiodev], [spwd])],
-+ [Darwin], [PY_STDLIB_MOD_SET_NA([ossaudiodev], [spwd], [_posixsubprocess], [_scproxy], [_tkinter], [_xxsubinterpreters])],
- [CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])],
- [QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])],
- [FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy], [spwd])],
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -605,6 +605,7 @@
diff --git a/tools/depends/target/python3/modules.setup b/tools/depends/target/python3/modules.setup
deleted file mode 100644
index c974a066c9..0000000000
--- a/tools/depends/target/python3/modules.setup
+++ /dev/null
@@ -1,304 +0,0 @@
-# -*- makefile -*-
-# The file Setup is used by the makesetup script to construct the files
-# Makefile and config.c, from Makefile.pre and config.c.in,
-# respectively. Note that Makefile.pre is created from Makefile.pre.in
-# by the toplevel configure script.
-
-# (VPATH notes: Setup and Makefile.pre are in the build directory, as
-# are Makefile and config.c; the *.in files are in the source directory.)
-
-# Each line in this file describes one or more optional modules.
-# Modules configured here will not be compiled by the setup.py script,
-# so the file can be used to override setup.py's behavior.
-# Tag lines containing just the word "*static*", "*shared*" or "*disabled*"
-# (without the quotes but with the stars) are used to tag the following module
-# descriptions. Tag lines may alternate throughout this file. Modules are
-# built statically when they are preceded by a "*static*" tag line or when
-# there is no tag line between the start of the file and the module
-# description. Modules are built as a shared library when they are preceded by
-# a "*shared*" tag line. Modules are not built at all, not by the Makefile,
-# nor by the setup.py script, when they are preceded by a "*disabled*" tag
-# line.
-
-# Lines have the following structure:
-#
-# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...]
-#
-# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files)
-# <cpparg> is anything starting with -I, -D, -U or -C
-# <library> is anything ending in .a or beginning with -l or -L
-# <module> is anything else but should be a valid Python
-# identifier (letters, digits, underscores, beginning with non-digit)
-#
-# (As the makesetup script changes, it may recognize some other
-# arguments as well, e.g. *.so and *.sl as libraries. See the big
-# case statement in the makesetup script.)
-#
-# Lines can also have the form
-#
-# <name> = <value>
-#
-# which defines a Make variable definition inserted into Makefile.in.
-# You can also use any Make variable that is detected by configure and
-# defined in Makefile.pre.in, e.g. OpenSSL flags $(OPENSSL_INCLUDES).
-#
-# Rules generated by makesetup use additional variables:
-#
-# - All source file rules have a dependency on $(PYTHON_HEADERS) and on
-# optional variable $(MODULES_{mod_upper}_DEPS).
-# - If no <cpparg> and no <library> arguments are given, then makesetup
-# defaults to $(MODULES_{mod_upper}_CFLAGS) cppargs and
-# $(MODULES_{mod_upper}_LDFLAGS) libraries. The variables are typically
-# defined by configure.
-#
-# The build process works like this:
-#
-# 1. Build all modules that are declared as static in Modules/Setup,
-# combine them into libpythonxy.a, combine that into python.
-# 2. Build all modules that are listed as shared in Modules/Setup.
-# 3. Invoke setup.py. That builds all modules that
-# a) are not builtin, and
-# b) are not listed in Modules/Setup, and
-# c) can be build on the target
-#
-# Therefore, modules declared to be shared will not be
-# included in the config.c file, nor in the list of objects to be
-# added to the library archive, and their linker options won't be
-# added to the linker options. Rules to create their .o files and
-# their shared libraries will still be added to the Makefile, and
-# their names will be collected in the Make variable SHAREDMODS. This
-# is used to build modules as shared libraries. (They can be
-# installed using "make sharedinstall", which is implied by the
-# toplevel "make install" target.) (For compatibility,
-# *noconfig* has the same effect as *shared*.)
-#
-# NOTE: As a standard policy, as many modules as can be supported by a
-# platform should be listed below. The distribution comes with all
-# modules enabled that are supported by most platforms and don't
-# require you to download sources from elsewhere.
-#
-# NOTE: Avoid editing this file directly. Local changes should go into
-# Modules/Setup.local file. To enable all modules for testing, run
-#
-# sed -n -E 's/^#([a-z_\*].*)$/\1/p' Modules/Setup > Modules/Setup.local
-
-
-# Some special rules to define PYTHONPATH.
-# Edit the definitions below to indicate which options you are using.
-# Don't add any whitespace or comments!
-
-# Directories where library files get installed.
-# DESTLIB is for Python modules; MACHDESTLIB for shared libraries.
-DESTLIB=$(LIBDEST)
-MACHDESTLIB=$(BINLIBDEST)
-
-# NOTE: all the paths are now relative to the prefix that is computed
-# at run time!
-
-# Standard path -- don't edit.
-# No leading colon since this is the first entry.
-# Empty since this is now just the runtime prefix.
-DESTPATH=
-
-# Site specific path components -- should begin with : if non-empty
-SITEPATH=:site-packages
-
-# Standard path components for test modules
-TESTPATH=
-
-COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)
-PYTHONPATH=$(COREPYTHONPATH)
-
-
-# ---
-# Built-in modules required to get a functioning interpreter are listed in
-# Modules/Setup.bootstrap.
-
-# ---
-# The rest of the modules listed in this file are all commented out by
-# default. Usually they can be detected and built as dynamically
-# loaded modules by setup.py. If you're on a platform that doesn't
-# support dynamic loading, want to compile modules statically into the
-# Python binary, or need to specify some odd set of compiler switches,
-# you can uncomment the appropriate lines below.
-
-# Uncommenting the following line tells makesetup that all following
-# modules are to be built as shared libraries (see above for more
-# detail; also note that *static* or *disabled* cancels this effect):
-
-#*shared*
-
-# Modules that should always be present (POSIX and Windows):
-
-_asyncio _asynciomodule.c
-_bisect _bisectmodule.c
-_contextvars _contextvarsmodule.c
-_csv _csv.c
-_datetime _datetimemodule.c
-# _decimal _decimal/_decimal.c
-_heapq _heapqmodule.c
-_json _json.c
-_lsprof _lsprof.c rotatingtree.c
-_multiprocessing -I$(srcdir)/Modules/_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c
-_opcode _opcode.c
-_pickle _pickle.c
-_queue _queuemodule.c
-_random _randommodule.c
-_socket socketmodule.c
-_statistics _statisticsmodule.c
-_struct _struct.c
-_typing _typingmodule.c
-_zoneinfo _zoneinfo.c
-array arraymodule.c
-#audioop audioop.c
-binascii binascii.c
-cmath cmathmodule.c
-math mathmodule.c
-mmap mmapmodule.c
-select selectmodule.c
-
-# XML
-_elementtree _elementtree.c
-pyexpat pyexpat.c
-
-# hashing builtins
-_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
-_md5 md5module.c
-_sha1 sha1module.c
-_sha256 sha256module.c
-_sha512 sha512module.c
-_sha3 _sha3/sha3module.c
-
-# text encodings and unicode
-_codecs_cn cjkcodecs/_codecs_cn.c
-_codecs_hk cjkcodecs/_codecs_hk.c
-_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
-_codecs_jp cjkcodecs/_codecs_jp.c
-_codecs_kr cjkcodecs/_codecs_kr.c
-_codecs_tw cjkcodecs/_codecs_tw.c
-_multibytecodec cjkcodecs/multibytecodec.c
-unicodedata unicodedata.c
-
-# Modules with some UNIX dependencies
-
-_posixsubprocess _posixsubprocess.c
-_posixshmem -I$(srcdir)/Modules/_multiprocessing _multiprocessing/posixshmem.c # -lrt # _posixshmem
-fcntl fcntlmodule.c
-#grp grpmodule.c
-#ossaudiodev ossaudiodev.c
-resource resource.c
-#spwd spwdmodule.c
-#syslog syslogmodule.c
-termios termios.c
-
-# Modules with UNIX dependencies that require external libraries
-
-#_crypt _cryptmodule.c -lcrypt
-#nis nismodule.c -I/usr/include/tirpc -lnsl -ltirpc
-
-# Modules that require external libraries.
-
-_bz2 _bz2module.c -lbz2
-_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -I$(prefix)/include -L$(prefix)/lib -ldl -lffi -DHAVE_FFI_PREP_CIF_VAR -DHAVE_FFI_PREP_CLOSURE_LOC -DHAVE_FFI_CLOSURE_ALLOC
-# The _dbm module supports NDBM, GDBM with compat module, and Berkeley DB.
-#_dbm _dbmmodule.c -lgdbm_compat -DUSE_GDBM_COMPAT
-#_gdbm _gdbmmodule.c -lgdbm
-_lzma _lzmamodule.c -llzma
-#_uuid _uuidmodule.c -luuid
-zlib zlibmodule.c -lz
-
-_sqlite3 _sqlite/blob.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -lsqlite3
-
-# The readline module also supports libeditline (-leditline).
-# Some systems may require -ltermcap or -ltermlib.
-#readline readline.c -lreadline -ltermcap
-
-# OpenSSL bindings
-#_ssl _ssl.c $(OPENSSL_INCLUDES) $(OPENSSL_LDFLAGS) $(OPENSSL_LIBS)
-#_hashlib _hashopenssl.c $(OPENSSL_INCLUDES) $(OPENSSL_LDFLAGS) -lcrypto
-
-# To statically link OpenSSL:
- _ssl _ssl.c -I$(prefix)/include -I$(prefix)/include/openssl \
- -L$(prefix)/lib -lintl $(LDFLAGS) -lssl -lcrypto
- _hashlib _hashopenssl.c -I$(prefix)/include -I$(prefix)/include/openssl \
- -L$(prefix)/lib
-
-# The _tkinter module.
-#
-# The command for _tkinter is long and site specific. Please
-# uncomment and/or edit those parts as indicated. If you don't have a
-# specific extension (e.g. Tix or BLT), leave the corresponding line
-# commented out. (Leave the trailing backslashes in! If you
-# experience strange errors, you may want to join all uncommented
-# lines and remove the backslashes -- the backslash interpretation is
-# done by the shell's "read" command and it may not be implemented on
-# every system.
-
-# *** Always uncomment this (leave the leading underscore in!):
-#_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT $(TCLTK_INCLUDES) $(TCLTK_LIBS) \
-# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
-# -L/usr/local/lib \
-# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
-# -I/usr/local/include \
-# *** Uncomment and edit to reflect where your X11 header files are:
-# -I/usr/X11R6/include \
-# *** Or uncomment this for Solaris:
-# -I/usr/openwin/include \
-# *** Uncomment and edit for Tix extension only:
-# -DWITH_TIX -ltix8.1.8.2 \
-# *** Uncomment and edit for BLT extension only:
-# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
-# *** Uncomment and edit for PIL (TkImaging) extension only:
-# (See http://www.pythonware.com/products/pil/ for more info)
-# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
-# *** Uncomment and edit for TOGL extension only:
-# -DWITH_TOGL togl.c \
-# *** Uncomment and edit to reflect where your X11 libraries are:
-# -L/usr/X11R6/lib \
-# *** Or uncomment this for Solaris:
-# -L/usr/openwin/lib \
-# *** Uncomment these for TOGL extension only:
-# -lGL -lGLU -lXext -lXmu \
-# *** Uncomment for AIX:
-# -lld \
-# *** Always uncomment this; X11 libraries to link with:
-# -lX11
-
-# Some system have -lcurses
-#_curses -lncurses -lncursesw -ltermcap _cursesmodule.c
-#_curses_panel -lpanel -lncurses _curses_panel.c
-
-# macOS specific module, needs SystemConfiguration and CoreFoundation framework
-# _scproxy _scproxy.c
-$(OSX_SCPROXY)
-
-# Examples
-
-#xx xxmodule.c
-#xxlimited xxlimited.c
-#xxlimited_35 xxlimited_35.c
-xxsubtype xxsubtype.c # Required for the test suite to pass!
-
-# Testing
-
-#_xxsubinterpreters _xxsubinterpretersmodule.c
-#_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
-#_testbuffer _testbuffer.c
-#_testinternalcapi _testinternalcapi.c
-
-# Some testing modules MUST be built as shared libraries.
-
-#*shared*
-#_ctypes_test _ctypes/_ctypes_test.c
-#_testcapi _testcapimodule.c
-#_testimportmultiple _testimportmultiple.c
-#_testmultiphase _testmultiphase.c
-
-# ---
-# Uncommenting the following line tells makesetup that all following modules
-# are not built (see above for more detail).
-#
-#*disabled*
-#
-# _tkinter _curses
-# _codecs_jp _codecs_kr _codecs_tw
diff --git a/tools/depends/target/pythonmodule-setuptools/PYTHONMODULE-SETUPTOOLS-VERSION b/tools/depends/target/pythonmodule-setuptools/PYTHONMODULE-SETUPTOOLS-VERSION
index 1eca9e1bc0..1bf06499f3 100644
--- a/tools/depends/target/pythonmodule-setuptools/PYTHONMODULE-SETUPTOOLS-VERSION
+++ b/tools/depends/target/pythonmodule-setuptools/PYTHONMODULE-SETUPTOOLS-VERSION
@@ -1,4 +1,4 @@
LIBNAME=setuptools
-VERSION=65.5.0
+VERSION=72.1.0
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
-SHA512=b3ed6546bfa45c96f9b69fd7f014a87b52e6d8a6591340bf980bd4de98e33dbe0990b089940c348f2ad20a27590b82de84aec44c8ba1dce0510a3835653930d3
+SHA512=d0a34f16dfa6bb9a6df39076cd43528cf854d343f6f801c448ea0ebab2a259aec3d03571e2a26709df6082ed2fcb6c43b86448be556fd559b6af41831b4f38e0
diff --git a/tools/depends/target/samba-gplv3/08-py312-distutils.patch b/tools/depends/target/samba-gplv3/08-py312-distutils.patch
new file mode 100644
index 0000000000..6ddb5f02a1
--- /dev/null
+++ b/tools/depends/target/samba-gplv3/08-py312-distutils.patch
@@ -0,0 +1,11 @@
+--- a/third_party/waf/waflib/Tools/python.py
++++ b/third_party/waf/waflib/Tools/python.py
+@@ -53,7 +53,7 @@
+ Piece of Python code used in :py:class:`waflib.Tools.python.pyo` and :py:class:`waflib.Tools.python.pyc` for byte-compiling python files
+ """
+
+-DISTUTILS_IMP = ['from distutils.sysconfig import get_config_var, get_python_lib']
++DISTUTILS_IMP = ['import setuptools\nfrom distutils.sysconfig import get_config_var, get_python_lib']
+
+ @before_method('process_source')
+ @feature('py')
diff --git a/tools/depends/target/samba-gplv3/Makefile b/tools/depends/target/samba-gplv3/Makefile
index 20a77dfe42..b089dbd563 100644
--- a/tools/depends/target/samba-gplv3/Makefile
+++ b/tools/depends/target/samba-gplv3/Makefile
@@ -3,6 +3,7 @@ DEPS= ../../Makefile.include Makefile SAMBA-GPLV3-VERSION ../../download-files.i
01-fix-dependencies.patch 02-cross_compile.patch \
03-builtin-heimdal.patch 04-built-static.patch \
05-apple-disable-zlib-pkgconfig.patch 06-apple-fix-st_atim.patch \
+ 08-py312-distutils.patch \
samba_android.patch \
no_fork_and_exec.patch \
crt_extensions.patch \
@@ -89,6 +90,7 @@ endif
ifeq ($(TARGET_PLATFORM),webos)
cd $(PLATFORM); patch -p1 -i ../webos-no-readline.patch
endif
+ cd $(PLATFORM); patch -p1 -i ../08-py312-distutils.patch
cd $(PLATFORM); $(CONFIGURE)
$(LIBDYLIB): $(PLATFORM)