Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
From 52bb6f2a3ef352cda16d95a588a0356da562de8e 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.
Upstream: N/A
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>
[ Adam Duskett: ported to Python 3.12.0 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Makefile.pre.in | 2 ++
configure.ac | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 08ad5f4921d..486a35ed99b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2812,6 +2812,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \
fi
@ # Build PYC files for the 3 optimization levels (0, 1, 2)
+ifeq (@PYC_BUILD@,yes)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \
@@ -2821,6 +2822,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+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 bd4446e9488..ad0781f9ee6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1533,6 +1533,13 @@ 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 ])
+
+
# Apple 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.47.3

View File

@@ -0,0 +1,90 @@
From 8ba9dc9a12687d37454dd949409599f108f1ce44 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.
Upstream: N/A
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>
[ Adam Duskett: ported to Python 3.12.1 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Makefile.pre.in | 9 ++++++++-
configure.ac | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 486a35ed99b..c3732bedb30 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2513,7 +2513,9 @@ bininstall: commoninstall 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
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)) \
@@ -2564,7 +2566,6 @@ LIBSUBDIRS= asyncio \
logging \
multiprocessing multiprocessing/dummy \
pathlib \
- pydoc_data \
re \
site-packages \
sqlite3 \
@@ -2731,6 +2732,10 @@ TESTSUBDIRS= idlelib/idle_test \
COMPILEALL_OPTS=-j0
+ifeq (@PYDOC@,yes)
+LIBSUBDIRS += pydoc_data
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
@@ -2959,7 +2964,9 @@ libainstall: all scripts
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
$(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
+ifeq (@PYDOC@,yes)
$(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
+endif
@if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
echo; echo "Installing support files for building shared extension modules on AIX:"; \
diff --git a/configure.ac b/configure.ac
index ad0781f9ee6..00d2b54ead5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4789,6 +4789,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])
--
2.47.3

View File

@@ -0,0 +1,89 @@
From 463c64020b288b8ddfd32a63c4a23ab7369b9669 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.
Upstream: N/A
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>
[ Adam Duskett: ported to Python 3.12.1 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Makefile.pre.in | 9 ++++++++-
configure.ac | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index c3732bedb30..2197bb18434 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2511,7 +2511,9 @@ bininstall: commoninstall 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)
@@ -2560,7 +2562,6 @@ LIBSUBDIRS= asyncio \
ensurepip ensurepip/_bundled \
html \
http \
- idlelib idlelib/Icons \
importlib importlib/resources importlib/metadata \
json \
logging \
@@ -2736,6 +2737,10 @@ ifeq (@PYDOC@,yes)
LIBSUBDIRS += pydoc_data
endif
+ifeq (@IDLE@,yes)
+LIBSUBDIRS += idlelib idlelib/Icons
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
@@ -2963,7 +2968,9 @@ libainstall: all scripts
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
+ifeq (@IDLE@,yes)
$(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
+endif
ifeq (@PYDOC@,yes)
$(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
endif
diff --git a/configure.ac b/configure.ac
index 00d2b54ead5..5395e82384b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8189,6 +8189,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_d
# substitute multiline block, must come after last PY_STDLIB_MOD()
AC_SUBST([MODULE_BLOCK])
+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(m4_normalize([
Makefile.pre
--
2.47.3

View File

@@ -0,0 +1,53 @@
From 930c4763ac46d180880615eceeb68698e9b35e85 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 6 Feb 2024 22:46:59 +0100
Subject: [PATCH] configure.ac: move PY_STDLIB_MOD_SET_NA further up
We will need PY_STDLIB_MOD_SET_NA in next patches further up in the
configure.ac script.
Upstream: N/A
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
configure.ac | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5395e82384b..ec9a24c5311 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,12 @@ AC_DEFUN([PY_CHECK_EMSCRIPTEN_PORT], [
AS_VAR_POPDEF([py_libs])
])
+# stdlib
+AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
+ m4_foreach([mod], [$@], [
+ AS_VAR_SET([py_cv_module_]mod, [n/a])])
+])
+
AC_SUBST([BASECPPFLAGS])
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
# If we're building out-of-tree, we need to make sure the following
@@ -7701,13 +7707,6 @@ if test -n "$_PYTHREAD_NAME_MAXLEN"; then
fi
AC_SUBST([_PYTHREAD_NAME_MAXLEN])
-
-# stdlib
-AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
- m4_foreach([mod], [$@], [
- AS_VAR_SET([py_cv_module_]mod, [n/a])])
-])
-
# stdlib not available
dnl Modules that are not available on some platforms
AS_CASE([$ac_sys_system],
--
2.47.3

View File

@@ -0,0 +1,67 @@
From 8f6beca556599479705444af7cc7c49b2b964af8 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 6 Feb 2024 22:12:20 +0100
Subject: [PATCH] Add option to disable the sqlite3 module
Upstream: N/A
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Makefile.pre.in | 5 ++++-
configure.ac | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 2197bb18434..c8f7ab1e6a9 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2569,7 +2569,6 @@ LIBSUBDIRS= asyncio \
pathlib \
re \
site-packages \
- sqlite3 \
string \
sysconfig \
tkinter \
@@ -2741,6 +2740,10 @@ ifeq (@IDLE@,yes)
LIBSUBDIRS += idlelib idlelib/Icons
endif
+ifeq (@SQLITE3@,yes)
+LIBSUBDIRS += sqlite3
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
diff --git a/configure.ac b/configure.ac
index ec9a24c5311..e8e201206bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4795,6 +4795,13 @@ 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 ])
+AS_IF([test "$SQLITE3" = "no"],
+ [PY_STDLIB_MOD_SET_NA([_sqlite3])])
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,
--
2.47.3

