ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/lang/python/python3/Config-python3-light.in b/external/subpack/lang/python/python3/Config-python3-light.in
new file mode 100644
index 0000000..968c347
--- /dev/null
+++ b/external/subpack/lang/python/python3/Config-python3-light.in
@@ -0,0 +1,7 @@
+menu "Configuration"
+
+config PYTHON3_HOST_PIP_CACHE_WORLD_READABLE
+ bool "Ensure host pip cache is world-readable"
+ default n
+
+endmenu
diff --git a/external/subpack/lang/python/python3/Makefile b/external/subpack/lang/python/python3/Makefile
new file mode 100644
index 0000000..9a9e2ce
--- /dev/null
+++ b/external/subpack/lang/python/python3/Makefile
@@ -0,0 +1,367 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+# The file included below defines PYTHON3_VERSION
+include ../python3-version.mk
+
+PKG_NAME:=python3
+PKG_RELEASE:=2
+PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO)
+
+PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
+PKG_HASH:=18e1aa7e66ff3a58423d59ed22815a6954e53342122c45df20c96877c062b9b7
+
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+PKG_LICENSE:=Python-2.0.1 0BSD
+PKG_LICENSE_FILES:=LICENSE Doc/copyright.rst Doc/license.rst Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi_osx/LICENSE Modules/expat/COPYING
+PKG_CPE_ID:=cpe:/a:python:python
+
+# This file provides the necsessary host build variables
+include ../python3-host.mk
+
+# For Py3Package
+PYTHON3_PKG_BUILD:=0
+include ../python3-package.mk
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+HOST_BUILD_PARALLEL:=1
+# LTO is handled here individually, see --with-lto below
+# "no-lto" prevents CONFIG_USE_LTO to add additional and interfering flags
+PKG_BUILD_FLAGS:=no-lto
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=bluez python3/host python-build/host python-installer/host python-wheel/host
+HOST_BUILD_DEPENDS:=bzip2/host libffi/host readline/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/python3/Default
+ SUBMENU:=Python
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=Python $(PYTHON3_VERSION)
+ URL:=https://www.python.org/
+endef
+
+define Package/python3/Default/description
+Python is an interpreted, interactive, object-oriented programming
+language. It incorporates modules, exceptions, dynamic typing, very high
+level dynamic data types, and classes. It supports multiple programming
+paradigms beyond object-oriented programming, such as procedural and
+functional programming. Python combines remarkable power with very clear
+syntax. It has interfaces to many system calls and libraries, as well as
+to various window systems, and is extensible in C or C++. It is also
+usable as an extension language for applications that need a
+programmable interface. Finally, Python is portable: it runs on many
+Unix variants including Linux and macOS, and on Windows.
+endef
+
+define Package/libpython3
+$(call Package/python3/Default)
+ TITLE+= core library
+ DEPENDS:=+libpthread
+ ABI_VERSION:=$(PYTHON3_VERSION)
+endef
+
+define Package/libpython3/description
+$(call Package/python3/Default/description)
+
+This package contains only core Python library.
+endef
+
+define Package/python3-base
+$(call Package/python3/Default)
+ TITLE+= base interpreter
+ DEPENDS:=+libpython3
+endef
+
+define Package/python3-base/description
+$(call Package/python3/Default/description)
+
+This package contains only the interpreter and the bare minimum for the
+interpreter to start.
+endef
+
+define Package/python3-light
+$(call Package/python3/Default)
+ TITLE+= light installation
+ DEPENDS:=+python3-base +libbz2 +zlib
+endef
+
+define Package/python3-light/config
+ source "$(SOURCE)/Config-python3-light.in"
+endef
+
+define Package/python3-light/description
+$(call Package/python3/Default/description)
+
+This package installs the base interpreter package and contains the most
+commonly used parts of the standard library.
+endef
+
+PYTHON3_LIB_FILES_DEL:=
+PYTHON3_PACKAGES:=
+PYTHON3_SO_SUFFIX:=cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR)-*.so
+PYTHON3_PACKAGES_DEPENDS:=
+define Py3BasePackage
+ PYTHON3_PACKAGES+=$(1)
+ ifeq ($(3),)
+ PYTHON3_PACKAGES_DEPENDS+=$(1)
+ endif
+ PYTHON3_LIB_FILES_DEL+=$(2)
+ ifeq ($(2),)
+ Py3Package/$(1)/filespec=
+ else
+ define Py3Package/$(1)/filespec
+ $(foreach lib_file,$(2),
+ +|$(lib_file)
+ )
+ endef
+ endif
+ Py3Package/$(1)/install?=:
+endef
+
+include ./files/python3-package-*.mk
+
+define Package/python3
+$(call Package/python3/Default)
+ TITLE+= programming language
+ DEPENDS:=+python3-light $(foreach package,$(PYTHON3_PACKAGES_DEPENDS),+$(package))
+endef
+
+define Package/python3/description
+$(call Package/python3/Default/description)
+
+This package installs almost all parts of the standard Python
+installation.
+endef
+
+# Set READELF here so that the exact same readelf program name can be
+# replaced in _sysconfigdata_*.py (in Build/Install)
+TARGET_CONFIGURE_OPTS+= \
+ READELF="$(TARGET_CROSS)readelf"
+
+EXTRA_LDFLAGS+= \
+ -L$(PKG_BUILD_DIR) \
+ -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
+# Bypass configure tests for cross compilation
+CONFIGURE_VARS += \
+ ac_cv_buggy_getaddrinfo=no \
+ ac_cv_file__dev_ptc=no \
+ ac_cv_file__dev_ptmx=yes
+
+# Disable stdlib modules
+# Check for a better way in the future: https://github.com/python/cpython/issues/98558
+CONFIGURE_VARS += \
+ py_cv_module__tkinter=n/a \
+ py_cv_module_nis=n/a
+
+# Workaround for hardfloat mips
+# https://bugs.python.org/issue46265
+ifneq ($(findstring mips,$(CONFIG_ARCH)),)
+ifeq ($(CONFIG_HAS_FPU),y)
+CONFIGURE_VARS += \
+ ax_cv_check_cflags___fno_semantic_interposition=no
+endif
+endif
+
+MAKE_VARS += \
+ PYTHONSTRICTEXTENSIONBUILD=1
+
+CONFIGURE_ARGS += \
+ --enable-optimizations \
+ --enable-shared \
+ --disable-test-modules \
+ --with-build-python \
+ --with-system-ffi \
+ --without-cxx-main \
+ --without-ensurepip \
+ $(if $(CONFIG_IPV6),--enable-ipv6) \
+ $(if $(findstring mips,$(CONFIG_ARCH)),,--with-lto)
+
+define Build/Install
+ $(call Build/Install/Default,)
+
+ $(SED) 's|$(TARGET_AR)|ar|g;s|$(TARGET_CROSS)readelf|readelf|g;s|$(TARGET_CC)|gcc|g;s|$(TARGET_CXX)|g++|g' \
+ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata_*.py \
+ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)-*/Makefile
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON3_VERSION) \
+ $(1)/usr/include/
+
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION) \
+ $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* \
+ $(1)/usr/lib/
+
+ $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/openwrt
+ grep -E \
+ '^(_PYTHON_HOST_PLATFORM|ABIFLAGS|MACHDEP|MULTIARCH)=' \
+ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)-*/Makefile > \
+ $(1)/usr/lib/python$(PYTHON3_VERSION)/openwrt/Makefile-vars
+
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/python*.pc \
+ $(1)/usr/lib/pkgconfig
+
+ $(INSTALL_DIR) $(2)/bin
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON3_VERSION)-config \
+ $(2)/bin/
+ $(SED) \
+ 's|^prefix_real=.*$$$$|prefix_real="$(PYTHON3_DIR)"|' \
+ $(2)/bin/python$(PYTHON3_VERSION)-config
+endef
+
+PYTHON3_BASE_LIB_FILES:= \
+ /usr/lib/python$(PYTHON3_VERSION)/encodings \
+ /usr/lib/python$(PYTHON3_VERSION)/_collections_abc.py \
+ /usr/lib/python$(PYTHON3_VERSION)/_sitebuiltins.py \
+ /usr/lib/python$(PYTHON3_VERSION)/_sysconfigdata_*.py \
+ /usr/lib/python$(PYTHON3_VERSION)/_weakrefset.py \
+ /usr/lib/python$(PYTHON3_VERSION)/abc.py \
+ /usr/lib/python$(PYTHON3_VERSION)/codecs.py \
+ /usr/lib/python$(PYTHON3_VERSION)/genericpath.py \
+ /usr/lib/python$(PYTHON3_VERSION)/io.py \
+ /usr/lib/python$(PYTHON3_VERSION)/os.py \
+ /usr/lib/python$(PYTHON3_VERSION)/posixpath.py \
+ /usr/lib/python$(PYTHON3_VERSION)/site.py \
+ /usr/lib/python$(PYTHON3_VERSION)/sysconfig.py \
+ /usr/lib/python$(PYTHON3_VERSION)/stat.py
+
+PYTHON3_LIB_FILES_DEL+=$(PYTHON3_BASE_LIB_FILES)
+
+define Py3Package/python3-base/filespec
++|/usr/bin/python$(PYTHON3_VERSION)
+$(foreach lib_file,$(PYTHON3_BASE_LIB_FILES),
+ +|$(lib_file)
+)
+endef
+
+define Py3Package/python3-light/filespec
++|/usr/lib/python$(PYTHON3_VERSION)
+-|/usr/lib/python$(PYTHON3_VERSION)/distutils/cygwinccompiler.py
+-|/usr/lib/python$(PYTHON3_VERSION)/idlelib
+-|/usr/lib/python$(PYTHON3_VERSION)/tkinter
+-|/usr/lib/python$(PYTHON3_VERSION)/turtledemo
+-|/usr/lib/python$(PYTHON3_VERSION)/webbrowser.py
+-|/usr/lib/python$(PYTHON3_VERSION)/_osx_support.py
+$(foreach lib_file,$(filter /usr/lib/python$(PYTHON3_VERSION)/%,$(PYTHON3_LIB_FILES_DEL)),
+ -|$(lib_file)
+)
+endef
+
+define Package/libpython3/install
+ # Adding the lib-dynload folder (even just empty) suppresses 2 warnings when starting Python
+ $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/lib-dynload/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON3_VERSION).so* $(1)/usr/lib/
+endef
+
+define Py3Package/python3-base/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python3
+ $(LN) python$(PYTHON3_VERSION) $(1)/usr/bin/python
+endef
+
+Py3Package/python3-light/install:=:
+Package/python3/install:=:
+
+ifeq ($(HOST_OS),Linux)
+HOST_LDFLAGS += \
+ -Wl,--no-as-needed -lrt
+endif
+
+# Would be nice to be able to do this, but hosts are very fiddly
+# HOST_MAKE_VARS += \
+# PYTHONSTRICTEXTENSIONBUILD=1
+
+# Bypass configure test
+HOST_CONFIGURE_VARS += \
+ ac_cv_working_openssl_hashlib=yes
+
+ifeq ($(HOST_OS),Darwin)
+HOST_CONFIGURE_VARS += \
+ ac_cv_header_libintl_h=no
+HOST_MAKE_VARS += \
+ USE_PYTHON_CONFIG_PY=1
+endif
+
+HOST_CONFIGURE_ARGS += \
+ --enable-optimizations \
+ --disable-test-modules \
+ --with-ensurepip=upgrade \
+ --with-ssl-default-suites=openssl \
+ --with-system-expat \
+ --without-cxx-main
+
+define Host/Configure
+ $(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
+ $(call Host/Configure/Default)
+ ls $(HOST_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
+ ls $(HOST_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py3-none-any.whl
+endef
+
+define Host/Install
+ $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
+ rm -rf \
+ $(HOST_PYTHON3_PKG_DIR)/pkg_resources \
+ $(HOST_PYTHON3_PKG_DIR)/setuptools \
+ $(HOST_PYTHON3_PKG_DIR)/setuptools-* \
+ $(HOST_PYTHON3_PKG_DIR)/.setuptools-patched* \
+ $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_*
+ )
+ $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
+ rm -rf \
+ $(HOST_PYTHON3_PKG_DIR)/pip \
+ $(HOST_PYTHON3_PKG_DIR)/pip-* \
+ $(HOST_PYTHON3_PKG_DIR)/.pip-patched* \
+ $(HOST_PYTHON3_PKG_DIR)/.pip_installed_*
+ )
+ $(call Host/Install/Default)
+ $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
+ $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-host-setuptools,)
+ touch $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
+ )
+ $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
+ $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-host-pip,)
+ touch $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)
+ )
+endef
+
+$(eval $(call HostBuild))
+
+$(eval $(call BuildPackage,libpython3))
+$(eval $(call BuildPackage,python3))
+
+$(eval $(call Py3Package,python3-base))
+$(eval $(call Py3Package,python3-light))
+
+$(eval $(call BuildPackage,python3-base))
+$(eval $(call BuildPackage,python3-light))
+
+$(eval $(call BuildPackage,python3-base-src))
+$(eval $(call BuildPackage,python3-light-src))
+
+$(foreach package, $(PYTHON3_PACKAGES), \
+ $(eval $(call Py3Package,$(package))) \
+ $(eval $(call BuildPackage,$(package))) \
+ $(eval $(call BuildPackage,$(package)-src)) \
+)
diff --git a/external/subpack/lang/python/python3/files/python3-package-asyncio.mk b/external/subpack/lang/python/python3/files/python3-package-asyncio.mk
new file mode 100644
index 0000000..c4c3139
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-asyncio.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-asyncio
+$(call Package/python3/Default)
+ TITLE+= asyncio module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-asyncio/description
+$(call Package/python3/Default/description)
+
+This package contains the asyncio module.
+endef
+
+$(eval $(call Py3BasePackage,python3-asyncio, \
+ /usr/lib/python$(PYTHON3_VERSION)/asyncio \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-cgi.mk b/external/subpack/lang/python/python3/files/python3-package-cgi.mk
new file mode 100644
index 0000000..e4bb110
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-cgi.mk
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2006-2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-cgi
+$(call Package/python3/Default)
+ TITLE+= cgi module
+ DEPENDS:=+python3-light +python3-email
+endef
+
+define Package/python3-cgitb
+$(call Package/python3/Default)
+ TITLE+= cgitb module
+ DEPENDS:=+python3-light +python3-cgi +python3-pydoc
+endef
+
+define Package/python3-cgi/description
+$(call Package/python3/Default/description)
+
+This package contains the cgi module.
+endef
+
+define Package/python3-cgitb/description
+$(call Package/python3/Default/description)
+
+This package contains the cgitb module.
+endef
+
+$(eval $(call Py3BasePackage,python3-cgi, \
+ /usr/lib/python$(PYTHON3_VERSION)/cgi.py \
+))
+
+$(eval $(call Py3BasePackage,python3-cgitb, \
+ /usr/lib/python$(PYTHON3_VERSION)/cgitb.py \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-codecs.mk b/external/subpack/lang/python/python3/files/python3-package-codecs.mk
new file mode 100644
index 0000000..712cb28
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-codecs.mk
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-codecs
+$(call Package/python3/Default)
+ TITLE+= codecs/Unicode support
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-codecs/description
+$(call Package/python3/Default/description)
+
+This package contains codecs and Unicode support.
+endef
+
+$(eval $(call Py3BasePackage,python3-codecs, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_cn.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_hk.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_iso2022.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_jp.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_kr.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_codecs_tw.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/unicodedata.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-ctypes.mk b/external/subpack/lang/python/python3/files/python3-package-ctypes.mk
new file mode 100644
index 0000000..bbd0aff
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-ctypes.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-ctypes
+$(call Package/python3/Default)
+ TITLE+= ctypes module
+ DEPENDS:=+python3-light +libffi
+endef
+
+define Package/python3-ctypes/description
+$(call Package/python3/Default/description)
+
+This package contains the ctypes module.
+endef
+
+$(eval $(call Py3BasePackage,python3-ctypes, \
+ /usr/lib/python$(PYTHON3_VERSION)/ctypes \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-dbm.mk b/external/subpack/lang/python/python3/files/python3-package-dbm.mk
new file mode 100644
index 0000000..3de584f
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-dbm.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-dbm
+$(call Package/python3/Default)
+ TITLE+= dbm module
+ DEPENDS:=+python3-light +libgdbm
+endef
+
+define Package/python3-dbm/description
+$(call Package/python3/Default/description)
+
+This package contains the dbm module.
+endef
+
+$(eval $(call Py3BasePackage,python3-dbm, \
+ /usr/lib/python$(PYTHON3_VERSION)/dbm \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_dbm.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_gdbm.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-decimal.mk b/external/subpack/lang/python/python3/files/python3-package-decimal.mk
new file mode 100644
index 0000000..98f632b
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-decimal.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-decimal
+$(call Package/python3/Default)
+ TITLE+= decimal module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-decimal/description
+$(call Package/python3/Default/description)
+
+This package contains the decimal module.
+endef
+
+$(eval $(call Py3BasePackage,python3-decimal, \
+ /usr/lib/python$(PYTHON3_VERSION)/decimal.py \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_decimal.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-dev.mk b/external/subpack/lang/python/python3/files/python3-package-dev.mk
new file mode 100644
index 0000000..871fff9
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-dev.mk
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-dev
+$(call Package/python3/Default)
+ TITLE+= development files
+ DEPENDS:=+python3 +python3-lib2to3
+endef
+
+define Package/python3-dev/description
+$(call Package/python3/Default/description)
+
+This package contains files for building Python modules, extending the
+Python interpreter, or embedded Python in applications.
+endef
+
+define Py3Package/python3-dev/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/python$(PYTHON3_VERSION)-config $(1)/usr/bin
+ $(LN) python$(PYTHON3_VERSION)-config $(1)/usr/bin/python3-config
+ $(LN) python$(PYTHON3_VERSION)-config $(1)/usr/bin/python-config
+ $(LN) python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)/libpython$(PYTHON3_VERSION).a $(1)/usr/lib/
+endef
+
+$(eval $(call Py3BasePackage,python3-dev, \
+ /usr/lib/python$(PYTHON3_VERSION)/config-$(PYTHON3_VERSION)-* \
+ /usr/include/python$(PYTHON3_VERSION) \
+ /usr/lib/pkgconfig \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-distutils.mk b/external/subpack/lang/python/python3/files/python3-package-distutils.mk
new file mode 100644
index 0000000..13a8f38
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-distutils.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-distutils
+$(call Package/python3/Default)
+ TITLE+= distutils module
+ DEPENDS:=+python3-light +python3-email
+endef
+
+define Package/python3-distutils/description
+$(call Package/python3/Default/description)
+
+This package contains the distutils module.
+endef
+
+$(eval $(call Py3BasePackage,python3-distutils, \
+ /usr/lib/python$(PYTHON3_VERSION)/distutils \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-email.mk b/external/subpack/lang/python/python3/files/python3-package-email.mk
new file mode 100644
index 0000000..563f6f8
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-email.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-email
+$(call Package/python3/Default)
+ TITLE+= email module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-email/description
+$(call Package/python3/Default/description)
+
+This package contains the email module.
+endef
+
+$(eval $(call Py3BasePackage,python3-email, \
+ /usr/lib/python$(PYTHON3_VERSION)/email \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-lib2to3.mk b/external/subpack/lang/python/python3/files/python3-package-lib2to3.mk
new file mode 100644
index 0000000..c2aa84d
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-lib2to3.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-lib2to3
+$(call Package/python3/Default)
+ TITLE+= lib2to3 module
+ DEPENDS:=+python3
+endef
+
+define Package/python3-lib2to3/description
+$(call Package/python3/Default/description)
+
+This package contains the lib2to3 module.
+endef
+
+$(eval $(call Py3BasePackage,python3-lib2to3, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib2to3 \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-logging.mk b/external/subpack/lang/python/python3/files/python3-package-logging.mk
new file mode 100644
index 0000000..7b770de
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-logging.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-logging
+$(call Package/python3/Default)
+ TITLE+= logging module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-logging/description
+$(call Package/python3/Default/description)
+
+This package contains the logging module.
+endef
+
+$(eval $(call Py3BasePackage,python3-logging, \
+ /usr/lib/python$(PYTHON3_VERSION)/logging \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-lzma.mk b/external/subpack/lang/python/python3/files/python3-package-lzma.mk
new file mode 100644
index 0000000..0e984cb
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-lzma.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-lzma
+$(call Package/python3/Default)
+ TITLE+= lzma module
+ DEPENDS:=+python3-light +liblzma
+endef
+
+define Package/python3-lzma/description
+$(call Package/python3/Default/description)
+
+This package contains the lzma module.
+endef
+
+$(eval $(call Py3BasePackage,python3-lzma, \
+ /usr/lib/python$(PYTHON3_VERSION)/lzma.py \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_lzma.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-multiprocessing.mk b/external/subpack/lang/python/python3/files/python3-package-multiprocessing.mk
new file mode 100644
index 0000000..7f9b69a
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-multiprocessing.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-multiprocessing
+$(call Package/python3/Default)
+ TITLE+= multiprocessing module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-multiprocessing/description
+$(call Package/python3/Default/description)
+
+This package contains the multiprocessing module.
+endef
+
+$(eval $(call Py3BasePackage,python3-multiprocessing, \
+ /usr/lib/python$(PYTHON3_VERSION)/multiprocessing \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_multiprocessing.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-ncurses.mk b/external/subpack/lang/python/python3/files/python3-package-ncurses.mk
new file mode 100644
index 0000000..5db04b8
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-ncurses.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-ncurses
+$(call Package/python3/Default)
+ TITLE+= ncurses module
+ DEPENDS:=+python3-light +libncursesw
+endef
+
+define Package/python3-ncurses/description
+$(call Package/python3/Default/description)
+
+This package contains the ncurses module.
+endef
+
+$(eval $(call Py3BasePackage,python3-ncurses, \
+ /usr/lib/python$(PYTHON3_VERSION)/curses \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_curses.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_curses_panel.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-openssl.mk b/external/subpack/lang/python/python3/files/python3-package-openssl.mk
new file mode 100644
index 0000000..eec9daf
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-openssl.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-openssl
+$(call Package/python3/Default)
+ TITLE+= ssl module
+ DEPENDS:=+python3-light +libopenssl +ca-certs
+endef
+
+define Package/python3-openssl/description
+$(call Package/python3/Default/description)
+
+This package contains the ssl module.
+endef
+
+$(eval $(call Py3BasePackage,python3-openssl, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_hashlib.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ssl.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-pydoc.mk b/external/subpack/lang/python/python3/files/python3-package-pydoc.mk
new file mode 100644
index 0000000..d5bbe7c
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-pydoc.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-pydoc
+$(call Package/python3/Default)
+ TITLE+= pydoc module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-pydoc/description
+$(call Package/python3/Default/description)
+
+This package contains the pydoc module.
+endef
+
+$(eval $(call Py3BasePackage,python3-pydoc, \
+ /usr/lib/python$(PYTHON3_VERSION)/doctest.py \
+ /usr/lib/python$(PYTHON3_VERSION)/pydoc.py \
+ /usr/lib/python$(PYTHON3_VERSION)/pydoc_data \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-readline.mk b/external/subpack/lang/python/python3/files/python3-package-readline.mk
new file mode 100644
index 0000000..846b711
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-readline.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2021 Alexandru Ardelean <ardeleanalex@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-readline
+$(call Package/python3/Default)
+ TITLE+= readline module
+ DEPENDS:=+python3-light +libreadline
+endef
+
+define Package/python3-readline/description
+$(call Package/python3/Default/description)
+
+This package contains the readline module.
+endef
+
+$(eval $(call Py3BasePackage,python3-readline, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/readline.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-sqlite3.mk b/external/subpack/lang/python/python3/files/python3-package-sqlite3.mk
new file mode 100644
index 0000000..06f34be
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-sqlite3.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-sqlite3
+$(call Package/python3/Default)
+ TITLE+= sqlite3 module
+ DEPENDS:=+python3-light +libsqlite3
+endef
+
+define Package/python3-sqlite3/description
+$(call Package/python3/Default/description)
+
+This package contains the sqlite3 module.
+endef
+
+$(eval $(call Py3BasePackage,python3-sqlite3, \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_sqlite3.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/sqlite3 \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-unittest.mk b/external/subpack/lang/python/python3/files/python3-package-unittest.mk
new file mode 100644
index 0000000..eb5f09e
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-unittest.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-unittest
+$(call Package/python3/Default)
+ TITLE+= unittest module
+ DEPENDS:=+python3-light
+endef
+
+define Package/python3-unittest/description
+$(call Package/python3/Default/description)
+
+This package contains the unittest module.
+endef
+
+$(eval $(call Py3BasePackage,python3-unittest, \
+ /usr/lib/python$(PYTHON3_VERSION)/unittest \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-urllib.mk b/external/subpack/lang/python/python3/files/python3-package-urllib.mk
new file mode 100644
index 0000000..e84e589
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-urllib.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2019 Alexandru Ardelean <ardeleanalex@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-urllib
+$(call Package/python3/Default)
+ TITLE+= URL handling modules
+ DEPENDS:=+python3-light +python3-email
+endef
+
+define Package/python3-urllib/description
+$(call Package/python3/Default/description)
+
+This package contains the URL handling modules.
+endef
+
+$(eval $(call Py3BasePackage,python3-urllib, \
+ /usr/lib/python$(PYTHON3_VERSION)/urllib \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-uuid.mk b/external/subpack/lang/python/python3/files/python3-package-uuid.mk
new file mode 100644
index 0000000..ae18873
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-uuid.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2021 Alexandru Ardelean <ardeleanalex@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-uuid
+$(call Package/python3/Default)
+ TITLE+= uuid module
+ DEPENDS:=+python3-light +libuuid
+endef
+
+define Package/python3-uuid/description
+$(call Package/python3/Default/description)
+
+This package contains the uuid module.
+endef
+
+$(eval $(call Py3BasePackage,python3-uuid, \
+ /usr/lib/python$(PYTHON3_VERSION)/uuid.py \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_uuid.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-venv.mk b/external/subpack/lang/python/python3/files/python3-package-venv.mk
new file mode 100644
index 0000000..536c985
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-venv.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2023 Jeffery To
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-venv
+$(call Package/python3/Default)
+ TITLE+= venv module
+ DEPENDS:=+python3
+endef
+
+define Package/python3-venv/description
+$(call Package/python3/Default/description)
+
+This package contains the venv module.
+endef
+
+$(eval $(call Py3BasePackage,python3-venv, \
+ /usr/lib/python$(PYTHON3_VERSION)/ensurepip \
+ /usr/lib/python$(PYTHON3_VERSION)/venv \
+ , \
+ DO_NOT_ADD_TO_PACKAGE_DEPENDS \
+))
diff --git a/external/subpack/lang/python/python3/files/python3-package-xml.mk b/external/subpack/lang/python/python3/files/python3-package-xml.mk
new file mode 100644
index 0000000..97669e5
--- /dev/null
+++ b/external/subpack/lang/python/python3/files/python3-package-xml.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/python3-xml
+$(call Package/python3/Default)
+ TITLE+= XML modules
+ DEPENDS:=+python3-light +python3-urllib
+endef
+
+define Package/python3-xml/description
+$(call Package/python3/Default/description)
+
+This package contains the XML modules.
+endef
+
+$(eval $(call Py3BasePackage,python3-xml, \
+ /usr/lib/python$(PYTHON3_VERSION)/xml \
+ /usr/lib/python$(PYTHON3_VERSION)/xmlrpc \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_elementtree.$(PYTHON3_SO_SUFFIX) \
+ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/pyexpat.$(PYTHON3_SO_SUFFIX) \
+))
diff --git a/external/subpack/lang/python/python3/patches-host-pip/.gitkeep b/external/subpack/lang/python/python3/patches-host-pip/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches-host-pip/.gitkeep
diff --git a/external/subpack/lang/python/python3/patches-host-setuptools/.gitkeep b/external/subpack/lang/python/python3/patches-host-setuptools/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches-host-setuptools/.gitkeep
diff --git a/external/subpack/lang/python/python3/patches-host-setuptools/0001-Adjust-library-header-paths-for-cross-compilation.patch b/external/subpack/lang/python/python3/patches-host-setuptools/0001-Adjust-library-header-paths-for-cross-compilation.patch
new file mode 100644
index 0000000..06dbb43
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches-host-setuptools/0001-Adjust-library-header-paths-for-cross-compilation.patch
@@ -0,0 +1,38 @@
+From e359a7a3c4f9e70360a068bef19c95938fdacede 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>
+[adapt for setuptools, rename environment variable, use fixed lib path]
+Signed-off-by: Jeffery To <jeffery.to@gmail.com>
+---
+ Lib/distutils/command/build_ext.py | 5 ++++-
+ Lib/sysconfig.py | 15 +++++++++++----
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+--- a/setuptools/_distutils/command/build_ext.py
++++ b/setuptools/_distutils/command/build_ext.py
+@@ -238,7 +238,10 @@ class build_ext(Command):
+ 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 'STAGING_DIR' in os.environ:
++ libdir = os.environ.get('STAGING_DIR') + '/usr/lib'
++ self.library_dirs.append(libdir)
+ else:
+ # building python standard extensions
+ self.library_dirs.append('.')
diff --git a/external/subpack/lang/python/python3/patches/003-do-not-run-compileall.patch b/external/subpack/lang/python/python3/patches/003-do-not-run-compileall.patch
new file mode 100644
index 0000000..7c0044f
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/003-do-not-run-compileall.patch
@@ -0,0 +1,18 @@
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -2133,6 +2133,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
+ $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+ $(DESTDIR)$(LIBDEST)/distutils/tests ; \
+ fi
++ifeq (1,)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
+ -j0 -d $(LIBDEST) -f \
+@@ -2160,6 +2161,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
+ $(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/external/subpack/lang/python/python3/patches/004-do-not-write-bytes-codes.patch b/external/subpack/lang/python/python3/patches/004-do-not-write-bytes-codes.patch
new file mode 100644
index 0000000..6f01f9d
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/004-do-not-write-bytes-codes.patch
@@ -0,0 +1,11 @@
+--- a/Python/initconfig.c
++++ b/Python/initconfig.c
+@@ -198,7 +198,7 @@ int Py_NoSiteFlag = 0; /* Suppress 'impo
+ int Py_BytesWarningFlag = 0; /* Warn on str(bytes) and str(buffer) */
+ int Py_FrozenFlag = 0; /* Needed by getpath.c */
+ int Py_IgnoreEnvironmentFlag = 0; /* e.g. PYTHONPATH, PYTHONHOME */
+-int Py_DontWriteBytecodeFlag = 0; /* Suppress writing bytecode files (*.pyc) */
++int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.pyc) */
+ int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
+ int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */
+ int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
diff --git a/external/subpack/lang/python/python3/patches/006-do-not-add-multiarch-local-paths.patch b/external/subpack/lang/python/python3/patches/006-do-not-add-multiarch-local-paths.patch
new file mode 100644
index 0000000..7b35eb7
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/006-do-not-add-multiarch-local-paths.patch
@@ -0,0 +1,19 @@
+--- a/setup.py
++++ b/setup.py
+@@ -843,16 +843,9 @@ class PyBuildExt(build_ext):
+ add_dir_to_list(dir_list, directory)
+
+ def configure_compiler(self):
+- # Ensure that /usr/local is always used, but the local build
+- # directories (i.e. '.' and 'Include') must be first. See issue
+- # 10520.
+- 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')
+ # 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):
diff --git a/external/subpack/lang/python/python3/patches/008-distutils-use-python-sysroot.patch b/external/subpack/lang/python/python3/patches/008-distutils-use-python-sysroot.patch
new file mode 100644
index 0000000..c3e8562
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/008-distutils-use-python-sysroot.patch
@@ -0,0 +1,60 @@
+From e359a7a3c4f9e70360a068bef19c95938fdacede 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>
+---
+ Lib/distutils/command/build_ext.py | 5 ++++-
+ Lib/sysconfig.py | 15 +++++++++++----
+ 2 files changed, 15 insertions(+), 5 deletions(-)
+
+--- a/Lib/distutils/command/build_ext.py
++++ b/Lib/distutils/command/build_ext.py
+@@ -234,7 +234,10 @@ class build_ext(Command):
+ 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('.')
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -168,10 +168,17 @@ _SCHEME_KEYS = ('stdlib', 'platstdlib',
+ _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
+
diff --git a/external/subpack/lang/python/python3/patches/010-no-ncursesw.patch b/external/subpack/lang/python/python3/patches/010-no-ncursesw.patch
new file mode 100644
index 0000000..137c433
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/010-no-ncursesw.patch
@@ -0,0 +1,52 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -5839,20 +5839,13 @@ if test "$with_readline" != no; then
+ # library. NOTE: Keep the precedence of listed libraries synchronised
+ # with setup.py.
+ AC_MSG_CHECKING([how to link readline libs])
+- for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
+- if test -z "$py_libtermcap"; then
+- READLINE_LIBS="-l$LIBREADLINE"
+- else
+- READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap"
+- fi
+- LIBS="$READLINE_LIBS $LIBS_no_readline"
+- AC_LINK_IFELSE(
+- [AC_LANG_CALL([],[readline])],
+- [py_cv_lib_readline=yes])
+- if test $py_cv_lib_readline = yes; then
+- break
+- fi
+- done
++ PKG_CHECK_MODULES_STATIC(
++ [READLINE], [readline], [
++ py_cv_lib_readline=yes
++ AC_DEFINE(HAVE_LIBREADLINE, 1,
++ [Define to build the readline module.])
++ ], py_cv_lib_readline=no
++ )
+
+ # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts
+ #AC_SUBST([READLINE_LIBS])
+@@ -5860,8 +5853,6 @@ if test "$with_readline" != no; then
+ AC_MSG_RESULT([none])
+ else
+ AC_MSG_RESULT([$READLINE_LIBS])
+- AC_DEFINE(HAVE_LIBREADLINE, 1,
+- [Define to build the readline module.])
+ fi
+ fi
+
+@@ -6099,12 +6090,6 @@ then
+ [Define if you have struct stat.st_mtimensec])
+ fi
+
+-# first curses header check
+-ac_save_cppflags="$CPPFLAGS"
+-if test "$cross_compiling" = no; then
+- CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+-fi
+-
+ AC_CHECK_HEADERS(curses.h ncurses.h)
+
+ # On Solaris, term.h requires curses.h
diff --git a/external/subpack/lang/python/python3/patches/024-musl-find_library.patch b/external/subpack/lang/python/python3/patches/024-musl-find_library.patch
new file mode 100644
index 0000000..f986a7a
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/024-musl-find_library.patch
@@ -0,0 +1,74 @@
+https://bugs.python.org/issue21622
+
+Based on the patch from Alpine Linux
+https://git.alpinelinux.org/aports/tree/main/python2/musl-find_library.patch
+
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -92,6 +92,8 @@ elif sys.platform.startswith("aix"):
+ elif os.name == "posix":
+ # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
+ import re, tempfile
++ from glob import glob
++ musl_ldso = glob('/lib/ld-musl-*.so.1')
+
+ def _is_elf(filename):
+ "Return True if the given file is an ELF file"
+@@ -265,6 +267,57 @@ elif os.name == "posix":
+ def find_library(name, is64 = False):
+ return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+
++ elif musl_ldso and os.path.isfile(musl_ldso[0]):
++
++ def _is_elf(filepath):
++ try:
++ with open(filepath, 'rb') as fh:
++ return fh.read(4) == b'\x7fELF'
++ except:
++ return False
++
++ def find_library(name):
++ # absolute name?
++ if os.path.isabs(name):
++ if _is_elf(name):
++ return name
++ else:
++ return None
++
++ # special case for unified standard libs
++ stdlibs = ['libcrypt.so', 'libdl.so', 'libm.so', 'libpthread.so', 'libresolv.so', 'librt.so', 'libutil.so', 'libxnet.so']
++ if name in stdlibs:
++ name = 'libc.so'
++ elif ('lib' + name + '.so') in stdlibs:
++ name = 'c'
++
++ paths = []
++ # read path list from /etc/ld-musl-$(ARCH).path
++ path_list = musl_ldso[0].replace('/lib/', '/etc/').replace('.so.1', '.path')
++ try:
++ with open(path_list, 'r') as fh:
++ paths = [path for line in fh for path in line.rstrip('\n').split(':') if path]
++ except:
++ paths = []
++ # default path list if /etc/ld-musl-$(ARCH).path is empty or does not exist
++ if not paths:
++ paths = ['/lib', '/usr/local/lib', '/usr/lib']
++
++ # prepend paths from LD_LIBRARY_PATH
++ if 'LD_LIBRARY_PATH' in os.environ:
++ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
++
++ for d in paths:
++ f = os.path.join(d, name)
++ if _is_elf(f):
++ return os.path.basename(f)
++
++ prefix = os.path.join(d, 'lib'+name)
++ for suffix in ['.so', '.so.*']:
++ for f in glob('{0}{1}'.format(prefix, suffix)):
++ if _is_elf(f):
++ return os.path.basename(f)
++
+ else:
+
+ def _findSoname_ldconfig(name):
diff --git a/external/subpack/lang/python/python3/patches/025-choose-python-config-version.patch b/external/subpack/lang/python/python3/patches/025-choose-python-config-version.patch
new file mode 100644
index 0000000..3c74874
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/025-choose-python-config-version.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -2178,7 +2178,7 @@ python-config: $(srcdir)/Misc/python-con
+ @ # On Darwin, always use the python version of the script, the shell
+ @ # version doesn't use the compiler customizations that are provided
+ @ # in python (_osx_support.py).
+- @if test `uname -s` = Darwin; then \
++ @if test "$(USE_PYTHON_CONFIG_PY)" = 1; then \
+ cp python-config.py python-config; \
+ fi
+
diff --git a/external/subpack/lang/python/python3/patches/026-openssl-feature-flags.patch b/external/subpack/lang/python/python3/patches/026-openssl-feature-flags.patch
new file mode 100644
index 0000000..604f41d
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/026-openssl-feature-flags.patch
@@ -0,0 +1,65 @@
+--- a/Modules/_hashopenssl.c
++++ b/Modules/_hashopenssl.c
+@@ -45,10 +45,18 @@
+
+ #define MUNCH_SIZE INT_MAX
+
++#ifdef NID_id_scrypt
+ #define PY_OPENSSL_HAS_SCRYPT 1
++#endif
++#ifdef NID_sha3_256
+ #define PY_OPENSSL_HAS_SHA3 1
++#endif
++#ifdef NID_shake256
+ #define PY_OPENSSL_HAS_SHAKE 1
++#endif
++#ifdef NID_blake2s256
+ #define PY_OPENSSL_HAS_BLAKE2 1
++#endif
+
+ #if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ #define PY_EVP_MD EVP_MD
+@@ -120,19 +128,27 @@ static const py_hashentry_t py_hashes[]
+ PY_HASH_ENTRY(Py_hash_sha384, "SHA384", SN_sha384, NID_sha384),
+ PY_HASH_ENTRY(Py_hash_sha512, "SHA512", SN_sha512, NID_sha512),
+ /* truncated sha2 */
++#ifdef NID_sha512_256
+ PY_HASH_ENTRY(Py_hash_sha512_224, "SHA512_224", SN_sha512_224, NID_sha512_224),
+ PY_HASH_ENTRY(Py_hash_sha512_256, "SHA512_256", SN_sha512_256, NID_sha512_256),
++#endif
+ /* sha3 */
++#ifdef PY_OPENSSL_HAS_SHA3
+ PY_HASH_ENTRY(Py_hash_sha3_224, NULL, SN_sha3_224, NID_sha3_224),
+ PY_HASH_ENTRY(Py_hash_sha3_256, NULL, SN_sha3_256, NID_sha3_256),
+ PY_HASH_ENTRY(Py_hash_sha3_384, NULL, SN_sha3_384, NID_sha3_384),
+ PY_HASH_ENTRY(Py_hash_sha3_512, NULL, SN_sha3_512, NID_sha3_512),
++#endif
+ /* sha3 shake */
++#ifdef PY_OPENSSL_HAS_SHAKE
+ PY_HASH_ENTRY(Py_hash_shake_128, NULL, SN_shake128, NID_shake128),
+ PY_HASH_ENTRY(Py_hash_shake_256, NULL, SN_shake256, NID_shake256),
++#endif
+ /* blake2 digest */
++#ifdef PY_OPENSSL_HAS_BLAKE2
+ PY_HASH_ENTRY(Py_hash_blake2s, "blake2s256", SN_blake2s256, NID_blake2s256),
+ PY_HASH_ENTRY(Py_hash_blake2b, "blake2b512", SN_blake2b512, NID_blake2b512),
++#endif
+ PY_HASH_ENTRY(NULL, NULL, NULL, 0),
+ };
+
+@@ -874,11 +890,15 @@ py_evp_fromname(PyObject *module, const
+ goto exit;
+ }
+
++#ifndef EVP_MD_FLAG_XOF
++ type = get_hashlib_state(module)->EVPtype;
++#else
+ if ((EVP_MD_flags(digest) & EVP_MD_FLAG_XOF) == EVP_MD_FLAG_XOF) {
+ type = get_hashlib_state(module)->EVPXOFtype;
+ } else {
+ type = get_hashlib_state(module)->EVPtype;
+ }
++#endif
+
+ self = newEVPobject(type);
+ if (self == NULL) {
diff --git a/external/subpack/lang/python/python3/patches/100-gh-95855-Refactor-platform-triplet-detection-code-GH-107221.patch b/external/subpack/lang/python/python3/patches/100-gh-95855-Refactor-platform-triplet-detection-code-GH-107221.patch
new file mode 100644
index 0000000..8f1ae5b
--- /dev/null
+++ b/external/subpack/lang/python/python3/patches/100-gh-95855-Refactor-platform-triplet-detection-code-GH-107221.patch
@@ -0,0 +1,476 @@
+From c163d7f0b67a568e9b64eeb9c1cbbaa127818596 Mon Sep 17 00:00:00 2001
+From: Jeffery To <jeffery.to@gmail.com>
+Date: Thu, 24 Aug 2023 20:22:50 +0800
+Subject: [PATCH] gh-95855: Refactor platform triplet detection code, add
+ detection for MIPS soft float and musl libc (#107221)
+
+- Move platform triplet detection code into Misc/platform_triplet.c
+- Refactor MIPS detection, use defined(__mips64) to detect MIPS64
+- Compute libc values in separate section
+- Add detection for MIPS soft float
+- Add detection for musl
+
+musl supports SPE with its soft-float ABI:
+https://git.musl-libc.org/cgit/musl/commit/?id=7be59733d71ada3a32a98622507399253f1d5e48
+
+Original patch by Christian Heimes.
+
+Co-authored-by: Christian Heimes <christian@python.org>
+Co-authored-by: Erlend E. Aasland <erlend@python.org>
+
+[omit news, changes to configure; adapt for Python 3.11]
+Signed-off-by: Jeffery To <jeffery.to@gmail.com>
+---
+ ...3-07-25-02-30-00.gh-issue-95855.wA7rAf.rst | 2 +
+ Misc/platform_triplet.c | 255 ++++++++++++++++++
+ configure | 192 +------------
+ configure.ac | 192 +------------
+ 4 files changed, 265 insertions(+), 376 deletions(-)
+ create mode 100644 Misc/NEWS.d/next/Build/2023-07-25-02-30-00.gh-issue-95855.wA7rAf.rst
+ create mode 100644 Misc/platform_triplet.c
+
+--- /dev/null
++++ b/Misc/platform_triplet.c
+@@ -0,0 +1,255 @@
++/* Detect platform triplet from builtin defines
++ * cc -E Misc/platform_triplet.c | grep '^PLATFORM_TRIPLET=' | tr -d ' '
++ */
++#undef bfin
++#undef cris
++#undef fr30
++#undef linux
++#undef hppa
++#undef hpux
++#undef i386
++#undef mips
++#undef powerpc
++#undef sparc
++#undef unix
++#if defined(__ANDROID__)
++ # Android is not a multiarch system.
++#elif defined(__linux__)
++/*
++ * BEGIN of Linux block
++ */
++// Detect libc (based on config.guess)
++# include <features.h>
++# if defined(__UCLIBC__)
++# error uclibc not supported
++# elif defined(__dietlibc__)
++# error dietlibc not supported
++# elif defined(__GLIBC__)
++# define LIBC gnu
++# define LIBC_X32 gnux32
++# if defined(__ARM_PCS_VFP)
++# define LIBC_ARM gnueabihf
++# else
++# define LIBC_ARM gnueabi
++# endif
++# if defined(__loongarch__)
++# if defined(__loongarch_soft_float)
++# define LIBC_LA gnusf
++# elif defined(__loongarch_single_float)
++# define LIBC_LA gnuf32
++# elif defined(__loongarch_double_float)
++# define LIBC_LA gnu
++# else
++# error unknown loongarch floating-point base abi
++# endif
++# endif
++# if defined(_MIPS_SIM)
++# if defined(__mips_hard_float)
++# if _MIPS_SIM == _ABIO32
++# define LIBC_MIPS gnu
++# elif _MIPS_SIM == _ABIN32
++# define LIBC_MIPS gnuabin32
++# elif _MIPS_SIM == _ABI64
++# define LIBC_MIPS gnuabi64
++# else
++# error unknown mips sim value
++# endif
++# else
++# if _MIPS_SIM == _ABIO32
++# define LIBC_MIPS gnusf
++# elif _MIPS_SIM == _ABIN32
++# define LIBC_MIPS gnuabin32sf
++# elif _MIPS_SIM == _ABI64
++# define LIBC_MIPS gnuabi64sf
++# else
++# error unknown mips sim value
++# endif
++# endif
++# endif
++# if defined(__SPE__)
++# define LIBC_PPC gnuspe
++# else
++# define LIBC_PPC gnu
++# endif
++# else
++// Heuristic to detect musl libc
++# include <stdarg.h>
++# ifdef __DEFINED_va_list
++# define LIBC musl
++# define LIBC_X32 muslx32
++# if defined(__ARM_PCS_VFP)
++# define LIBC_ARM musleabihf
++# else
++# define LIBC_ARM musleabi
++# endif
++# if defined(__loongarch__)
++# if defined(__loongarch_soft_float)
++# define LIBC_LA muslsf
++# elif defined(__loongarch_single_float)
++# define LIBC_LA muslf32
++# elif defined(__loongarch_double_float)
++# define LIBC_LA musl
++# else
++# error unknown loongarch floating-point base abi
++# endif
++# endif
++# if defined(_MIPS_SIM)
++# if defined(__mips_hard_float)
++# if _MIPS_SIM == _ABIO32
++# define LIBC_MIPS musl
++# elif _MIPS_SIM == _ABIN32
++# define LIBC_MIPS musln32
++# elif _MIPS_SIM == _ABI64
++# define LIBC_MIPS musl
++# else
++# error unknown mips sim value
++# endif
++# else
++# if _MIPS_SIM == _ABIO32
++# define LIBC_MIPS muslsf
++# elif _MIPS_SIM == _ABIN32
++# define LIBC_MIPS musln32sf
++# elif _MIPS_SIM == _ABI64
++# define LIBC_MIPS muslsf
++# else
++# error unknown mips sim value
++# endif
++# endif
++# endif
++# if defined(_SOFT_FLOAT) || defined(__NO_FPRS__)
++# define LIBC_PPC muslsf
++# else
++# define LIBC_PPC musl
++# endif
++# else
++# error unknown libc
++# endif
++# endif
++
++# if defined(__x86_64__) && defined(__LP64__)
++PLATFORM_TRIPLET=x86_64-linux-LIBC
++# elif defined(__x86_64__) && defined(__ILP32__)
++PLATFORM_TRIPLET=x86_64-linux-LIBC_X32
++# elif defined(__i386__)
++PLATFORM_TRIPLET=i386-linux-LIBC
++# elif defined(__aarch64__) && defined(__AARCH64EL__)
++# if defined(__ILP32__)
++PLATFORM_TRIPLET=aarch64_ilp32-linux-LIBC
++# else
++PLATFORM_TRIPLET=aarch64-linux-LIBC
++# endif
++# elif defined(__aarch64__) && defined(__AARCH64EB__)
++# if defined(__ILP32__)
++PLATFORM_TRIPLET=aarch64_be_ilp32-linux-LIBC
++# else
++PLATFORM_TRIPLET=aarch64_be-linux-LIBC
++# endif
++# elif defined(__alpha__)
++PLATFORM_TRIPLET=alpha-linux-LIBC
++# elif defined(__ARM_EABI__)
++# if defined(__ARMEL__)
++PLATFORM_TRIPLET=arm-linux-LIBC_ARM
++# else
++PLATFORM_TRIPLET=armeb-linux-LIBC_ARM
++# endif
++# elif defined(__hppa__)
++PLATFORM_TRIPLET=hppa-linux-LIBC
++# elif defined(__ia64__)
++PLATFORM_TRIPLET=ia64-linux-LIBC
++# elif defined(__loongarch__) && defined(__loongarch_lp64)
++PLATFORM_TRIPLET=loongarch64-linux-LIBC_LA
++# elif defined(__m68k__) && !defined(__mcoldfire__)
++PLATFORM_TRIPLET=m68k-linux-LIBC
++# elif defined(__mips__)
++# if defined(__mips_isa_rev) && (__mips_isa_rev >=6)
++# if defined(_MIPSEL) && defined(__mips64)
++PLATFORM_TRIPLET=mipsisa64r6el-linux-LIBC_MIPS
++# elif defined(_MIPSEL)
++PLATFORM_TRIPLET=mipsisa32r6el-linux-LIBC_MIPS
++# elif defined(__mips64)
++PLATFORM_TRIPLET=mipsisa64r6-linux-LIBC_MIPS
++# else
++PLATFORM_TRIPLET=mipsisa32r6-linux-LIBC_MIPS
++# endif
++# else
++# if defined(_MIPSEL) && defined(__mips64)
++PLATFORM_TRIPLET=mips64el-linux-LIBC_MIPS
++# elif defined(_MIPSEL)
++PLATFORM_TRIPLET=mipsel-linux-LIBC_MIPS
++# elif defined(__mips64)
++PLATFORM_TRIPLET=mips64-linux-LIBC_MIPS
++# else
++PLATFORM_TRIPLET=mips-linux-LIBC_MIPS
++# endif
++# endif
++# elif defined(__or1k__)
++PLATFORM_TRIPLET=or1k-linux-LIBC
++# elif defined(__powerpc64__)
++# if defined(__LITTLE_ENDIAN__)
++PLATFORM_TRIPLET=powerpc64le-linux-LIBC
++# else
++PLATFORM_TRIPLET=powerpc64-linux-LIBC
++# endif
++# elif defined(__powerpc__)
++PLATFORM_TRIPLET=powerpc-linux-LIBC_PPC
++# elif defined(__s390x__)
++PLATFORM_TRIPLET=s390x-linux-LIBC
++# elif defined(__s390__)
++PLATFORM_TRIPLET=s390-linux-LIBC
++# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
++PLATFORM_TRIPLET=sh4-linux-LIBC
++# elif defined(__sparc__) && defined(__arch64__)
++PLATFORM_TRIPLET=sparc64-linux-LIBC
++# elif defined(__sparc__)
++PLATFORM_TRIPLET=sparc-linux-LIBC
++# elif defined(__riscv)
++# if __riscv_xlen == 32
++PLATFORM_TRIPLET=riscv32-linux-LIBC
++# elif __riscv_xlen == 64
++PLATFORM_TRIPLET=riscv64-linux-LIBC
++# else
++# error unknown platform triplet
++# endif
++# else
++# error unknown platform triplet
++# endif
++/*
++ * END of Linux block
++ */
++#elif defined(__FreeBSD_kernel__)
++# if defined(__LP64__)
++PLATFORM_TRIPLET=x86_64-kfreebsd-gnu
++# elif defined(__i386__)
++PLATFORM_TRIPLET=i386-kfreebsd-gnu
++# else
++# error unknown platform triplet
++# endif
++#elif defined(__gnu_hurd__)
++PLATFORM_TRIPLET=i386-gnu
++#elif defined(__APPLE__)
++PLATFORM_TRIPLET=darwin
++#elif defined(__VXWORKS__)
++PLATFORM_TRIPLET=vxworks
++#elif defined(__wasm32__)
++# if defined(__EMSCRIPTEN__)
++PLATFORM_TRIPLET=wasm32-emscripten
++# elif defined(__wasi__)
++# if defined(_REENTRANT)
++PLATFORM_TRIPLET=wasm32-wasi-threads
++# else
++PLATFORM_TRIPLET=wasm32-wasi
++# endif
++# else
++# error unknown wasm32 platform
++# endif
++#elif defined(__wasm64__)
++# if defined(__EMSCRIPTEN__)
++PLATFORM_TRIPLET=wasm64-emscripten
++# elif defined(__wasi__)
++PLATFORM_TRIPLET=wasm64-wasi
++# else
++# error unknown wasm64 platform
++# endif
++#else
++# error unknown platform triplet
++#endif
+--- a/configure.ac
++++ b/configure.ac
+@@ -925,180 +925,14 @@ fi
+
+
+ AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
+-cat > conftest.c <<EOF
+-#undef bfin
+-#undef cris
+-#undef fr30
+-#undef linux
+-#undef hppa
+-#undef hpux
+-#undef i386
+-#undef mips
+-#undef powerpc
+-#undef sparc
+-#undef unix
+-#if defined(__ANDROID__)
+- # Android is not a multiarch system.
+-#elif defined(__linux__)
+-# if defined(__x86_64__) && defined(__LP64__)
+- x86_64-linux-gnu
+-# elif defined(__x86_64__) && defined(__ILP32__)
+- x86_64-linux-gnux32
+-# elif defined(__i386__)
+- i386-linux-gnu
+-# elif defined(__aarch64__) && defined(__AARCH64EL__)
+-# if defined(__ILP32__)
+- aarch64_ilp32-linux-gnu
+-# else
+- aarch64-linux-gnu
+-# endif
+-# elif defined(__aarch64__) && defined(__AARCH64EB__)
+-# if defined(__ILP32__)
+- aarch64_be_ilp32-linux-gnu
+-# else
+- aarch64_be-linux-gnu
+-# endif
+-# elif defined(__alpha__)
+- alpha-linux-gnu
+-# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
+-# if defined(__ARMEL__)
+- arm-linux-gnueabihf
+-# else
+- armeb-linux-gnueabihf
+-# endif
+-# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
+-# if defined(__ARMEL__)
+- arm-linux-gnueabi
+-# else
+- armeb-linux-gnueabi
+-# endif
+-# elif defined(__hppa__)
+- hppa-linux-gnu
+-# elif defined(__ia64__)
+- ia64-linux-gnu
+-# elif defined(__m68k__) && !defined(__mcoldfire__)
+- m68k-linux-gnu
+-# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
+-# if _MIPS_SIM == _ABIO32
+- mipsisa32r6el-linux-gnu
+-# elif _MIPS_SIM == _ABIN32
+- mipsisa64r6el-linux-gnuabin32
+-# elif _MIPS_SIM == _ABI64
+- mipsisa64r6el-linux-gnuabi64
+-# else
+-# error unknown platform triplet
+-# endif
+-# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
+-# if _MIPS_SIM == _ABIO32
+- mipsisa32r6-linux-gnu
+-# elif _MIPS_SIM == _ABIN32
+- mipsisa64r6-linux-gnuabin32
+-# elif _MIPS_SIM == _ABI64
+- mipsisa64r6-linux-gnuabi64
+-# else
+-# error unknown platform triplet
+-# endif
+-# elif defined(__mips_hard_float) && defined(_MIPSEL)
+-# if _MIPS_SIM == _ABIO32
+- mipsel-linux-gnu
+-# elif _MIPS_SIM == _ABIN32
+- mips64el-linux-gnuabin32
+-# elif _MIPS_SIM == _ABI64
+- mips64el-linux-gnuabi64
+-# else
+-# error unknown platform triplet
+-# endif
+-# elif defined(__mips_hard_float)
+-# if _MIPS_SIM == _ABIO32
+- mips-linux-gnu
+-# elif _MIPS_SIM == _ABIN32
+- mips64-linux-gnuabin32
+-# elif _MIPS_SIM == _ABI64
+- mips64-linux-gnuabi64
+-# else
+-# error unknown platform triplet
+-# endif
+-# elif defined(__or1k__)
+- or1k-linux-gnu
+-# elif defined(__powerpc__) && defined(__SPE__)
+- powerpc-linux-gnuspe
+-# elif defined(__powerpc64__)
+-# if defined(__LITTLE_ENDIAN__)
+- powerpc64le-linux-gnu
+-# else
+- powerpc64-linux-gnu
+-# endif
+-# elif defined(__powerpc__)
+- powerpc-linux-gnu
+-# elif defined(__s390x__)
+- s390x-linux-gnu
+-# elif defined(__s390__)
+- s390-linux-gnu
+-# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
+- sh4-linux-gnu
+-# elif defined(__sparc__) && defined(__arch64__)
+- sparc64-linux-gnu
+-# elif defined(__sparc__)
+- sparc-linux-gnu
+-# elif defined(__riscv)
+-# if __riscv_xlen == 32
+- riscv32-linux-gnu
+-# elif __riscv_xlen == 64
+- riscv64-linux-gnu
+-# else
+-# error unknown platform triplet
+-# endif
+-# else
+-# error unknown platform triplet
+-# endif
+-#elif defined(__FreeBSD_kernel__)
+-# if defined(__LP64__)
+- x86_64-kfreebsd-gnu
+-# elif defined(__i386__)
+- i386-kfreebsd-gnu
+-# else
+-# error unknown platform triplet
+-# endif
+-#elif defined(__gnu_hurd__)
+- i386-gnu
+-#elif defined(__APPLE__)
+- darwin
+-#elif defined(__VXWORKS__)
+- vxworks
+-#elif defined(__wasm32__)
+-# if defined(__EMSCRIPTEN__)
+- wasm32-emscripten
+-# elif defined(__wasi__)
+- wasm32-wasi
+-# else
+-# error unknown wasm32 platform
+-# endif
+-#elif defined(__wasm64__)
+-# if defined(__EMSCRIPTEN__)
+- wasm64-emscripten
+-# elif defined(__wasi__)
+- wasm64-wasi
+-# else
+-# error unknown wasm64 platform
+-# endif
+-#else
+-# error unknown platform triplet
+-#endif
+-
+-EOF
+-
+-if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
+- PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
+- case "$build_os" in
+- linux-musl*)
+- PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'`
+- ;;
+- esac
++if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then
++ PLATFORM_TRIPLET=`grep '^PLATFORM_TRIPLET=' conftest.out | tr -d ' '`
++ PLATFORM_TRIPLET="${PLATFORM_TRIPLET@%:@PLATFORM_TRIPLET=}"
+ AC_MSG_RESULT([$PLATFORM_TRIPLET])
+ else
+ AC_MSG_RESULT([none])
+ fi
+-rm -f conftest.c conftest.out
++rm -f conftest.out
+
+ AC_MSG_CHECKING([for multiarch])
+ AS_CASE([$ac_sys_system],
diff --git a/external/subpack/lang/python/python3/test.sh b/external/subpack/lang/python/python3/test.sh
new file mode 100644
index 0000000..b45e654
--- /dev/null
+++ b/external/subpack/lang/python/python3/test.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+case "$1" in
+python3|python3-base|python3-light)
+ python3 --version | grep -Fx "Python $2"
+ ;;
+esac