]> git.webhop.me Git - bs-cst-neutrino-hd.git/commitdiff
introduce python3.11; bump version libffi-3.4.2
authorMarkham <markham001@gmx.de>
Thu, 29 Feb 2024 18:03:56 +0000 (19:03 +0100)
committerMarkham <markham001@gmx.de>
Thu, 29 Feb 2024 18:03:56 +0000 (19:03 +0100)
44 files changed:
Makefile
archive-patches/libffi-3.2.1.patch [deleted file]
archive-patches/libffi/patches/0001-Fix-installation-location-of-libffi.patch [new file with mode: 0644]
archive-patches/libffi/patches/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch [new file with mode: 0644]
archive-patches/libffi/patches/0003-libffi-enable-hardfloat-in-the-MIPS-assembly-code.patch [new file with mode: 0644]
archive-patches/python3/files/python-venv [new file with mode: 0644]
archive-patches/python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch [new file with mode: 0644]
archive-patches/python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch [new file with mode: 0644]
archive-patches/python3/patches/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch [new file with mode: 0644]
archive-patches/python3/patches/0004-Adjust-library-header-paths-for-cross-compilation.patch [new file with mode: 0644]
archive-patches/python3/patches/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch [new file with mode: 0644]
archive-patches/python3/patches/0006-Don-t-add-multiarch-paths.patch [new file with mode: 0644]
archive-patches/python3/patches/0007-Abort-on-failed-module-build.patch [new file with mode: 0644]
archive-patches/python3/patches/0008-Serial-ioctl-workaround.patch [new file with mode: 0644]
archive-patches/python3/patches/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch [new file with mode: 0644]
archive-patches/python3/patches/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch [new file with mode: 0644]
archive-patches/python3/patches/0011-Add-an-option-to-disable-pydoc.patch [new file with mode: 0644]
archive-patches/python3/patches/0012-Add-an-option-to-disable-lib2to3.patch [new file with mode: 0644]
archive-patches/python3/patches/0013-Add-option-to-disable-the-sqlite3-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0014-Add-an-option-to-disable-the-tk-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0015-Add-an-option-to-disable-the-curses-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0016-Add-an-option-to-disable-expat.patch [new file with mode: 0644]
archive-patches/python3/patches/0017-Add-an-option-to-disable-CJK-codecs.patch [new file with mode: 0644]
archive-patches/python3/patches/0018-Add-an-option-to-disable-NIS.patch [new file with mode: 0644]
archive-patches/python3/patches/0019-Add-an-option-to-disable-unicodedata.patch [new file with mode: 0644]
archive-patches/python3/patches/0020-Add-an-option-to-disable-IDLE.patch [new file with mode: 0644]
archive-patches/python3/patches/0021-Add-an-option-to-disable-decimal.patch [new file with mode: 0644]
archive-patches/python3/patches/0022-Add-an-option-to-disable-the-ossaudiodev-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0023-Add-an-option-to-disable-openssl-support.patch [new file with mode: 0644]
archive-patches/python3/patches/0024-Add-an-option-to-disable-the-readline-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch [new file with mode: 0644]
archive-patches/python3/patches/0026-python-config.sh-don-t-reassign-prefix.patch [new file with mode: 0644]
archive-patches/python3/patches/0027-Add-an-option-to-disable-uuid-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0028-fix-building-on-older-distributions.patch [new file with mode: 0644]
archive-patches/python3/patches/0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch [new file with mode: 0644]
archive-patches/python3/patches/0030-Add-an-option-to-disable-the-berkeleydb-module.patch [new file with mode: 0644]
archive-patches/python3/patches/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch [new file with mode: 0644]
archive-patches/python3/patches/0100-use-legacy-path-for-pycs.patch [new file with mode: 0644]
make/archives.mk
make/environment-build.mk
make/libraries.mk
make/python3.mk [new file with mode: 0644]
make/rootfs.mk
make/versions.mk

index e6b9677b96117f197fbab2588a7769c5eabb33aa..c71d285be94b513269b3da33ea353da91199f64b 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -45,8 +45,9 @@ include make/flashimage.mk
 include make/cleantargets.mk
 include make/ffmpeg.mk
 include make/meson.mk
+include make/python3.mk
 