View File

@@ -0,0 +1,87 @@
From b53a2758ac431bc2493a460e6c886561e2397518 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
Upstream: N/A
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.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[ Adam Duskett: ported to Python 3.12.1 ]
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Vincent Fazio: fix Python 3.13.3 conflict ]
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
---
Makefile.pre.in | 8 +++++---
configure.ac | 7 +++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index c8f7ab1e6a9..2c91d0dda71 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2571,7 +2571,6 @@ LIBSUBDIRS= asyncio \
site-packages \
string \
sysconfig \
- tkinter \
tomllib \
turtledemo \
unittest \
@@ -2681,7 +2680,6 @@ TESTSUBDIRS= idlelib/idle_test \
test/test_pyrepl \
test/test_string \
test/test_sqlite3 \
- test/test_tkinter \
test/test_tomllib \
test/test_tomllib/data \
test/test_tomllib/data/invalid \
@@ -2703,7 +2701,6 @@ TESTSUBDIRS= idlelib/idle_test \
test/test_tools \
test/test_tools/i18n_data \
test/test_tools/msgfmt_data \
- test/test_ttk \
test/test_unittest \
test/test_unittest/namespace_test_pkg \
test/test_unittest/namespace_test_pkg/bar \
@@ -2730,6 +2727,11 @@ TESTSUBDIRS= idlelib/idle_test \
test/xmltestdata/c14n-20 \
test/zipimport_data
+ifeq (@TK@,yes)
+LIBSUBDIRS += tkinter
+TESTSUBDIRS += test/test_tkinter test/test_ttk
+endif
+
COMPILEALL_OPTS=-j0
ifeq (@PYDOC@,yes)
diff --git a/configure.ac b/configure.ac
index e8e201206bc..840976ec1bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4808,6 +4808,13 @@ AC_ARG_ENABLE(pydoc,
AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
[ PYDOC="${enableval}" ], [ PYDOC=yes ])
+AC_SUBST(TK)
+AC_ARG_ENABLE(tk,
+ AS_HELP_STRING([--disable-tk], [disable tk]),
+ [ TK="${enableval}" ], [ TK=yes ])
+AS_IF([test "$TK" = "no"],
+ [PY_STDLIB_MOD_SET_NA([_tkinter])])
+
# Check for enable-ipv6
AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified])
AC_MSG_CHECKING([if --enable-ipv6 is specified])
--
2.47.3

View File

@@ -0,0 +1,66 @@
From baef276faa676d1b0faf64a91fa627b5f8fcc5e0 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
Upstream: N/A
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>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Makefile.pre.in | 5 ++++-
configure.ac | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 2c91d0dda71..fb11e416731 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2555,7 +2555,6 @@ LIBSUBDIRS= asyncio \
concurrent concurrent/futures concurrent/interpreters \
csv \
ctypes ctypes/macholib \
- curses \
dbm \
email email/mime \
encodings \
@@ -2732,6 +2731,10 @@ LIBSUBDIRS += tkinter
TESTSUBDIRS += test/test_tkinter test/test_ttk
endif
+ifeq (@CURSES@,yes)
+LIBSUBDIRS += curses
+endif
+
COMPILEALL_OPTS=-j0
ifeq (@PYDOC@,yes)
diff --git a/configure.ac b/configure.ac
index 840976ec1bd..1d7ba91ccc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4802,6 +4802,13 @@ AC_ARG_ENABLE(sqlite3,
AS_IF([test "$SQLITE3" = "no"],
[PY_STDLIB_MOD_SET_NA([_sqlite3])])
+AC_SUBST(CURSES)
+AC_ARG_ENABLE(curses,
+ AS_HELP_STRING([--disable-curses], [disable curses]),
+ [ CURSES="${enableval}" ], [ CURSES=yes ])
+AS_IF([test "$CURSES" = "no"],
+ [PY_STDLIB_MOD_SET_NA([_curses], [_curses_panel])])
+
AC_SUBST(PYDOC)
AC_ARG_ENABLE(pydoc,
--
2.47.3

View File

@@ -0,0 +1,89 @@
From 2a7412e43554830ffbc831454de8df903e765b73 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).
Upstream: N/A
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>
[ Vincent Fazio: ported to Python 3.13.2 ]
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Makefile.pre.in | 5 ++++-
configure.ac | 24 +++++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index fb11e416731..c261b3f9cd7 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2576,7 +2576,6 @@ LIBSUBDIRS= asyncio \
urllib \
venv venv/scripts venv/scripts/common venv/scripts/posix \
wsgiref \
- $(XMLLIBSUBDIRS) \
xmlrpc \
zipfile zipfile/_path \
zoneinfo \
@@ -2749,6 +2748,10 @@ ifeq (@SQLITE3@,yes)
LIBSUBDIRS += sqlite3
endif
+ifeq (@EXPAT@,yes)
+LIBSUBDIRS += $(XMLLIBSUBDIRS)
+endif
+
TEST_MODULES=@TEST_MODULES@
.PHONY: libinstall
diff --git a/configure.ac b/configure.ac
index 1d7ba91ccc9..3980548b253 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4065,17 +4065,19 @@ LIBS="$withval $LIBS"
[AC_MSG_RESULT([no])])
# 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)]
- )], [], [with_system_expat="no"])
-
-AC_MSG_RESULT([$with_system_expat])
-
-AS_VAR_IF([with_system_expat], [yes], [
+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_expat="builtin"])
+AC_MSG_RESULT($with_expat)
+AS_IF([test "$with_expat" != "none"],
+ [EXPAT=yes],
+ [PY_STDLIB_MOD_SET_NA([pyexpat])
+ EXPAT=no])
+AC_SUBST(EXPAT)
+
+AS_VAR_IF([with_expat], [system], [
LIBEXPAT_CFLAGS=${LIBEXPAT_CFLAGS-""}
LIBEXPAT_LDFLAGS=${LIBEXPAT_LDFLAGS-"-lexpat"}
LIBEXPAT_INTERNAL=
--
2.47.3

View File

@@ -0,0 +1,101 @@
From 2d336d1fedb692350a1e4f131246f60a1195cd93 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Sun, 7 Dec 2025 13:57:06 +0100
Subject: [PATCH] configure.ac: detect unusable termio operations
Some termio operations are not actually usable on some
architectures. For example, the TCGETA, TCSETA, TCSETAF and TCSETAW
are defined with a reference to "struct termio" on alpha, hppa and
sparc64, but "struct termio" is no longer defined since glibc 2.42,
causing a build failure.
Instead of using those operations as soon as they are defined, this
commit checks more carefully that they are actually usable. This is
done using a new m4 macro PY_CHECK_IOCTL.
Upstream: https://github.com/python/cpython/pull/142380
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[ Bernd Kuhls: ported to Python 3.14.2]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
Modules/termios.c | 8 ++++----
configure.ac | 26 ++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/Modules/termios.c b/Modules/termios.c
index efb5fcc17fa..3177cb0747a 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -1115,7 +1115,7 @@ static struct constant {
#ifdef TCFLSH
{"TCFLSH", TCFLSH},
#endif
-#ifdef TCGETA
+#if defined(HAVE_TCGETA)
{"TCGETA", TCGETA},
#endif
#ifdef TCGETS
@@ -1127,13 +1127,13 @@ static struct constant {
#ifdef TCSBRKP
{"TCSBRKP", TCSBRKP},
#endif
-#ifdef TCSETA
+#if defined(HAVE_TCSETA)
{"TCSETA", TCSETA},
#endif
-#ifdef TCSETAF
+#if defined(HAVE_TCSETAF)
{"TCSETAF", TCSETAF},
#endif
-#ifdef TCSETAW
+#if defined(HAVE_TCSETAW)
{"TCSETAW", TCSETAW},
#endif
#ifdef TCSETS
diff --git a/configure.ac b/configure.ac
index 3980548b253..48604024fcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,26 @@ AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
AS_VAR_SET([py_cv_module_]mod, [n/a])])
])
+dnl PY_CHECK_IOCTL(IOCTL_SYMBOL)
+AC_DEFUN([PY_CHECK_IOCTL],
+[
+ AC_MSG_CHECKING([for $1])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/ioctl.h>]],
+ [[
+ /* Test whether $1 is declared */
+ long val = $1;
+ return 0;
+ ]]
+ )],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_$1], [1],
+ [Define this if $1 termio operation is usable])],
+ [AC_MSG_RESULT([no])]
+ )
+])
+
AC_SUBST([BASECPPFLAGS])
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
# If we're building out-of-tree, we need to make sure the following
@@ -8217,6 +8237,12 @@ AC_ARG_ENABLE(idle3,
AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]),
[ IDLE="${enableval}" ], [ IDLE=yes ])
+# ioctls used by Modules/termios.c but not usable on all platforms
+PY_CHECK_IOCTL([TCGETA])
+PY_CHECK_IOCTL([TCSETA])
+PY_CHECK_IOCTL([TCSETAF])
+PY_CHECK_IOCTL([TCSETAW])
+
# generate output files
AC_CONFIG_FILES(m4_normalize([
Makefile.pre
--
2.51.1

View File

@@ -0,0 +1,55 @@
From 528429e329047ee572248da0e1212f7cc1ef7d11 Mon Sep 17 00:00:00 2001
From: Pablo Galindo Salgado <Pablogsal@gmail.com>
Date: Thu, 25 Sep 2025 00:16:44 +0100
Subject: [PATCH] gh-139275: Fix compilation of
Modules/_remote_debugging_module.c when the system doesn't have
process_vm_readv (#139307)
Upstream: https://github.com/python/cpython/commit/1963e701001839389cfb1b11d803b0743f4705d7
[ Bernd Kuhls: ported to Python 3.14.7]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
.../2025-09-24-17-32-52.gh-issue-139275.novrqf.rst | 2 ++
Modules/_remote_debugging_module.c | 2 +-
Python/remote_debug.h | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-09-24-17-32-52.gh-issue-139275.novrqf.rst
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-09-24-17-32-52.gh-issue-139275.novrqf.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-09-24-17-32-52.gh-issue-139275.novrqf.rst
new file mode 100644
index 00000000000..8cb4b972ad6
--- /dev/null
+++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-09-24-17-32-52.gh-issue-139275.novrqf.rst
@@ -0,0 +1,2 @@
+Fix compilation problems in ``_remote_debugging_module.c`` when the system
+doesn't have ``process_vm_readv``. Patch by Pablo Galindo
diff --git a/Modules/_remote_debugging_module.c b/Modules/_remote_debugging_module.c
index b46538b76df..e86a27d5812 100644
--- a/Modules/_remote_debugging_module.c
+++ b/Modules/_remote_debugging_module.c
@@ -1329,7 +1329,7 @@ _Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
_PyErr_ChainExceptions1(exc);
}
}
-#elif defined(__linux__)
+#elif defined(__linux__) && HAVE_PROCESS_VM_READV
// On Linux, search for asyncio debug in executable or DLL
address = search_linux_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython", NULL);
if (address == 0) {
diff --git a/Python/remote_debug.h b/Python/remote_debug.h
index 8f9b6cd4c49..b7d17a0f345 100644
--- a/Python/remote_debug.h
+++ b/Python/remote_debug.h
@@ -1174,7 +1174,7 @@
_PyErr_ChainExceptions1(exc);
}
}
-#elif defined(__linux__)
+#elif defined(__linux__) && HAVE_PROCESS_VM_READV
// On Linux, search for 'python' in executable or DLL
address = search_linux_map_for_section(handle, "PyRuntime", "python",
_Py_RemoteDebug_ValidatePyRuntimeCookie);
--
2.47.3

133
package/python3/Config.in Normal file
View File

@@ -0,0 +1,133 @@
comment "python3 needs a toolchain w/ wchar, threads, dynamic library"
depends on BR2_USE_MMU
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
config BR2_PACKAGE_PYTHON3
bool "python3"
depends on BR2_USE_WCHAR
# uses fork()
depends on BR2_USE_MMU
depends on BR2_TOOLCHAIN_HAS_THREADS # libffi
depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_LIBFFI
select BR2_PACKAGE_BLUEZ5_UTILS_HEADERS if BR2_PACKAGE_BLUEZ5_UTILS
select BR2_PACKAGE_HOST_PYTHON3
help
The python language interpreter.
http://www.python.org/
if BR2_PACKAGE_PYTHON3
choice
prompt "python3 module format to install"
default BR2_PACKAGE_PYTHON3_PYC_ONLY
help
Select Python module format to install on target (py, pyc or
both)
config BR2_PACKAGE_PYTHON3_PY_ONLY
bool ".py sources only"
config BR2_PACKAGE_PYTHON3_PYC_ONLY
bool ".pyc compiled sources only"
config BR2_PACKAGE_PYTHON3_PY_PYC
bool ".py sources and .pyc compiled"
endchoice
menu "core python3 modules"
comment "The following modules are unusual or require extra libraries"
config BR2_PACKAGE_PYTHON3_2TO3
bool "2to3 module"
help
code translation from python 2 to 3
config BR2_PACKAGE_PYTHON3_BERKELEYDB
bool "berkeleydb"
select BR2_PACKAGE_BERKELEYDB
select BR2_PACKAGE_BERKELEYDB_DBM
help
berkeleydb module for Python3
config BR2_PACKAGE_PYTHON3_BZIP2
bool "bz2 module"
select BR2_PACKAGE_BZIP2
help
bzip2 module for Python3
config BR2_PACKAGE_PYTHON3_CODECSCJK
bool "codecscjk module"
help
Chinese/Japanese/Korean codecs module for Python (large).
config BR2_PACKAGE_PYTHON3_CURSES
bool "curses module"
select BR2_PACKAGE_NCURSES
help
curses module for Python3.
config BR2_PACKAGE_PYTHON3_DECIMAL
bool "decimal module"
select BR2_PACKAGE_MPDECIMAL
help
decimal module for Python3.
config BR2_PACKAGE_PYTHON3_READLINE
bool "readline"
select BR2_PACKAGE_READLINE
help
readline module for Python3 (required for command-line
editing in the Python shell).
config BR2_PACKAGE_PYTHON3_SSL
bool "ssl"
select BR2_PACKAGE_OPENSSL
select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
select BR2_PACKAGE_LIBOPENSSL_ENABLE_BLAKE2
help
_ssl module for Python3 (required for https in urllib etc).
config BR2_PACKAGE_PYTHON3_UNICODEDATA
bool "unicodedata module"
default y
help
Unicode character database (used by stringprep module)
(large).
config BR2_PACKAGE_PYTHON3_SQLITE
bool "sqlite module"
select BR2_PACKAGE_SQLITE
help
SQLite database support
config BR2_PACKAGE_PYTHON3_PYEXPAT
bool "xml module"
select BR2_PACKAGE_EXPAT
help
pyexpat and xml libraries for Python3.
config BR2_PACKAGE_PYTHON3_XZ
bool "xz module"
select BR2_PACKAGE_XZ
help
xz (a.k.a lzma) module for Python3
config BR2_PACKAGE_PYTHON3_ZLIB
bool "zlib module"
select BR2_PACKAGE_ZLIB
help
zlib support in Python3
config BR2_PACKAGE_PYTHON3_ZSTD
bool "zstd module"
select BR2_PACKAGE_ZSTD
help
zstd support in Python3
endmenu
endif

View File

@@ -0,0 +1,30 @@
config BR2_PACKAGE_HOST_PYTHON3
bool "host python3"
help
The python language interpreter. Host package.
http://www.python.org/
if BR2_PACKAGE_HOST_PYTHON3
config BR2_PACKAGE_HOST_PYTHON3_BZIP2
bool "bzip2"
help
bz2 module for host Python3.
config BR2_PACKAGE_HOST_PYTHON3_XZ
bool "xz"
help
xz (a.k.a lzma) module for host Python3
config BR2_PACKAGE_HOST_PYTHON3_CURSES
bool "curses"
help
curses module for host Python3.
config BR2_PACKAGE_HOST_PYTHON3_SSL
bool "ssl"
help
_ssl module for host Python3.
endif

View File

@@ -0,0 +1,4 @@
# From https://www.python.org/downloads/release/python-3147/
sha256 3b48dac8fb59f62eaa67ac83c1eb12bda1b7a08406dd286e252c11a66be27f81 Python-3.14.7.tar.xz
# Locally computed
sha256 b0e25a78cffb43f4d92de8b61ccfa1f1f98ecbc22330b54b5251e7b6ba010231 LICENSE

322
package/python3/python3.mk Normal file
View File

@@ -0,0 +1,322 @@
################################################################################
#
# python3
#
################################################################################
PYTHON3_VERSION_MAJOR = 3.14
PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).7
PYTHON3_SOURCE = Python-$(PYTHON3_VERSION).tar.xz
PYTHON3_SITE = https://python.org/ftp/python/$(PYTHON3_VERSION)
PYTHON3_LICENSE = Python-2.0, others
PYTHON3_LICENSE_FILES = LICENSE
PYTHON3_CPE_ID_VENDOR = python
PYTHON3_CPE_ID_PRODUCT = python
# This host Python is installed in $(HOST_DIR), as it is needed when
# cross-compiling third-party Python modules.
HOST_PYTHON3_CONF_OPTS += \
--without-ensurepip \
--without-cxx-main \
--disable-sqlite3 \
--disable-tk \
--with-expat=system \
--disable-test-modules \
--disable-idle3
# Make sure that LD_LIBRARY_PATH overrides -rpath.
# This is needed because libpython may be installed at the same time that
# python is called.
HOST_PYTHON3_CONF_ENV += \
LDFLAGS="$(HOST_LDFLAGS) -Wl,--enable-new-dtags" \
py_cv_module_unicodedata=yes \
py_cv_module__codecs_cn=n/a \
py_cv_module__codecs_hk=n/a \
py_cv_module__codecs_iso2022=n/a \
py_cv_module__codecs_jp=n/a \
py_cv_module__codecs_kr=n/a \
py_cv_module__codecs_tw=n/a \
py_cv_module__uuid=n/a
PYTHON3_DEPENDENCIES = host-python3 libffi
HOST_PYTHON3_DEPENDENCIES = \
host-autoconf-archive \
host-expat \
host-libffi \
host-pkgconf \
host-zlib
ifeq ($(BR2_PACKAGE_HOST_PYTHON3_BZIP2),y)
HOST_PYTHON3_DEPENDENCIES += host-bzip2
else
HOST_PYTHON3_CONF_ENV += py_cv_module__bz2=n/a
endif
ifeq ($(BR2_PACKAGE_HOST_PYTHON3_XZ),y)
HOST_PYTHON3_DEPENDENCIES += host-xz
else
HOST_PYTHON3_CONF_ENV += py_cv_module__lzma=n/a
endif
ifeq ($(BR2_PACKAGE_HOST_PYTHON3_CURSES),y)
HOST_PYTHON3_DEPENDENCIES += host-ncurses
else
HOST_PYTHON3_CONF_OPTS += --disable-curses
endif
ifeq ($(BR2_PACKAGE_HOST_PYTHON3_SSL),y)
HOST_PYTHON3_DEPENDENCIES += host-openssl
else
HOST_PYTHON3_CONF_ENV += \
py_cv_module__hashlib=n/a \
py_cv_module__ssl=n/a
endif
PYTHON3_INSTALL_STAGING = YES
ifeq ($(BR2_PACKAGE_PYTHON3_2TO3),y)
PYTHON3_CONF_OPTS += --enable-lib2to3
else
PYTHON3_CONF_OPTS += --disable-lib2to3
endif
ifeq ($(BR2_PACKAGE_PYTHON3_BERKELEYDB),y)
PYTHON3_DEPENDENCIES += berkeleydb
else
PYTHON3_CONF_ENV += py_cv_module__dbm=n/a
endif
ifeq ($(BR2_PACKAGE_PYTHON3_READLINE),y)
PYTHON3_CONF_OPTS += --with-readline
PYTHON3_DEPENDENCIES += readline
else
PYTHON3_CONF_OPTS += --without-readline
endif
ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
PYTHON3_DEPENDENCIES += ncurses
else
PYTHON3_CONF_OPTS += --disable-curses
endif
ifeq ($(BR2_PACKAGE_PYTHON3_DECIMAL),y)
PYTHON3_DEPENDENCIES += mpdecimal
PYTHON3_CONF_OPTS += --with-system-libmpdec
else
PYTHON3_CONF_ENV += py_cv_module__decimal=n/a
endif
ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
PYTHON3_DEPENDENCIES += expat
PYTHON3_CONF_OPTS += --with-expat=system
else
PYTHON3_CONF_OPTS += --with-expat=none
endif
ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
PYTHON3_DEPENDENCIES += sqlite
else
PYTHON3_CONF_OPTS += --disable-sqlite3
endif
ifeq ($(BR2_PACKAGE_PYTHON3_SSL),y)
PYTHON3_DEPENDENCIES += openssl
PYTHON3_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr
else
PYTHON3_CONF_ENV += \
py_cv_module__hashlib=n/a \
py_cv_module__ssl=n/a
endif
ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK),y)
PYTHON3_CONF_ENV += \
py_cv_module__codecs_cn=n/a \
py_cv_module__codecs_hk=n/a \
py_cv_module__codecs_iso2022=n/a \
py_cv_module__codecs_jp=n/a \
py_cv_module__codecs_kr=n/a \
py_cv_module__codecs_tw=n/a
endif
ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA),y)
PYTHON3_CONF_ENV += py_cv_module_unicodedata=n/a
endif
# Disable auto-detection of uuid.h (util-linux)
# which would add _uuid module support, instead
# default to the pure python implementation
PYTHON3_CONF_ENV += py_cv_module__uuid=n/a
ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2),y)
PYTHON3_DEPENDENCIES += bzip2
else
PYTHON3_CONF_ENV += py_cv_module__bz2=n/a
endif
ifeq ($(BR2_PACKAGE_PYTHON3_XZ),y)
PYTHON3_DEPENDENCIES += xz
else
PYTHON3_CONF_ENV += py_cv_module__lzma=n/a
endif
ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB),y)
PYTHON3_DEPENDENCIES += zlib
else
PYTHON3_CONF_ENV += py_cv_module_zlib=n/a
endif
ifeq ($(BR2_PACKAGE_PYTHON3_ZSTD),y)
PYTHON3_DEPENDENCIES += zstd
else
PYTHON3_CONF_ENV += py_cv_module__zstd=n/a
endif
PYTHON3_CONF_ENV += \
ac_cv_have_long_long_format=yes \
ac_cv_buggy_getaddrinfo=no \
ac_cv_file__dev_ptmx=yes \
ac_cv_file__dev_ptc=yes \
ac_cv_working_tzset=yes
# GCC is always compliant with IEEE754
ifeq ($(BR2_ENDIAN),"LITTLE")
PYTHON3_CONF_ENV += ac_cv_little_endian_double=yes
else
PYTHON3_CONF_ENV += ac_cv_big_endian_double=yes
endif
PYTHON3_CFLAGS = $(TARGET_CFLAGS)
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_81426),y)
PYTHON3_CFLAGS += -O0
endif
PYTHON3_CONF_ENV += \
CFLAGS="$(PYTHON3_CFLAGS)"
ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
PYTHON3_DEPENDENCIES += gettext
endif
PYTHON3_CONF_OPTS += \
--without-ensurepip \
--without-cxx-main \
--with-build-python=$(HOST_DIR)/bin/python3 \
--disable-pydoc \
--disable-test-modules \
--disable-tk \
--disable-idle3 \
--disable-pyc-build
#
# Remove useless files. In the config/ directory, only the Makefile
# and the pyconfig.h files are needed at runtime.
#
define PYTHON3_REMOVE_USELESS_FILES
rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)-config
rm -f $(TARGET_DIR)/usr/bin/python3-config
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)*/ \
-depth -type f -not -name Makefile -exec rm -rf {} \;
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ -depth -type d \
-name __pycache__ -exec rm -rf {} \;
endef
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
#
# Make sure libpython gets stripped out on target
#
define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
endef
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
PYTHON3_AUTORECONF = YES
PYTHON3_AUTORECONF_OPTS = --include=$(HOST_DIR)/share/autoconf-archive
define PYTHON3_INSTALL_SYMLINK
ln -fs python3 $(TARGET_DIR)/usr/bin/python
endef
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
define HOST_PYTHON3_INSTALL_SYMLINK
ln -fs python3 $(HOST_DIR)/bin/python
ln -fs python3-config $(HOST_DIR)/bin/python-config
endef
HOST_PYTHON3_POST_INSTALL_HOOKS += HOST_PYTHON3_INSTALL_SYMLINK
# Provided to other packages
PYTHON3_PATH = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/
# Support for socket.AF_BLUETOOTH
ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS_HEADERS),y)
PYTHON3_DEPENDENCIES += bluez5_utils-headers
endif
$(eval $(autotools-package))
$(eval $(host-autotools-package))
ifeq ($(BR2_REPRODUCIBLE),y)
define PYTHON3_FIX_TIME
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | \
xargs -0 --no-run-if-empty touch -d @$(SOURCE_DATE_EPOCH)
endef
endif
define PYTHON3_CREATE_PYC_FILES
$(PYTHON3_FIX_TIME)
PYTHONPATH="$(PYTHON3_PATH)" \
$(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) \
$(PYTHON3_DIR)/Lib/compileall.py \
$(if $(VERBOSE),,-q) \
$(if $(BR2_PACKAGE_PYTHON3_PYC_ONLY),-b) \
-s $(TARGET_DIR) \
-p / \
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)
endef
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON3_PY_PYC),y)
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_CREATE_PYC_FILES
endif
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
define PYTHON3_REMOVE_PY_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' \
$(if $(strip $(KEEP_PYTHON_PY_FILES)),-not \( $(call finddirclauses,$(TARGET_DIR),$(KEEP_PYTHON_PY_FILES)) \) ) \
-print0 | \
xargs -0 --no-run-if-empty rm -f
endef
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PY_FILES
endif
# Normally, *.pyc files should not have been compiled, but just in
# case, we make sure we remove all of them.
ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
define PYTHON3_REMOVE_PYC_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PYC_FILES
endif
# In all cases, we don't want to keep the optimized .opt-1.pyc and
# .opt-2.pyc files, since they can't work without their non-optimized
# variant.
define PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
# uClibc without time64 support (i.e. when linux headers < 5.1) causes
# a runtime assertion in Python. Encoding this as a dependency in Config.in
# causes too many problems for propagating reverse dependencies. Therefore
# instead we do a build time check.
ifeq ($(BR_BUILDING)$(BR2_PACKAGE_PYTHON3)$(BR2_TOOLCHAIN_USES_UCLIBC)-$(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1),yyy-)
$(error Python3 doesn't work with uClibc and kernel headers < 5.1. Please use a different toolchain or unselect Python3.)
endif