-PARALLEL_JOBS := $(shell echo $$((1 + `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
+PARALLEL_JOBS := $(shell echo $$(($$(nproc 2>/dev/null || echo 0) + 1)))
 override MAKE = make $(if $(findstring j,$(filter-out --%,$(MAKEFLAGS))),,-j$(PARALLEL_JOBS)) $(SILENT_OPT)
 
 ############################################################################
diff --git a/archive-patches/libffi-3.2.1.patch b/archive-patches/libffi-3.2.1.patch
deleted file mode 100644 (file)
index d2bf723..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-Submitted By:            Armin K. <krejzi at email dot com>
-Date:                    2012-03-29
-Initial Package Version: 3.0.10
-Upstream Status:         Not Submitted
-Origin:                  Self
-Description:             Makes package install headers into /usr/include instead 
-                         of /usr/lib/libffi-3.0.10/include
-
---- libffi.orig/include/Makefile.in    2011-08-23 16:28:35.000000000 +0200
-+++ libffi/include/Makefile.in 2012-03-29 19:57:53.919343783 +0200
-@@ -314,7 +314,7 @@
- AUTOMAKE_OPTIONS = foreign
- DISTCLEANFILES = ffitarget.h
- EXTRA_DIST = ffi.h.in ffi_common.h
--includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
-+includesdir = $(includedir)
- nodist_includes_HEADERS = ffi.h ffitarget.h
- all: all-am
---- libffi.orig/libffi.pc.in   2011-08-22 20:38:12.000000000 +0200
-+++ libffi/libffi.pc.in        2012-03-29 19:57:18.263549738 +0200
-@@ -2,10 +2,10 @@
- exec_prefix=@exec_prefix@
- libdir=@libdir@
- toolexeclibdir=@toolexeclibdir@
--includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
-+includedir=@includedir@
- Name: @PACKAGE_NAME@
- Description: Library supporting Foreign Function Interfaces
- Version: @PACKAGE_VERSION@
- Libs: -L${toolexeclibdir} -lffi
--Cflags: -I${includedir}
-+Cflags 
diff --git a/archive-patches/libffi/patches/0001-Fix-installation-location-of-libffi.patch b/archive-patches/libffi/patches/0001-Fix-installation-location-of-libffi.patch
new file mode 100644 (file)
index 0000000..6ac9123
--- /dev/null
@@ -0,0 +1,55 @@
+From 580f46a7bc6e9fea3a2227b5268cc3aed1d60e3b Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 7 Feb 2013 22:26:56 +0100
+Subject: [PATCH] Fix installation location of libffi
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The libffi is currently declared as toolexeclib_LTLIBRARIES. In many
+cases, toolexeclib libraries will be installed in /usr/lib, so it
+doesn't make any difference.
+
+However, with multilib toolchains, they get installed in a
+subdirectory of /usr/lib/. For example, with a Sourcery CodeBench
+PowerPC toolchain, if the e500mc multilib variant is used, the libffi
+library gets installed in /usr/lib/te500mc/. This is due to the
+following code in the configure script:
+
+  multi_os_directory=`$CC -print-multi-os-directory`
+  case $multi_os_directory in
+    .) ;; # Avoid trailing /.
+    *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+  esac
+
+Once the library is installed in /usr/lib/te500mc/, nothing works
+because this installation location is inconsistent with the
+installation location declared in libffi.pc.
+
+So, instead of using this bizarre toolexeclib_LTLIBRARIES, simply use
+the more standard lib_LTLIBRARIES, which ensures that the libffi
+library is always installed in /usr/lib.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[unfuzz for 3.2.1]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 0e40451..309474c 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -104,7 +104,7 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
+ MAKEOVERRIDES=
+-toolexeclib_LTLIBRARIES = libffi.la
++lib_LTLIBRARIES = libffi.la
+ noinst_LTLIBRARIES = libffi_convenience.la
+ libffi_la_SOURCES = src/prep_cif.c src/types.c \
+-- 
+2.5.3
+
diff --git a/archive-patches/libffi/patches/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch b/archive-patches/libffi/patches/0002-Fix-use-of-compact-eh-frames-on-MIPS.patch
new file mode 100644 (file)
index 0000000..c19e395
--- /dev/null
@@ -0,0 +1,45 @@
+From 31b6b6bc14197cd4183bdbd311fddeb36b5ae100 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
+Date: Sat, 19 Sep 2015 22:53:29 +0200
+Subject: [PATCH] Fix use of compact eh frames on MIPS
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Newer MIPS toolchains use a different (compact) eh_frame format.
+libffi don't like them, so we have to switch to the older format.
+
+This patch add -mno-compact-eh to CFLAGS when compiling for
+Mips and compiler support it.
+
+Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
+[unfuzz for 3.2.1]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+---
+ configure.ac | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index a7bf5ee..36cd0d4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -469,6 +469,16 @@ esac
+ AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
+ AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)
++if test x$TARGET = xMIPS; then
++    save_CFLAGS="$CFLAGS"
++    CFLAGS=-mno-compact-eh
++    AC_MSG_CHECKING([whether the C compiler needs -mno-compact-eh])
++    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
++                      [AC_MSG_RESULT([yes])]; [save_CFLAGS="$save_CFLAGS -mno-compact-eh"],
++                      [AC_MSG_RESULT([no])])
++    CFLAGS="$save_CFLAGS"
++fi
++
+ if test x$TARGET = xX86_64; then
+     AC_CACHE_CHECK([toolchain supports unwind section type],
+       libffi_cv_as_x86_64_unwind_section_type, [
+-- 
+2.5.3
+
diff --git a/archive-patches/libffi/patches/0003-libffi-enable-hardfloat-in-the-MIPS-assembly-code.patch b/archive-patches/libffi/patches/0003-libffi-enable-hardfloat-in-the-MIPS-assembly-code.patch
new file mode 100644 (file)
index 0000000..168972a
--- /dev/null
@@ -0,0 +1,44 @@
+From 48bc37fabbc685b1e3293055bd33ca66c619305e Mon Sep 17 00:00:00 2001
+From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+Date: Wed, 13 Jan 2016 14:49:59 +0000
+Subject: [PATCH] libffi: enable hardfloat in the MIPS assembly code
+
+This way it will be possible to build it for soft-float. This is only a
+temporary fix. The package needs to be fixed properly.
+
+Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+[Update for 3.3-rc0]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/mips/n32.S | 1 +
+ src/mips/o32.S | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/mips/n32.S b/src/mips/n32.S
+index c6985d3..dc842d5 100644
+--- a/src/mips/n32.S
++++ b/src/mips/n32.S
+@@ -44,6 +44,7 @@
+ #endif
+ #if !defined(__mips_isa_rev) || (__mips_isa_rev<6)
+       .set mips4
+ #endif
++      .set hardfloat
+       .text
+       .align  2
+       .globl  ffi_call_N32
+diff --git a/src/mips/o32.S b/src/mips/o32.S
+index eb27981..b653daf 100644
+--- a/src/mips/o32.S
++++ b/src/mips/o32.S
+@@ -42,6 +42,7 @@
+ #define RA_OFF                (SIZEOF_FRAME - 1 * FFI_SIZEOF_ARG)
+       .abicalls
++      .set hardfloat
+       .text
+       .align  2
+       .globl  ffi_call_O32
+-- 
+2.4.10
+
diff --git a/archive-patches/python3/files/python-venv b/archive-patches/python3/files/python-venv
new file mode 100644 (file)
index 0000000..fc25487
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. /etc/init.d/globals
+
+if [ ! -e ~/venv ]; then
+       echo "Creating Python's virtual environment."
+       echo "This will take a few seconds ..."
+       python -m venv --system-site-packages ~/venv
+fi
+
+echo "Type 'source ~/venv/bin/activate' to activate Python's virtual environment."
+echo "To leave the virtual environment type 'deactivate' in the terminal."
diff --git a/archive-patches/python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch b/archive-patches/python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch
new file mode 100644 (file)
index 0000000..92aa727
--- /dev/null
@@ -0,0 +1,56 @@
+From 51ed7f93cc0333efa8fccd9b88db713c48993df9 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 16:21:31 -0800
+Subject: [PATCH] Make the build of pyc files conditional
+
+This commit adds a new configure option --disable-pyc-build to disable
+the compilation of pyc.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[ Andrey Smrinov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 2 ++
+ configure.ac    | 6 ++++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 8fbcd7ac17..2957c8e5a1 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -2078,6 +2078,7 @@ libinstall:      all $(srcdir)/Modules/xxmodule.c
+               $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+                       $(DESTDIR)$(LIBDEST)/distutils/tests ; \
+       fi
++ifeq (@PYC_BUILD@,yes)
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+               $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+               -j0 -d $(LIBDEST) -f \
+@@ -2105,6 +2106,7 @@ libinstall:      all $(srcdir)/Modules/xxmodule.c
+               $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
+               -j0 -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
++endif
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+               $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+diff --git a/configure.ac b/configure.ac
+index ab5e1de6fa..0cf89ed641 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1441,6 +1441,12 @@ fi
+ AC_MSG_CHECKING(LDLIBRARY)
++AC_SUBST(PYC_BUILD)
++
++AC_ARG_ENABLE(pyc-build,
++      AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
++      [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
++
+ # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
+ # library that we build, but we do not want to link against it (we
+ # will find it with a -framework option). For this reason there is an
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch b/archive-patches/python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch
new file mode 100644 (file)
index 0000000..5389cb5
--- /dev/null
@@ -0,0 +1,27 @@
+From b180ab302e2a82be239af334382436628b81381e Mon Sep 17 00:00:00 2001
+From: Vanya Sergeev <vsergeev@gmail.com>
+Date: Wed, 23 Dec 2015 11:30:33 +0100
+Subject: [PATCH] Disable buggy_getaddrinfo configure test when cross-compiling
+ with IPv6 support
+
+Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0cf89ed641..830885fcb3 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -5086,7 +5086,7 @@ fi]))
+ dnl if ac_cv_func_getaddrinfo
+ ])
+-if test "$ac_cv_func_getaddrinfo" = no -o "$ac_cv_buggy_getaddrinfo" = yes
++if test "$ac_cv_func_getaddrinfo" = no || test "$cross_compiling" != "yes" -a "$ac_cv_buggy_getaddrinfo" = yes
+ then
+   AS_VAR_IF([ipv6], [yes], [
+     AC_MSG_ERROR([m4_normalize([
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch b/archive-patches/python3/patches/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch
new file mode 100644 (file)
index 0000000..5b39113
--- /dev/null
@@ -0,0 +1,108 @@
+From 8e02cebdac536dfb6748da2c50656a26f70d9da7 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 16:33:22 -0800
+Subject: [PATCH] Add infrastructure to disable the build of certain extensions
+
+Some of the extensions part of the Python core have dependencies on
+external libraries (sqlite, tk, etc.) or are relatively big and not
+necessarly always useful (CJK codecs for example). By extensions, we
+mean part of Python modules that are written in C and therefore
+compiled to binary code.
+
+Therefore, we introduce a small infrastructure that allows to disable
+some of those extensions. This can be done inside the configure.ac by
+adding values to the DISABLED_EXTENSIONS variable (which is a
+word-separated list of extensions).
+
+The implementation works as follow :
+
+ * configure.ac defines a DISABLED_EXTENSIONS variable, which is
+   substituted (so that when Makefile.pre is generated from
+   Makefile.pre.in, the value of the variable is substituted). For
+   now, this DISABLED_EXTENSIONS variable is empty, later patches will
+   use it.
+
+ * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
+   variables passed in the environment when calling the setup.py
+   script that actually builds and installs those extensions.
+
+ * setup.py is modified so that the existing "disabled_module_list" is
+   filled with those pre-disabled extensions listed in
+   DISABLED_EXTENSIONS.
+
+Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
+then extended by Thomas Petazzoni
+<thomas.petazzoni@free-electrons.com>.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Makefile.pre.in | 6 +++++-
+ configure.ac    | 2 ++
+ setup.py        | 5 ++++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 2957c8e5a1..c1cfb96767 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -239,6 +239,8 @@ FILEMODE=  644
+ # configure script arguments
+ CONFIG_ARGS=  @CONFIG_ARGS@
++# disabled extensions
++DISABLED_EXTENSIONS=  @DISABLED_EXTENSIONS@
+ # Subdirectories with code
+ SRCDIRS=      @SRCDIRS@
+@@ -739,6 +741,7 @@ sharedmods: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPA
+           *) quiet="";; \
+       esac; \
+       echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
++              DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
+               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
+       $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+               $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+@@ -2228,7 +2231,8 @@ libainstall: all python-config
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall: all
+-      $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
++      $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
++              $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
+               --prefix=$(prefix) \
+               --install-scripts=$(BINDIR) \
+               --install-platlib=$(DESTSHARED) \
+diff --git a/configure.ac b/configure.ac
+index 830885fcb3..5a6a1fe608 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3562,6 +3562,8 @@ LIBS="$withval $LIBS"
+ ],
+ [AC_MSG_RESULT(no)])
++AC_SUBST(DISABLED_EXTENSIONS)
++
+ # Check for use of the system expat library
+ AC_MSG_CHECKING(for --with-system-expat)
+ AC_ARG_WITH(system_expat,
+diff --git a/setup.py b/setup.py
+index 15d0d4576a..e496ee34c2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -56,7 +56,10 @@
+ # This global variable is used to hold the list of modules to be disabled.
+-DISABLED_MODULE_LIST = []
++try:
++    DISABLED_MODULE_LIST = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
++except KeyError:
++    DISABLED_MODULE_LIST = list()
+ # --list-module-names option used by Tools/scripts/generate_module_names.py
+ LIST_MODULE_NAMES = False
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0004-Adjust-library-header-paths-for-cross-compilation.patch b/archive-patches/python3/patches/0004-Adjust-library-header-paths-for-cross-compilation.patch
new file mode 100644 (file)
index 0000000..9a55d25
--- /dev/null
@@ -0,0 +1,69 @@
+From 132b9dca3bb4d4682f7e318648ce11e1abb31b62 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:33:14 +0100
+Subject: [PATCH] Adjust library/header paths for cross-compilation
+
+When cross-compiling third-party extensions, the get_python_inc() or
+get_python_lib() can be called, to return the path to headers or
+libraries. However, they use the sys.prefix of the host Python, which
+returns incorrect paths when cross-compiling (paths pointing to host
+headers and libraries).
+
+In order to fix this, we introduce the _python_sysroot, _python_prefix
+and _python_exec_prefix variables, that allow to override these
+values, and get correct header/library paths when cross-compiling
+third-party Python modules.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+Refresh for 3.10.0
+---
+ Lib/distutils/command/build_ext.py |  5 ++++-
+ Lib/sysconfig.py                   | 15 +++++++++++----
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
+index f287b34998..298234d6a1 100644
+--- a/Lib/distutils/command/build_ext.py
++++ b/Lib/distutils/command/build_ext.py
+@@ -234,7 +234,10 @@ def finalize_options(self):
+         if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
+             if not sysconfig.python_build:
+                 # building third party extensions
+-                self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
++                libdir = sysconfig.get_config_var('LIBDIR')
++                if "_python_sysroot" in os.environ:
++                    libdir = os.environ.get("_python_sysroot") + libdir
++                self.library_dirs.append(libdir)
+             else:
+                 # building python standard extensions
+                 self.library_dirs.append('.')
+diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
+index ebe3711827..6328ec41af 100644
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -168,10 +168,17 @@ def joinuser(*args):
+ _PY_VERSION = sys.version.split()[0]
+ _PY_VERSION_SHORT = f'{sys.version_info[0]}.{sys.version_info[1]}'
+ _PY_VERSION_SHORT_NO_DOT = f'{sys.version_info[0]}{sys.version_info[1]}'
+-_PREFIX = os.path.normpath(sys.prefix)
+-_BASE_PREFIX = os.path.normpath(sys.base_prefix)
+-_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+-_BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
++if "_python_sysroot" in os.environ:
++    _sysroot=os.environ.get('_python_sysroot')
++    _PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
++    _EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
++    _BASE_PREFIX = _PREFIX
++    _BASE_EXEC_PREFIX = _EXEC_PREFIX
++else:
++    _PREFIX = os.path.normpath(sys.prefix)
++    _EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
++    _BASE_PREFIX = os.path.normpath(sys.base_prefix)
++    _BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
+ _CONFIG_VARS = None
+ _USER_BASE = None
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch b/archive-patches/python3/patches/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch
new file mode 100644 (file)
index 0000000..78b3ae5
--- /dev/null
@@ -0,0 +1,31 @@
+From 5d13e384b30a2c0b1c7b65718590b7fb0c3ba55e Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:36:00 +0100
+Subject: [PATCH] Don't look in /usr/lib/termcap for libraries
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index e496ee34c2..1904898165 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1107,12 +1107,9 @@ def detect_readline_curses(self):
+                 pass # Issue 7384: Already linked against curses or tinfo.
+             elif curses_library:
+                 readline_libs.append(curses_library)
+-            elif self.compiler.find_library_file(self.lib_dirs +
+-                                                     ['/usr/lib/termcap'],
+-                                                     'termcap'):
++            elif self.compiler.find_library_file(self.lib_dirs, 'termcap'):
+                 readline_libs.append('termcap')
+             self.add(Extension('readline', ['readline.c'],
+-                               library_dirs=['/usr/lib/termcap'],
+                                libraries=readline_libs))
+         else:
+             self.missing.append('readline')
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0006-Don-t-add-multiarch-paths.patch b/archive-patches/python3/patches/0006-Don-t-add-multiarch-paths.patch
new file mode 100644 (file)
index 0000000..749e295
--- /dev/null
@@ -0,0 +1,37 @@
+From ad463b5d58ae79f69b011fb048861bd874d34369 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:36:27 +0100
+Subject: [PATCH] Don't add multiarch paths
+
+The add_multiarch_paths() function leads, in certain build
+environments, to the addition of host header paths to the CFLAGS,
+which is not appropriate for cross-compilation. This patch fixes that
+by simply removing the call to add_multiarch_paths() when we're
+cross-compiling.
+
+Investigation done by David <buildroot-2014@inbox.com>.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 1904898165..32294546b6 100644
+--- a/setup.py
++++ b/setup.py
+@@ -852,10 +852,10 @@ def configure_compiler(self):
+         if not CROSS_COMPILING:
+             add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++            self.add_multiarch_paths()
+         # only change this for cross builds for 3.3, issues on Mageia
+         if CROSS_COMPILING:
+             self.add_cross_compiling_paths()
+-        self.add_multiarch_paths()
+         self.add_ldflags_cppflags()
+     def init_inc_lib_dirs(self):
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0007-Abort-on-failed-module-build.patch b/archive-patches/python3/patches/0007-Abort-on-failed-module-build.patch
new file mode 100644 (file)
index 0000000..a473896
--- /dev/null
@@ -0,0 +1,30 @@
+From 60b1664a7acebadb1a3d6df871145147f33b5afe Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:43:24 +0100
+Subject: [PATCH] Abort on failed module build
+
+When building a Python module fails, the setup.py script currently
+doesn't exit with an error, and simply continues. This is not a really
+nice behavior, so this patch changes setup.py to abort with an error,
+so that the build issue is clearly noticeable.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ setup.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/setup.py b/setup.py
+index 32294546b6..0e04944ce0 100644
+--- a/setup.py
++++ b/setup.py
+@@ -579,6 +579,7 @@ def print_three_column(lst):
+             print("Failed to build these modules:")
+             print_three_column(failed)
+             print()
++            sys.exit(1)
+         if self.failed_on_import:
+             failed = self.failed_on_import[:]
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0008-Serial-ioctl-workaround.patch b/archive-patches/python3/patches/0008-Serial-ioctl-workaround.patch
new file mode 100644 (file)
index 0000000..7722a04
--- /dev/null
@@ -0,0 +1,33 @@
+From 90f3075b629d90d942da1d22ef7563f7149f4f6c Mon Sep 17 00:00:00 2001
+From: Baruch Siach <baruch@tkos.co.il>
+Date: Wed, 23 Dec 2015 11:44:02 +0100
+Subject: [PATCH] Serial ioctl() workaround
+
+The ioctls.h of some architectures (notably xtensa) references structs from
+linux/serial.h. Make sure to include this header as well.
+
+Also, undef TIOCTTYGSTRUCT that require reference to internal kernel tty_struct,
+but isn't actually referenced in modern kernels.
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+ Modules/termios.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Modules/termios.c b/Modules/termios.c
+index 354e5ca18d..c08957c500 100644
+--- a/Modules/termios.c
++++ b/Modules/termios.c
+@@ -15,7 +15,9 @@
+ #endif
+ #include <termios.h>
++#include <linux/serial.h>
+ #include <sys/ioctl.h>
++#undef TIOCTTYGSTRUCT
+ /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR,
+  * MDTR, MRI, and MRTS (apparently used internally by some things
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch b/archive-patches/python3/patches/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch
new file mode 100644 (file)
index 0000000..eff8fc7
--- /dev/null
@@ -0,0 +1,35 @@
+From 2439bd2ed5dbdd7e5fda15adefd0f6f1b047ec1b Mon Sep 17 00:00:00 2001
+From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+Date: Wed, 23 Dec 2015 11:44:30 +0100
+Subject: [PATCH] Do not adjust the shebang of Python scripts for
+ cross-compilation
+
+The copy_scripts() method in distutils copies the scripts listed in
+the setup file and adjusts the first line to refer to the current
+Python interpreter. When cross-compiling, this means that the adjusted
+shebang refers to the host Python interpreter.
+
+This patch modifies copy_scripts() to preserve the shebang when
+cross-compilation is detected.
+
+Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+---
+ Lib/distutils/command/build_scripts.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
+index ccc70e6465..d6d54195c1 100644
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -91,7 +91,7 @@ def copy_scripts(self):
+                     adjust = True
+                     post_interp = match.group(1) or b''
+-            if adjust:
++            if adjust and not '_python_sysroot' in os.environ:
+                 log.info("copying and adjusting %s -> %s", script,
+                          self.build_dir)
+                 updated_files.append(outfile)
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch b/archive-patches/python3/patches/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch
new file mode 100644 (file)
index 0000000..f26ee85
--- /dev/null
@@ -0,0 +1,67 @@
+From 55ef5552e4ee60266e3299f253bec3b13785e585 Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <peter@korsgaard.com>
+Date: Thu, 20 Nov 2014 13:24:59 +0100
+Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match
+ beginning of strings
+
+The build/real prefix handling using sed breaks if build != real and the
+standard include / lib directories are used ($prefix/include and $prefix/lib).
+
+E.G.
+
+prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include".
+
+If this gets installed with make DESTDIR="/foo" install, then we end up with
+prefix_real = prefix = "/foo/usr" as expected, but
+includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of
+the double sed invocation (prefix is already expanded).  Work around it by
+ensuring we only match the beginning of the string.
+
+Submitted upstream: http://bugs.python.org/issue22907
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+ Misc/python-config.sh.in | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
+index 2602fe24c0..a1bc3cd5f7 100644
+--- a/Misc/python-config.sh.in
++++ b/Misc/python-config.sh.in
+@@ -24,18 +24,19 @@ installed_prefix ()
+     echo $RESULT
+ }
++prefix_build="@prefix@"
+ prefix_real=$(installed_prefix "$0")
+ # Use sed to fix paths from their built-to locations to their installed-to
+ # locations. Keep prefix & exec_prefix using their original values in case
+ # they are referenced in other configure variables, to prevent double
+ # substitution, issue #22140.
+-prefix="@prefix@"
+-exec_prefix="@exec_prefix@"
++prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
++exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
+ exec_prefix_real=${prefix_real}
+-includedir=$(echo "@includedir@" | sed "s#$prefix#$prefix_real#")
+-libdir=$(echo "@libdir@" | sed "s#$prefix#$prefix_real#")
+-CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix#$prefix_real#")
++includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
++libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#")
++CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#")
+ VERSION="@VERSION@"
+ LIBM="@LIBM@"
+ LIBC="@LIBC@"
+@@ -49,7 +50,7 @@ OPT="@OPT@"
+ PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
+ LDVERSION="@LDVERSION@"
+ LIBDEST=${prefix_real}/lib/python${VERSION}
+-LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#")
++LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
+ SO="@EXT_SUFFIX@"
+ PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
+ INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0011-Add-an-option-to-disable-pydoc.patch b/archive-patches/python3/patches/0011-Add-an-option-to-disable-pydoc.patch
new file mode 100644 (file)
index 0000000..f7bfd43
--- /dev/null
@@ -0,0 +1,100 @@
+From 38b7f7949258aeadf8bc45525be91340bb732a2a Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:07:56 -0800
+Subject: [PATCH] Add an option to disable pydoc
+
+It removes 0.5 MB of data from the target plus the pydoc script
+itself.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ Makefile.pre.in | 7 ++++++-
+ configure.ac    | 6 ++++++
+ setup.py        | 9 +++++++--
+ 3 files changed, 19 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index c1cfb96767..403380e181 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1864,7 +1864,9 @@ bininstall: altbininstall
+       -rm -f $(DESTDIR)$(BINDIR)/idle3
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
+       -rm -f $(DESTDIR)$(BINDIR)/pydoc3
++ifeq (@PYDOC@,yes)
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
++endif
+       -rm -f $(DESTDIR)$(BINDIR)/2to3
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
+       if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
+@@ -1915,7 +1917,6 @@ LIBSUBDIRS=      asyncio \
+               lib2to3 lib2to3/fixes lib2to3/pgen2 \
+               logging \
+               multiprocessing multiprocessing/dummy \
+-              pydoc_data \
+               re \
+               site-packages \
+               sqlite3 \
+@@ -2008,6 +2009,10 @@ TESTSUBDIRS=    ctypes/test \
+               tkinter/test/test_ttk \
+               unittest/test unittest/test/testmock
++ifeq (@PYDOC@,yes)
++LIBSUBDIRS += pydoc_data
++endif
++
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+diff --git a/configure.ac b/configure.ac
+index 5a6a1fe608..f68ea72321 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4171,6 +4171,12 @@ AS_VAR_IF([posix_threads], [stub], [
+   AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support])
+ ])
++AC_SUBST(PYDOC)
++
++AC_ARG_ENABLE(pydoc,
++      AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
++      [ PYDOC="${enableval}" ], [ PYDOC=yes ])
++
+ # Check for enable-ipv6
+ AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
+ AC_MSG_CHECKING([if --enable-ipv6 is specified])
+diff --git a/setup.py b/setup.py
+index 0e04944ce0..3e55f5b2e0 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1593,6 +1593,12 @@ class DummyProcess:
+     # turn off warnings when deprecated modules are imported
+     import warnings
+     warnings.filterwarnings("ignore",category=DeprecationWarning)
++
++    scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
++               'Lib/smtpd.py']
++    if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
++        scripts += [ 'Tools/scripts/pydoc3' ]
++
+     setup(# PyPI Metadata (PEP 301)
+           name = "Python",
+           version = sys.version.split()[0],
+@@ -1617,8 +1623,7 @@ class DummyProcess:
+           # If you change the scripts installed here, you also need to
+           # check the PyBuildScripts command above, and change the links
+           # created by the bininstall target in Makefile.pre.in
+-          scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
+-                     "Tools/scripts/2to3"]
++          scripts = scripts
+         )
+ # --install-platlib
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0012-Add-an-option-to-disable-lib2to3.patch b/archive-patches/python3/patches/0012-Add-an-option-to-disable-lib2to3.patch
new file mode 100644 (file)
index 0000000..228b86a
--- /dev/null
@@ -0,0 +1,122 @@
+From 0e4f0a525ea0a68f6d4c5349c301da2e9b0c8ac9 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:15:31 -0800
+Subject: [PATCH] Add an option to disable lib2to3
+
+lib2to3 is a library to convert Python 2.x code to Python 3.x. As
+such, it is probably not very useful on embedded system targets.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+[ Bernd Kuhls: ported to Python 3.11.4]
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ Makefile.pre.in | 17 ++++++++++++-----
+ configure.ac    |  6 ++++++
+ setup.py        |  6 +++---
+ 3 files changed, 21 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 403380e181..f5d0573067 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1868,7 +1868,9 @@ ifeq (@PYDOC@,yes)
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
+ endif
+       -rm -f $(DESTDIR)$(BINDIR)/2to3
++ifeq (@LIB2TO3@,yes)
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
++endif
+       if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
+               rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
+               (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
+@@ -1914,7 +1916,6 @@ LIBSUBDIRS=      asyncio \
+               idlelib idlelib/Icons \
+               importlib importlib/resources importlib/metadata \
+               json \
+-              lib2to3 lib2to3/fixes lib2to3/pgen2 \
+               logging \
+               multiprocessing multiprocessing/dummy \
+               re \
+@@ -1934,10 +1935,6 @@ LIBSUBDIRS=     asyncio \
+ TESTSUBDIRS=  ctypes/test \
+               distutils/tests \
+               idlelib/idle_test \
+-              lib2to3/tests \
+-              lib2to3/tests/data \
+-              lib2to3/tests/data/fixers \
+-              lib2to3/tests/data/fixers/myfixes \
+               test \
+               test/audiodata \
+               test/capath \
+@@ -2013,6 +2010,14 @@ ifeq (@PYDOC@,yes)
+ LIBSUBDIRS += pydoc_data
+ endif
++ifeq (@LIB2TO3@,yes)
++LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
++TESTSUBDIRS += lib2to3/tests                  \
++      lib2to3/tests/data                      \
++      lib2to3/tests/data/fixers               \
++      lib2to3/tests/data/fixers/myfixes
++endif
++
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+@@ -2115,10 +2120,12 @@ ifeq (@PYC_BUILD@,yes)
+               -j0 -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ endif
++ifeq (@LIB2TO3@,yes)
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+               $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+               $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
++endif
+ # bpo-21536: Misc/python-config.sh is generated in the build directory
+ # from $(srcdir)Misc/python-config.sh.in.
+diff --git a/configure.ac b/configure.ac
+index f68ea72321..d8e10cf2b2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -7078,6 +7078,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$with_trace_refs" = "no"], [test "$ac_cv_fu
+ # substitute multiline block, must come after last PY_STDLIB_MOD()
+ AC_SUBST([MODULE_BLOCK])
++AC_SUBST(LIB2TO3)
++
++AC_ARG_ENABLE(lib2to3,
++      AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
++      [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
++
+ # generate output files
+ AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
+ AC_CONFIG_FILES([Modules/Setup.bootstrap Modules/Setup.stdlib])
+diff --git a/setup.py b/setup.py
+index 3e55f5b2e0..c490b0b08f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1594,11 +1594,11 @@ class DummyProcess:
+     import warnings
+     warnings.filterwarnings("ignore",category=DeprecationWarning)
+-    scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
+-               'Lib/smtpd.py']
++    scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
+     if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
+         scripts += [ 'Tools/scripts/pydoc3' ]
+-
++    if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
++        scripts += [ 'Tools/scripts/2to3' ]
+     setup(# PyPI Metadata (PEP 301)
+           name = "Python",
+           version = sys.version.split()[0],
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0013-Add-option-to-disable-the-sqlite3-module.patch b/archive-patches/python3/patches/0013-Add-option-to-disable-the-sqlite3-module.patch
new file mode 100644 (file)
index 0000000..795ea3b
--- /dev/null
@@ -0,0 +1,62 @@
+From ef8c030e01b1be8be582e90c31298a5863094858 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:20:45 -0800
+Subject: [PATCH] Add option to disable the sqlite3 module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ Makefile.pre.in | 5 ++++-
+ configure.ac    | 9 +++++++++
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index f5d0573067..9f4cdf14cf 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1920,7 +1920,6 @@ LIBSUBDIRS=      asyncio \
+               multiprocessing multiprocessing/dummy \
+               re \
+               site-packages \
+-              sqlite3 \
+               tkinter \
+               tomllib \
+               turtledemo \
+@@ -2018,6 +2017,10 @@ TESTSUBDIRS += lib2to3/tests                    \
+       lib2to3/tests/data/fixers/myfixes
+ endif
++ifeq (@SQLITE3@,yes)
++LIBSUBDIRS += sqlite3
++endif
++
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+diff --git a/configure.ac b/configure.ac
+index d8e10cf2b2..4cc0951ab9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4171,6 +4171,15 @@ AS_VAR_IF([posix_threads], [stub], [
+   AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support])
+ ])
++AC_SUBST(SQLITE3)
++AC_ARG_ENABLE(sqlite3,
++      AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
++      [ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
++
++if test "$SQLITE3" = "no" ; then
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
++fi
++
+ AC_SUBST(PYDOC)
+ AC_ARG_ENABLE(pydoc,
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0014-Add-an-option-to-disable-the-tk-module.patch b/archive-patches/python3/patches/0014-Add-an-option-to-disable-the-tk-module.patch
new file mode 100644 (file)
index 0000000..b89e1d2
--- /dev/null
@@ -0,0 +1,77 @@
+From bbbfe699d648a5cb191203b16e1786e8cf4ea908 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:23:42 -0800
+Subject: [PATCH] Add an option to disable the tk module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+[ Bernd Kuhls: ported to Python 3.11.4]
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ Makefile.pre.in | 10 +++++++---
+ configure.ac    |  9 +++++++++
+ 2 files changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 9f4cdf14cf..4f83911200 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1920,7 +1920,6 @@ LIBSUBDIRS=      asyncio \
+               multiprocessing multiprocessing/dummy \
+               re \
+               site-packages \
+-              tkinter \
+               tomllib \
+               turtledemo \
+               unittest \
+@@ -2038,9 +2038,6 @@
+               test/xmltestdata \
+               test/xmltestdata/c14n-20 \
+               test/ziptestdata \
+-              tkinter/test \
+-              tkinter/test/test_tkinter \
+-              tkinter/test/test_ttk \
+               unittest/test \
+               unittest/test/testmock
+ ifeq (@PYDOC@,yes)
+@@ -2021,6 +2018,13 @@ ifeq (@SQLITE3@,yes)
+ LIBSUBDIRS += sqlite3
+ endif
++ifeq (@TK@,yes)
++LIBSUBDIRS += tkinter
++TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
++      tkinter/test/test_ttk
++endif
++
++
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+diff --git a/configure.ac b/configure.ac
+index 4cc0951ab9..f4ce506801 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4180,6 +4180,15 @@ if test "$SQLITE3" = "no" ; then
+    DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
+ fi
++AC_SUBST(TK)
++AC_ARG_ENABLE(tk,
++      AS_HELP_STRING([--disable-tk], [disable tk]),
++      [ TK="${enableval}" ], [ TK=yes ])
++
++if test "$TK" = "no"; then
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
++fi
++
+ AC_SUBST(PYDOC)
+ AC_ARG_ENABLE(pydoc,
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0015-Add-an-option-to-disable-the-curses-module.patch b/archive-patches/python3/patches/0015-Add-an-option-to-disable-the-curses-module.patch
new file mode 100644 (file)
index 0000000..da6f891
--- /dev/null
@@ -0,0 +1,61 @@
+From 03e28cdd46dac1b7e4e9c8bbd2ea44b09e514205 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:31:51 -0800
+Subject: [PATCH] Add an option to disable the curses module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ Makefile.pre.in | 4 +++-
+ configure.ac    | 9 +++++++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 4f83911200..8e879b35c6 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1905,7 +1905,6 @@ LIBSUBDIRS=      asyncio \
+               concurrent concurrent/futures \
+               csv \
+               ctypes ctypes/macholib \
+-              curses \
+               dbm \
+               distutils distutils/command \
+               email email/mime \
+@@ -2024,6 +2023,9 @@ TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
+       tkinter/test/test_ttk
+ endif
++ifeq (@CURSES@,yes)
++LIBSUBDIRS += curses
++endif
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+diff --git a/configure.ac b/configure.ac
+index f4ce506801..0ae9863cd6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4189,6 +4189,15 @@ if test "$TK" = "no"; then
+    DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
+ fi
++AC_SUBST(CURSES)
++AC_ARG_ENABLE(curses,
++      AS_HELP_STRING([--disable-curses], [disable curses]),
++      [ CURSES="${enableval}" ], [ CURSES=yes ])
++
++if test "$CURSES" = "no"; then
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel"
++fi
++
+ AC_SUBST(PYDOC)
+ AC_ARG_ENABLE(pydoc,
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0016-Add-an-option-to-disable-expat.patch b/archive-patches/python3/patches/0016-Add-an-option-to-disable-expat.patch
new file mode 100644 (file)
index 0000000..c307407
--- /dev/null
@@ -0,0 +1,82 @@
+From c9a2ea3edacf57746517600ccc11c254a9fd6c48 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:40:45 -0800
+Subject: [PATCH] Add an option to disable expat
+
+This patch replaces the existing --with-system-expat option with a
+--with-expat={system,builtin,none} option, which allows to tell Python
+whether we want to use the system expat (already installed), the expat
+builtin the Python sources, or no expat at all (which disables the
+installation of XML modules).
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ Makefile.pre.in |  5 ++++-
+ configure.ac    | 20 ++++++++++++++------
+ 2 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 8e879b35c6..80d617cf7f 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1925,7 +1925,6 @@ LIBSUBDIRS=      asyncio \
+               urllib \
+               venv venv/scripts venv/scripts/common venv/scripts/posix \
+               wsgiref \
+-              $(XMLLIBSUBDIRS) \
+               xmlrpc \
+               zoneinfo \
+               __phello__
+@@ -2027,6 +2026,10 @@ ifeq (@CURSES@,yes)
+ LIBSUBDIRS += curses
+ endif
++ifeq (@EXPAT@,yes)
++LIBSUBDIRS += $(XMLLIBSUBDIRS)
++endif
++
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+diff --git a/configure.ac b/configure.ac
+index 0ae9863cd6..201cad0bfc 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3565,15 +3565,23 @@ LIBS="$withval $LIBS"
+ AC_SUBST(DISABLED_EXTENSIONS)
+ # Check for use of the system expat library
+-AC_MSG_CHECKING(for --with-system-expat)
+-AC_ARG_WITH(system_expat,
+-            AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)]),
++AC_MSG_CHECKING(for --with-expat)
++AC_ARG_WITH(expat,
++            AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
+             [],
+-            [with_system_expat="no"])
++            [with_expat="builtin"])
+-AC_MSG_RESULT($with_system_expat)
++AC_MSG_RESULT($with_expat)
+-AS_VAR_IF([with_system_expat], [yes], [
++if test "$with_expat" != "none"; then
++   EXPAT=yes
++else
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
++   EXPAT=no
++fi
++AC_SUBST(EXPAT)
++
++AS_VAR_IF([with_expat], [system], [
+   LIBEXPAT_CFLAGS=${LIBEXPAT_CFLAGS-""}
+   LIBEXPAT_LDFLAGS=${LIBEXPAT_LDFLAGS-"-lexpat"}
+   LIBEXPAT_INTERNAL=
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0017-Add-an-option-to-disable-CJK-codecs.patch b/archive-patches/python3/patches/0017-Add-an-option-to-disable-CJK-codecs.patch
new file mode 100644 (file)
index 0000000..63a07fb
--- /dev/null
@@ -0,0 +1,30 @@
+From d8ef6a7a9f2b954cf1c1e37fc3c35055b42af0f5 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:49:55 +0100
+Subject: [PATCH] Add an option to disable CJK codecs
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 201cad0bfc..ecdd7dbc07 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4188,6 +4188,12 @@ if test "$SQLITE3" = "no" ; then
+    DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
+ fi
++AC_ARG_ENABLE(codecs-cjk,
++      AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]),
++      [ if test "$enableval" = "no"; then
++              DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022"
++      fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+       AS_HELP_STRING([--disable-tk], [disable tk]),
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0018-Add-an-option-to-disable-NIS.patch b/archive-patches/python3/patches/0018-Add-an-option-to-disable-NIS.patch
new file mode 100644 (file)
index 0000000..977955d
--- /dev/null
@@ -0,0 +1,33 @@
+From 09fc9f72ebe60bb65e80732a6bd4f12a84159f6d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:50:11 +0100
+Subject: [PATCH] Add an option to disable NIS
+
+NIS is not necessarily available in uClibc, so we need an option to
+not compile support for it.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index ecdd7dbc07..1bdde7f69d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4194,6 +4194,12 @@ AC_ARG_ENABLE(codecs-cjk,
+               DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022"
+       fi])
++AC_ARG_ENABLE(nis,
++      AS_HELP_STRING([--disable-nis], [disable NIS]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
++        fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+       AS_HELP_STRING([--disable-tk], [disable tk]),
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0019-Add-an-option-to-disable-unicodedata.patch b/archive-patches/python3/patches/0019-Add-an-option-to-disable-unicodedata.patch
new file mode 100644 (file)
index 0000000..74702b6
--- /dev/null
@@ -0,0 +1,30 @@
+From 4fe7f375a3d171d294caebdd7b7ce49bbc9ad9f3 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:50:27 +0100
+Subject: [PATCH] Add an option to disable unicodedata
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 1bdde7f69d..ba4b0e0c1c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4200,6 +4200,12 @@ AC_ARG_ENABLE(nis,
+            DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis"
+         fi])
++AC_ARG_ENABLE(unicodedata,
++      AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
++        fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+       AS_HELP_STRING([--disable-tk], [disable tk]),
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0020-Add-an-option-to-disable-IDLE.patch b/archive-patches/python3/patches/0020-Add-an-option-to-disable-IDLE.patch
new file mode 100644 (file)
index 0000000..09b5f13
--- /dev/null
@@ -0,0 +1,92 @@
+From 2c9dbd6d49744aa8da8ebf8d0187d6b06f93c2b5 Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime.ripard@free-electrons.com>
+Date: Wed, 22 Feb 2017 17:45:14 -0800
+Subject: [PATCH] Add an option to disable IDLE
+
+IDLE is an IDE embedded into python, written using Tk, so it doesn't make
+much sense to have it into our build.
+
+Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+[ Adam Duskett: ported to Python 3.10.0 ]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ Makefile.pre.in | 7 ++++++-
+ configure.ac    | 6 ++++++
+ setup.py        | 5 ++++-
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 80d617cf7f..8d1ba1356c 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1862,7 +1862,9 @@ bininstall: altbininstall
+       -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
+       (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
+       -rm -f $(DESTDIR)$(BINDIR)/idle3
++ifeq (@IDLE@,yes)
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
++endif
+       -rm -f $(DESTDIR)$(BINDIR)/pydoc3
+ ifeq (@PYDOC@,yes)
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
+@@ -1912,7 +1914,6 @@ LIBSUBDIRS=      asyncio \
+               ensurepip ensurepip/_bundled \
+               html \
+               http \
+-              idlelib idlelib/Icons \
+               importlib importlib/resources importlib/metadata \
+               json \
+               logging \
+@@ -2030,6 +2031,10 @@ ifeq (@EXPAT@,yes)
+ LIBSUBDIRS += $(XMLLIBSUBDIRS)
+ endif
++ifeq (@IDLE@,yes)
++LIBSUBDIRS += idlelib idlelib/Icons
++endif
++
+ TEST_MODULES=@TEST_MODULES@
+ libinstall:   all $(srcdir)/Modules/xxmodule.c
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+diff --git a/configure.ac b/configure.ac
+index ba4b0e0c1c..5e6d72f7db 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -7137,6 +7137,12 @@ AC_ARG_ENABLE(lib2to3,
+       AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
+       [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
++AC_SUBST(IDLE)
++
++AC_ARG_ENABLE(idle3,
++      AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]),
++      [ IDLE="${enableval}" ], [ IDLE=yes ])
++
+ # generate output files
+ AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
+ AC_CONFIG_FILES([Modules/Setup.bootstrap Modules/Setup.stdlib])
+diff --git a/setup.py b/setup.py
+index c490b0b08f..4d49a792f7 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1594,11 +1594,14 @@ class DummyProcess:
+     import warnings
+     warnings.filterwarnings("ignore",category=DeprecationWarning)
+-    scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
++    scripts = [ 'Lib/smtpd.py']
+     if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
+         scripts += [ 'Tools/scripts/pydoc3' ]
+     if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
+         scripts += [ 'Tools/scripts/2to3' ]
++    if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"):
++        scripts += [ 'Tools/scripts/idle3' ]
++
+     setup(# PyPI Metadata (PEP 301)
+           name = "Python",
+           version = sys.version.split()[0],
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0021-Add-an-option-to-disable-decimal.patch b/archive-patches/python3/patches/0021-Add-an-option-to-disable-decimal.patch
new file mode 100644 (file)
index 0000000..d683565
--- /dev/null
@@ -0,0 +1,54 @@
+From 7091fdf77f612425c178a75148560f9c3514e8b8 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:51:31 +0100
+Subject: [PATCH] Add an option to disable decimal
+
+This patch replaces the existing --with-system-libmpdec option with a
+--with-libmpdec={system,builtin,none} option, which allows to tell
+Python whether we want to use the system libmpdec (already installed),
+the libmpdec builtin the Python sources, or no libmpdec at all.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[aduskett@gmail.com: Update for python 3.7.0]
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+[james.hilliard1@gmail.com: adapt to python 3.9]
+Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
+---
+ configure.ac | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5e6d72f7db..e6b1f1e9de 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3630,14 +3630,21 @@ fi
+ AC_SUBST(LIBFFI_INCLUDEDIR)
+ # Check for use of the system libmpdec library
+-AC_MSG_CHECKING(for --with-system-libmpdec)
+-AC_ARG_WITH(system_libmpdec,
+-            AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]),
++AC_MSG_CHECKING(for --with-libmpdec)
++AC_ARG_WITH(libmpdec,
++            AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
+             [],
+-            [with_system_libmpdec="no"])
+-AC_MSG_RESULT($with_system_libmpdec)
++            [with_libmpdec="builtin"])
++AC_MSG_RESULT($with_libmpdec)
++if test "$with_libmpdec" != "none"; then
++   MPDEC=yes
++else
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
++   MPDEC=no
++fi
++AC_SUBST(MPDEC)
+-AS_VAR_IF([with_system_libmpdec], [yes], [
++AS_VAR_IF([with_libmpdec], [system], [
+   LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
+   LIBMPDEC_LDFLAGS=${LIBMPDEC_LDFLAGS-"-lmpdec"}
+   LIBMPDEC_INTERNAL=
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0022-Add-an-option-to-disable-the-ossaudiodev-module.patch b/archive-patches/python3/patches/0022-Add-an-option-to-disable-the-ossaudiodev-module.patch
new file mode 100644 (file)
index 0000000..56713a7
--- /dev/null
@@ -0,0 +1,30 @@
+From d48d9da534cec7891ae444b4ab94a76ac67f5daa Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Wed, 23 Dec 2015 11:51:58 +0100
+Subject: [PATCH] Add an option to disable the ossaudiodev module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index e6b1f1e9de..db33d567ad 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3678,6 +3678,12 @@ fi
+ AC_MSG_RESULT($with_decimal_contextvar)
++AC_ARG_ENABLE(ossaudiodev,
++      AS_HELP_STRING([--disable-ossaudiodev], [disable OSSAUDIODEV]),
++      [ if test "$enableval" = "no"; then
++        DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ossaudiodev"
++        fi])
++
+ # Check for libmpdec machine flavor
+ AC_MSG_CHECKING(for decimal libmpdec machine)
+ AS_CASE([$ac_sys_system],
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0023-Add-an-option-to-disable-openssl-support.patch b/archive-patches/python3/patches/0023-Add-an-option-to-disable-openssl-support.patch
new file mode 100644 (file)
index 0000000..d4c9fd4
--- /dev/null
@@ -0,0 +1,30 @@
+From 25c900e81a2fc0bbe35e7c94e2e5028cfbf6582a Mon Sep 17 00:00:00 2001
+From: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
+Date: Wed, 22 Feb 2017 17:55:59 -0800
+Subject: [PATCH] Add an option to disable openssl support.
+
+Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index db33d567ad..42fe6c8f5a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4219,6 +4219,12 @@ AC_ARG_ENABLE(unicodedata,
+            DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata"
+         fi])
++AC_ARG_ENABLE(openssl,
++      AS_HELP_STRING([--disable-openssl], [disable openssl support]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib"
++        fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+       AS_HELP_STRING([--disable-tk], [disable tk]),
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0024-Add-an-option-to-disable-the-readline-module.patch b/archive-patches/python3/patches/0024-Add-an-option-to-disable-the-readline-module.patch
new file mode 100644 (file)
index 0000000..9250007
--- /dev/null
@@ -0,0 +1,30 @@
+From 9082468ca620db77b670ccf568a96bbabb865f80 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Tue, 7 Mar 2017 23:29:05 +0100
+Subject: [PATCH] Add an option to disable the readline module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 42fe6c8f5a..19875d7d30 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4225,6 +4225,12 @@ AC_ARG_ENABLE(openssl,
+            DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib"
+         fi])
++AC_ARG_ENABLE(readline,
++      AS_HELP_STRING([--disable-readline], [disable readline]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline"
++        fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+       AS_HELP_STRING([--disable-tk], [disable tk]),
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch b/archive-patches/python3/patches/0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch
new file mode 100644 (file)
index 0000000..70a0d6c
--- /dev/null
@@ -0,0 +1,42 @@
+From 988a335cb34b5fc25ea345ba04ff5ddffe2e946c Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Tue, 7 Mar 2017 23:31:11 +0100
+Subject: [PATCH] Add options to disable zlib, bzip2 and xz modules
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 19875d7d30..ca6c16491a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4231,6 +4231,24 @@ AC_ARG_ENABLE(readline,
+            DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline"
+         fi])
++AC_ARG_ENABLE(bzip2,
++      AS_HELP_STRING([--disable-bzip2], [disable bzip2]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _bz2"
++        fi])
++
++AC_ARG_ENABLE(zlib,
++      AS_HELP_STRING([--disable-zlib], [disable zlib]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib"
++        fi])
++
++AC_ARG_ENABLE(xz,
++      AS_HELP_STRING([--disable-xz], [disable xz]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _lzma"
++        fi])
++
+ AC_SUBST(TK)
+ AC_ARG_ENABLE(tk,
+       AS_HELP_STRING([--disable-tk], [disable tk]),
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0026-python-config.sh-don-t-reassign-prefix.patch b/archive-patches/python3/patches/0026-python-config.sh-don-t-reassign-prefix.patch
new file mode 100644 (file)
index 0000000..b6bfb01
--- /dev/null
@@ -0,0 +1,53 @@
+From 755fb526a62df2a73560f42184db8aadb6899bb0 Mon Sep 17 00:00:00 2001
+From: Matt Weber <matthew.weber@rockwellcollins.com>
+Date: Fri, 6 Oct 2017 09:54:15 -0500
+Subject: [PATCH] python-config.sh: don't reassign ${prefix}
+
+When prefix is set to a path like /usr during crossbuild
+the sed operations end up executing twice, once for the prefix
+reassignment and another for includedir if it is set as a string
+including the ${prefix} variable.  This results in an issue
+when the build directory is under /usr.
+
+This patch updates the remaining location which uses the prefix
+variable to also sed and update to use the real path.
+
+Upstream bug report:
+https://bugs.python.org/issue31713
+
+Buildroot bug:
+https://bugs.busybox.net/show_bug.cgi?id=10361
+
+Fixes failures like the following:
+dbus-python-1.2.4 | NOK | http://autobuild.buildroot.net/results/758858efa97b6273c1b470513f5492258a6d8853
+
+Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
+---
+ Misc/python-config.sh.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
+index a1bc3cd5f7..164d2d3603 100644
+--- a/Misc/python-config.sh.in
++++ b/Misc/python-config.sh.in
+@@ -31,7 +31,7 @@ prefix_real=$(installed_prefix "$0")
+ # locations. Keep prefix & exec_prefix using their original values in case
+ # they are referenced in other configure variables, to prevent double
+ # substitution, issue #22140.
+-prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
++prefix=$prefix_build
+ exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
+ exec_prefix_real=${prefix_real}
+ includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
+@@ -49,7 +49,7 @@ LDLIBRARY="@LDLIBRARY@"
+ OPT="@OPT@"
+ PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
+ LDVERSION="@LDVERSION@"
+-LIBDEST=${prefix_real}/lib/python${VERSION}
++LIBDEST=$( echo "${prefix}/lib/python${VERSION}" | sed "s#^$prefix_build#$prefix_real#")
+ LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
+ SO="@EXT_SUFFIX@"
+ PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0027-Add-an-option-to-disable-uuid-module.patch b/archive-patches/python3/patches/0027-Add-an-option-to-disable-uuid-module.patch
new file mode 100644 (file)
index 0000000..a9501ec
--- /dev/null
@@ -0,0 +1,33 @@
+From 58027d25c3cabcf654cb0b31a61d7cbd53dc68c0 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Sat, 18 Aug 2018 10:54:56 +0200
+Subject: [PATCH] Add an option to disable uuid module
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ configure.ac | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index ca6c16491a..ed03b27fb1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4267,6 +4267,15 @@ if test "$CURSES" = "no"; then
+    DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel"
+ fi
++AC_SUBST(UUID)
++AC_ARG_ENABLE(uuid,
++      AS_HELP_STRING([--disable-uuid], [disable uuid]),
++      [ UUID="${enableval}" ], [ UUID=yes ])
++
++if test "$UUID" = "no"; then
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _uuid"
++fi
++
+ AC_SUBST(PYDOC)
+ AC_ARG_ENABLE(pydoc,
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0028-fix-building-on-older-distributions.patch b/archive-patches/python3/patches/0028-fix-building-on-older-distributions.patch
new file mode 100644 (file)
index 0000000..4541b31
--- /dev/null
@@ -0,0 +1,47 @@
+From e52e2c5e3df4bc3d2ff07ecb3b8e2a9099ea1631 Mon Sep 17 00:00:00 2001
+From: Adam Duskett <aduskett@gmail.com>
+Date: Thu, 16 Aug 2018 14:52:37 -0700
+Subject: [PATCH] fix building on older distributions
+
+Python > 3.6.3 calls os.replace in the update_file.py script, during the
+regen-importlib phase of the build process.
+
+According to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same
+way as os.rename, however, it is now cross-platform compatible for Windows.
+
+Because BuildRoot is guaranteed only to be built in  POSIX environment, it is
+safe to change os.replace back to os.rename.
+
+This change fixes building on older systems such as CentOS7, that only come
+with python 2.
+
+Signed-off-by: Adam Duskett <aduskett@gmail.com>
+---
+ Tools/scripts/update_file.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py
+index b4182c1d0c..ab443cb1a6 100644
+--- a/Tools/scripts/update_file.py
++++ b/Tools/scripts/update_file.py
+@@ -53,7 +53,7 @@ def update_file_with_tmpfile(filename, tmpfile, *, create=False):
+         if not create:
+             raise  # re-raise
+         outcome = 'created'
+-        os.replace(tmpfile, filename)
++        os.rename(tmpfile, filename)
+     else:
+         with targetfile:
+             old_contents = targetfile.read()
+@@ -62,7 +62,7 @@ def update_file_with_tmpfile(filename, tmpfile, *, create=False):
+         # Now compare!
+         if old_contents != new_contents:
+             outcome = 'updated'
+-            os.replace(tmpfile, filename)
++            os.rename(tmpfile, filename)
+         else:
+             outcome = 'same'
+             os.unlink(tmpfile)
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch b/archive-patches/python3/patches/0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch
new file mode 100644 (file)
index 0000000..5253076
--- /dev/null
@@ -0,0 +1,51 @@
+From 07b950aadd570b9f96a1f128505a959b32f40962 Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <peter@korsgaard.com>
+Date: Fri, 2 Aug 2019 15:53:16 +0200
+Subject: [PATCH] configure.ac: fixup $CC --print-multiarch output for
+ musl/uclibc GCC 8+ toolchains
+
+GCC commit 6834b83784dcf0364eb820e8 (multiarch support for non-glibc linux
+systems), which is part of GCC 8+, changed the multiarch logic to use
+$arch-linux-musl / $arch-linux-uclibc rather than $arch-linux-gnu.
+
+This then causes the python3 configure script to error out:
+
+checking for the platform triplet based on compiler characteristics... powerpc-linux-gnu
+configure: error: internal configure error for the platform triplet, please file a bug report
+
+http://autobuild.buildroot.net/results/cb4/cb49c539501342e45cbe5ade82e588fcdf51f05b
+
+As it requires that the --print-multiarch output (if not empty) matches the
+deduced triplet (which always uses -linux-gnu).
+
+It isn't quite clear why --print-multiarch returns something for a
+non-multiarch toolchain on some architectures (E.G.  PowerPC), but as a
+workaround, rewrite the --print-multiarch output to match older GCC versions
+to keep the configure script happy.
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+[Peter: updated for 3.10.2]
+---
+ configure.ac | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index ed03b27fb1..841fd6732c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1086,7 +1086,11 @@ AC_MSG_CHECKING([for multiarch])
+ AS_CASE([$ac_sys_system],
+   [Darwin*], [MULTIARCH=""],
+   [FreeBSD*], [MULTIARCH=""],
+-  [MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
++  [
++  # GCC 8+ returns $arch-linux-{musl,uclibc} for musl/uClibc based
++  # toolchains confusing python. Fix that up
++  MULTIARCH=$($CC --print-multiarch 2>/dev/null | sed -E 's/-linux-(musl|uclibc)*$/-linux-gnu/')
++  ]
+ )
+ AC_SUBST([MULTIARCH])
+ AC_MSG_RESULT([$MULTIARCH])
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0030-Add-an-option-to-disable-the-berkeleydb-module.patch b/archive-patches/python3/patches/0030-Add-an-option-to-disable-the-berkeleydb-module.patch
new file mode 100644 (file)
index 0000000..5fb436d
--- /dev/null
@@ -0,0 +1,30 @@
+From 67e9793d070ac5c8e83abbe95b9208533ffeadd0 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd.kuhls@t-online.de>
+Date: Sat, 11 Apr 2020 22:01:40 +0200
+Subject: [PATCH] Add an option to disable the berkeleydb module
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ configure.ac | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 841fd6732c..06c9a81f95 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4280,6 +4280,12 @@ if test "$UUID" = "no"; then
+    DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _uuid"
+ fi
++AC_ARG_ENABLE(berkeleydb,
++      AS_HELP_STRING([--disable-berkeleydb], [disable berkeleydb]),
++      [ if test "$enableval" = "no"; then
++           DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _dbm"
++        fi])
++
+ AC_SUBST(PYDOC)
+ AC_ARG_ENABLE(pydoc,
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch b/archive-patches/python3/patches/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch
new file mode 100644 (file)
index 0000000..712fd08
--- /dev/null
@@ -0,0 +1,42 @@
+From 3edeed879871a10acbe802f4a68cff3d4869dbde Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Thu, 12 Nov 2020 00:16:18 +0100
+Subject: [PATCH] lib/crypt: uClibc-ng doesn't set errno when encryption method
+ is not available
+
+Since commit [1] in cpython, an exception is raised when an encryption method
+is not available. This eception is handled only if errno is set to EINVAL by
+crypt() but uClibc-ng doesn't set errno in crypt() [2].
+
+Fixes:
+https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961
+https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979
+
+[1] https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c
+[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+[Daniel: updated for 3.10.7]
+Signed-off-by: Daniel Lang <d.lang@abatec.at>
+---
+ Lib/crypt.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Lib/crypt.py b/Lib/crypt.py
+index de4a14a388..ba482487a7 100644
+--- a/Lib/crypt.py
++++ b/Lib/crypt.py
+@@ -98,7 +98,9 @@ def _add_method(name, *args, rounds=None):
+         result = crypt('', salt)
+     except OSError as e:
+         # Not all libc libraries support all encryption methods.
+-        if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS}:
++        # Not all libc libraries set errno when encryption method is not
++        # available.
++        if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS} or e.errno == 0:
+             return False
+         raise
+     if result and len(result) == method.total_size:
+-- 
+2.34.1
+
diff --git a/archive-patches/python3/patches/0100-use-legacy-path-for-pycs.patch b/archive-patches/python3/patches/0100-use-legacy-path-for-pycs.patch
new file mode 100644 (file)
index 0000000..30a89b0
--- /dev/null
@@ -0,0 +1,56 @@
+--- a/Lib/importlib/_bootstrap_external.py
++++ b/Lib/importlib/_bootstrap_external.py
+@@ -465,13 +465,13 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+     tag = sys.implementation.cache_tag
+     if tag is None:
+         raise NotImplementedError('sys.implementation.cache_tag is None')
+-    almost_filename = ''.join([(base if base else rest), sep, tag])
++    almost_filename = ''.join([(base if base else rest)])
+     if optimization is None:
+         if sys.flags.optimize == 0:
+             optimization = ''
+         else:
+             optimization = sys.flags.optimize
+-    optimization = str(optimization)
++    optimization = ''
+     if optimization != '':
+         if not optimization.isalnum():
+             raise ValueError('{!r} is not alphanumeric'.format(optimization))
+@@ -502,7 +502,7 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+             head.lstrip(path_separators),
+             filename,
+         )
+-    return _path_join(head, _PYCACHE, filename)
++    return _path_join(head, filename)
+ def source_from_cache(path):
+--- a/Python/initconfig.c
++++ b/Python/initconfig.c
+@@ -754,7 +754,7 @@ _PyConfig_InitCompatConfig(PyConfig *config)
+     config->warn_default_encoding = 0;
+     config->inspect = -1;
+     config->interactive = -1;
+-    config->optimization_level = -1;
++    config->optimization_level = 1;
+     config->parser_debug= -1;
+     config->write_bytecode = -1;
+     config->verbose = -1;
+@@ -796,7 +796,7 @@ config_init_defaults(PyConfig *config)
+     config->bytes_warning = 0;
+     config->inspect = 0;
+     config->interactive = 0;
+-    config->optimization_level = 0;
++    config->optimization_level = 1;
+     config->parser_debug= 0;
+     config->write_bytecode = 1;
+     config->verbose = 0;
+@@ -2412,7 +2412,7 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions,
+         /* case 'J': reserved for Jython */
+         case 'O':
+-            config->optimization_level++;
++            config->optimization_level = 1;
+             break;
+         case 'P':
index da08945b7c7699d19e6a1fe801cc655d0d753646..4eaf70976d1135e158e1cc6116406734ee516678 100755 (executable)
@@ -80,7 +80,7 @@ $(ARCHIVE)/gettext-$(GETTEXT_VER).tar.xz:
        $(WGET) http://ftp.gnu.org/pub/gnu/gettext/gettext-$(GETTEXT_VER).tar.xz
 
 $(ARCHIVE)/libffi-$(LIBFFI_VER).tar.gz:
-       $(WGET) ftp://sourceware.org/pub/libffi/libffi-$(LIBFFI_VER).tar.gz
+       $(WGET) https://github.com/libffi/libffi/releases/download/v$(LIBFFI_VER)/libffi-$(LIBFFI_VER).tar.gz
 
 $(ARCHIVE)/fuse-$(FUSE_VER).tar.gz:
        $(WGET) https://github.com/libfuse/libfuse/releases/download/fuse-$(FUSE_VER)/fuse-$(FUSE_VER).tar.gz
@@ -378,6 +378,9 @@ $(ARCHIVE)/ntp-$(NTP_VER).tar.gz:
 $(ARCHIVE)/portmap-$(PORTMAP_VER).tgz:
        $(WGET) http://fossies.org/linux/misc/old/portmap-$(PORTMAP_VER).tgz
 
+$(ARCHIVE)/Python-$(PYTHON3_VER).tar.xz:
+       $(WGET) https://www.python.org/ftp/python/$(PYTHON3_VER)/Python-$(PYTHON3_VER).tar.xz
+
 $(ARCHIVE)/rsync-$(RSYNC_VER).tar.gz:
        $(WGET) https://ftp.samba.org/pub/rsync/rsync-$(RSYNC_VER).tar.gz
 
index 579afa9f9966e15e62be2387b2857b3c72f34efb..76410cc3a2b4831ba15fdd9366ee617416354a49 100755 (executable)
@@ -29,7 +29,13 @@ SUPPORT_DIR  = $(BASE_DIR)/support
 CROSS_BASE   = $(BASE_DIR)/cross
 CROSS_DIR   ?= $(CROSS_BASE)
 
-BUILD       ?= $(shell /usr/share/libtool/config.guess 2>/dev/null || /usr/share/libtool/config/config.guess)
+HOST_CPPFLAGS   = -I$(HOSTPREFIX)/usr/include
+HOST_CFLAGS    ?= -O2
+HOST_CFLAGS    += $(HOST_CPPFLAGS)
+HOST_CXXFLAGS  += $(HOST_CFLAGS)
+HOST_LDFLAGS   += -L$(HOSTPREFIX)/usr/lib -Wl,-rpath,$(HOSTPREFIX)/usr/lib
+
+BUILD       ?= $(shell find /usr/share/libtool -name config.guess -exec {} \; 2>/dev/null)
 
 GCC = $(shell gcc -dumpversion | cut -c 1-3)
 
@@ -171,7 +177,7 @@ REWRITE_PKGCONF    = sed -i "s,^prefix=.*,prefix='$(TARGETPREFIX)',"
 # unpack tarballs, clean up
 UNTAR = tar -C $(BUILD_TMP) -xf $(ARCHIVE)
 UNZIP = unzip -d $(BUILD_TMP) -o $(ARCHIVE)
-REMOVE = rm -rf $(BUILD_TMP)/.remove $(TARGETPREFIX)/.remove $(BUILD_TMP)
+REMOVE = rm -rf $(BUILD_TMP)/.remove $(TARGETPREFIX)/.remove $(HOSTPREFIX)/.remove $(BUILD_TMP)
 #
 PATCH                 = patch -p1 -i $(PATCHES)
 APATCH                = patch -p1 -i
index 7b29dbf4fd0d6aff4818724f7e66dbc7fcf5e4d6..eac51ae13d66607e195a20ff789a73af72017ec3 100755 (executable)
@@ -330,6 +330,20 @@ $(D)/zlib: $(ARCHIVE)/zlib-$(ZLIB_VER).tar.xz | $(TARGETPREFIX)
        $(REMOVE)/zlib-$(ZLIB_VER)
        $(TOUCH)
 
+$(D)/host_zlib: $(ARCHIVE)/zlib-$(ZLIB_VER).tar.xz | $(TARGETPREFIX)
+       $(START_BUILD)
+       $(UNTAR)/zlib-$(ZLIB_VER).tar.xz
+       set -e; cd $(BUILD_TMP)/zlib-$(ZLIB_VER) && \
+               rm -rf config.cache && \
+               mandir=$(BUILD_TMP)/zlib-$(ZLIB_VER)/.remove \
+               ./configure \
+                       --shared \
+                       --uname=Linux && \
+               $(MAKE) && \
+               $(MAKE) install prefix=$(HOSTPREFIX)/usr
+       $(REMOVE)/zlib-$(ZLIB_VER)
+       $(TOUCH)
+
 FUSE_PATCH  = fuse2-0001-More-parentheses.patch
 FUSE_PATCH += fuse2-0002-add-fix-for-namespace-conflict-in-fuse_kernel.h.patch
 FUSE_PATCH += fuse2-0003-make-buffer-size-match-kernel-max-transfer-size.patch
@@ -1090,6 +1104,27 @@ $(D)/expat: $(ARCHIVE)/expat-$(EXPAT_VER).tar.bz2 | $(TARGETPREFIX)
        $(REMOVE)/expat-$(EXPAT_VER)
        $(TOUCH)
 
+$(D)/host_expat: $(ARCHIVE)/expat-$(EXPAT_VER).tar.bz2 | $(TARGETPREFIX)
+       $(START_BUILD)
+       $(UNTAR)/expat-$(EXPAT_VER).tar.bz2
+       set -e; cd $(BUILD_TMP)/expat-$(EXPAT_VER); \
+               patch -p1 < $(PATCHES)/expat/expat-libtool-tag.patch; \
+               ./configure \
+                       --prefix=/usr \
+                       --mandir=/.remove \
+                       --bindir=/.remove \
+                       --without-docbook \
+                       --without-examples \
+                       --without-tests \
+                       --without-xmlwf \
+                       --enable-shared \
+                       --disable-static \
+                       ; \
+               $(MAKE); \
+               make install DESTDIR=$(HOSTPREFIX)
+       $(REMOVE)/expat-$(EXPAT_VER)
+       $(TOUCH)
+
 $(D)/lua-expat: $(ARCHIVE)/luaexpat-$(LUA_EXPAT_VER).tar.bz2 $(D)/expat | $(TARGETPREFIX)
        $(START_BUILD)
        $(REMOVE)/luaexpat-$(LUA_EXPAT_VER)
@@ -1288,13 +1323,16 @@ $(D)/libffi: $(ARCHIVE)/libffi-$(LIBFFI_VER).tar.gz
        $(REMOVE)/libffi-$(LIBFFI_VER)
        $(UNTAR)/libffi-$(LIBFFI_VER).tar.gz
        set -e; cd $(BUILD_TMP)/libffi-$(LIBFFI_VER); \
-               $(PATCH)/libffi-$(LIBFFI_VER).patch; \
+               for i in $(PATCHES)/libffi/patches/*.patch; do \
+                       echo -e "==> $(TERM_RED)Applying Patch:$(TERM_NORMAL) $$i"; \
+                       patch -p1 < $$i; \
+               done; \
                $(CONFIGURE) \
                        --target=$(TARGET) \
                        --prefix=/ \
                        --mandir=/.remove \
                        --infodir=/.remove \
-                       --enable-builddir=libffi \
+                       --datarootdir=/.remove \
                        $(LIBFFI_CONF) \
                ; \
                $(MAKE); \
@@ -1304,6 +1342,27 @@ $(D)/libffi: $(ARCHIVE)/libffi-$(LIBFFI_VER).tar.gz
        $(REMOVE)/libffi-$(LIBFFI_VER)
        $(TOUCH)
 
+$(D)/host_libffi: $(ARCHIVE)/libffi-$(LIBFFI_VER).tar.gz
+       $(START_BUILD)
+       $(REMOVE)/libffi-$(LIBFFI_VER)
+       $(UNTAR)/libffi-$(LIBFFI_VER).tar.gz
+       set -e; cd $(BUILD_TMP)/libffi-$(LIBFFI_VER); \
+               for i in $(PATCHES)/libffi/patches/*.patch; do \
+                       echo -e "==> $(TERM_RED)Applying Patch:$(TERM_NORMAL) $$i"; \
+                       patch -p1 < $$i; \
+               done; \
+               ./configure \
+                       --prefix=/usr \
+                       --mandir=/.remove \
+                       --infodir=/.remove \
+                       --datarootdir=/.remove \
+                       $(LIBFFI_CONF) \
+               ; \
+               $(MAKE); \
+               $(MAKE) install DESTDIR=$(HOSTPREFIX)
+       $(REMOVE)/libffi-$(LIBFFI_VER)
+       $(TOUCH)
+
 #
 # libglib2
 #
diff --git a/make/python3.mk b/make/python3.mk
new file mode 100644 (file)
index 0000000..90cb6f5
--- /dev/null
@@ -0,0 +1,126 @@
+# PYTHON3
+
+PYTHON3_CONF_ENV = \
+       ac_cv_have_long_long_format=yes \
+       ac_cv_file__dev_ptmx=yes \
+       ac_cv_file__dev_ptc=yes \
+       ac_cv_working_tzset=yes
+       
+# GCC is always compliant with IEEE754
+ifeq ($(TARGET_ENDIAN), "little")
+PYTHON3_CONF_ENV += \
+       ac_cv_little_endian_double=yes
+else
+PYTHON3_CONF_ENV += \
+       ac_cv_big_endian_double=yes
+endif
+
+# uClibc is known to have a broken wcsftime() implementation, so tell
+# Python 3 to fall back to strftime() instead.
+ifeq ($(BOXTYPE), coolstream)
+ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd2))
+PYTHON3_CONF_ENV += \
+       ac_cv_func_wcsftime=no
+endif
+endif
+
+HOST_PYTHON_BINARY = $(HOSTPREFIX)/usr/bin/python3
+
+PYTHON3_CONF_OPTS = \
+       --prefix=/usr \
+       --enable-shared \
+       --datarootdir=/.remove \
+       --with-build-python=$(HOST_PYTHON_BINARY) \
+       --with-expat=system \
+       --with-libmpdec=none \
+       --with-openssl=$(TARGETPREFIX) \
+       --with-system-ffi \
+       --without-cxx-main \
+       --without-ensurepip \
+       --enable-optimizations \
+       --enable-unicodedata \
+       --disable-berkeleydb \
+       --disable-codecs-cjk \
+       --disable-idle3 \
+       --disable-lib2to3 \
+       --disable-nis \
+       --disable-ossaudiodev \
+       --disable-pydoc \
+       --disable-readline \
+       --disable-test-modules \
+       --disable-tk \
+
+# Disable auto-detection of uuid.h (util-linux)
+# which would add _uuid module support, instead
+# default to the pure python implementation
+PYTHON3_CONF_OPTS += --disable-uuid
+
+$(D)/python3: $(D)/host_python3 $(ARCHIVE)/Python-$(PYTHON3_VER).tar.xz | $(TARGETPREFIX)
+       $(START_BUILD)
+       $(REMOVE)/Python-$(PYTHON3_VER)
+       $(UNTAR)/Python-$(PYTHON3_VER).tar.xz
+       set -e; cd $(BUILD_TMP)/Python-$(PYTHON3_VER); \
+               for i in $(PATCHES)/python3/patches/*.patch; do \
+                       echo -e "==> $(TERM_RED)Applying Patch:$(TERM_NORMAL) $$i"; \
+                       patch -p1 < $$i; \
+               done; \
+               autoconf; \
+               $(CONFIGURE) $(PYTHON3_CONF_ENV) $(PYTHON3_CONF_OPTS); \
+               $(MAKE); \
+               $(MAKE) install DESTDIR=$(TARGETPREFIX)
+               rm -rf $(TARGETPREFIX)/usr/bin/python3-config
+               rm -rf $(TARGETPREFIX)/usr/bin/python$(PYTHON3_VER_MAJOR)-config
+               rm -rf $(TARGETPREFIX)/usr/bin/smtpd.py.*
+               rm -rf $(TARGETPREFIX)/usr/lib/python$(PYTHON3_VER_MAJOR)/config-$(PYTHON3_VER_MAJOR)*
+               chmod u+w $(TARGETPREFIX)/usr/lib/libpython$(PYTHON3_VER_MAJOR)*.so*
+       $(REMOVE)/Python-$(PYTHON3_VER)
+       $(TOUCH)
+
+# ------------------------------- HOST PYTHON3------------------------------
+
+HOST_PYTHON3_MAKE_OPTS = \
+       LDFLAGS="$(HOST_LDFLAGS) -Wl,--enable-new-dtags"
+
+# Make python believe we don't have 'hg', so that it doesn't try to
+# communicate over the network during the build.
+HOST_PYTHON3_CONF_ENV += \
+       ac_cv_prog_HAS_HG=/bin/false
+
+HOST_PYTHON3_CONF_OPTS += \
+       --prefix=/usr \
+       --without-ensurepip \
+       --without-cxx-main \
+       --with-expat=system \
+       --enable-unicodedata \
+       --disable-bzip2 \
+       --disable-codecs-cjk \
+       --disable-curses \
+       --disable-idle3 \
+       --disable-nis \
+       --disable-openssl \
+       --disable-ossaudiodev \
+       --disable-sqlite3 \
+       --disable-test-modules \
+       --disable-tk \
+       --disable-uuid
+       
+$(D)/host_python3: $(D)/host_zlib $(D)/host_libffi $(D)/host_expat $(ARCHIVE)/Python-$(PYTHON3_VER).tar.xz | $(HOSTPREFIX)
+       $(START_BUILD)
+       $(REMOVE)/Python-$(PYTHON3_VER)
+       $(UNTAR)/Python-$(PYTHON3_VER).tar.xz
+       set -e; cd $(BUILD_TMP)/Python-$(PYTHON3_VER); \
+               for i in $(PATCHES)/python3/patches/*.patch; do \
+                       echo -e "==> $(TERM_RED)Applying Patch:$(TERM_NORMAL) $$i"; \
+                       patch -p1 < $$i; \
+               done; \
+               autoconf; \
+               ./configure     $(HOST_PYTHON3_CONF_ENV) $(HOST_PYTHON3_CONF_OPTS) \
+               ; \
+               $(MAKE) $(HOST_PYTHON3_MAKE_OPTS); \
+               $(MAKE) install DESTDIR=$(HOSTPREFIX)
+       $(REMOVE)/Python-$(PYTHON3_VER)
+       $(TOUCH)
+
+
+       
+       
\ No newline at end of file
index c17858152f817da98a52c94eb980468dd7b45d59..f89be2d77c4e3f74fc9d25ce5dea7d231f0efbc3 100755 (executable)
@@ -7,8 +7,9 @@ $(D)/rootfs: $(D)/driver
        mkdir -p $(ROOTFS_DIR)/oldroot
        rm -rf $(ROOTFS_DIR)/include $(ROOTFS_DIR)/mymodules
        rm -rf $(ROOTFS_DIR)/share/{aclocal,gdb,locale,doc} # locale not (yet) needed by anything
-       rm -rf $(ROOTFS_DIR)/lib/{pkgconfig,gettext}
-       rm -f $(ROOTFS_DIR)/lib/libvorbisenc*
+       rm -rf $(ROOTFS_DIR)/lib/{cmake,gio,glib-*,libvorbisenc*,sigc++-*,pkgconfig,gettext}
+       rm -rf $(ROOTFS_DIR)/usr/include
+       rm -rf $(ROOTFS_DIR)/usr/lib/pkgconfig
        find $(ROOTFS_DIR)/share/tuxbox/neutrino/locale/ -type f \
                ! -name deutsch.locale ! -name english.locale | xargs --no-run-if-empty rm
        find $(ROOTFS_DIR) -name .gitignore -type f -print0 | xargs --no-run-if-empty -0 rm -f
@@ -20,9 +21,11 @@ $(D)/rootfs: $(D)/driver
        @echo " ****************************************************************************** "
        find $(ROOTFS_DIR)/bin -type f -print0 | xargs -0 $(TARGET)-strip || true
        find $(ROOTFS_DIR)/sbin -type f -print0 | xargs -0 $(TARGET)-strip || true
-       find $(ROOTFS_DIR)/lib -path $(ROOTFS_DIR)/lib/modules -prune -o -type f -print0 | xargs -0 $(TARGET)-strip || true
        find $(ROOTFS_DIR)/var/bin -type f -print0 | xargs -0 $(TARGET)-strip 2>/dev/null || true
        find $(ROOTFS_DIR)/var/sbin -type f -print0 | xargs -0 $(TARGET)-strip 2>/dev/null || true
+       find $(ROOTFS_DIR)/lib -path $(ROOTFS_DIR)/lib/modules -prune -o -type f -print0 | xargs -0 $(TARGET)-strip || true
+       find $(ROOTFS_DIR)/usr/lib -path $(ROOTFS_DIR)/usr/lib/python3.* -prune -o -type f -print0 | xargs -0 $(TARGET)-strip || true
+
        du -sh $(ROOTFS_DIR)
        if [ "$(BOXSERIES)" = hd2 ]; then \
                $(MAKE) symlinks; \
index a4bae2f2c11144e79f28ee5dc465752ce282fa14..c31b9d8a4fa9704bea0373895d711c34ba5ee023 100644 (file)
@@ -127,7 +127,7 @@ LIBDVDCSS_VER = 1.2.13
 LIBEXIF_VER = 0.6.21
 
 # The libffi library is useful to anyone trying to build a bridge between interpreted and natively compiled code
-LIBFFI_VER = 3.2.1
+LIBFFI_VER = 3.4.2
 
 # FUSE (Filesystem in Userspace) is an interface for userspace programs to export a filesystem to the Linux kernel
 FUSE_VER = 2.9.9
@@ -217,6 +217,10 @@ OPENVPN_VER = 2.5.8
 # parted
 PARTED_VER = 3.2
 
+# Python
+PYTHON3_VER_MAJOR = 3.11
+PYTHON3_VER = $(PYTHON3_VER_MAJOR).5
+
 # libogg
 LIBOGG_VER = 1.3.3