python3: Update to 3.11.3, refresh/redo patches

* Removed patches:

  * 001-enable-zlib.patch: zlib module should be enabled automatically

  * 007-distutils-do-not-adjust-path.patch: Not necessary since we
    process shebang lines for all scripts (in python3-package.mk)

  * 030-bpo-43112-detect-musl-as-a-separate-SOABI-GH-24502.patch:
    Already merged

* Move configure vars from config.site back into Makefile

  Centralizing all build information into one file makes it easier to
  maintain

* No longer set ac_cv_header_uuid_h=yes as configure should detect
  libuuid

* Order configure args by enable-/disable-/with-/without-, then
  alphabetically

* Set ac_cv_working_openssl_hashlib=yes for host configure to bypass the
  OpenSSL API tests with LibreSSL

* Use the default Host/Compile recipe instead of picking out specific
  targets to make

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit 2445fe9fb2)
This commit is contained in:
Jeffery To
2023-05-05 17:23:49 +08:00
parent cc000a1a2c
commit 24aa47eb2b
18 changed files with 87 additions and 183 deletions

View File

@@ -1,11 +0,0 @@
--- a/Modules/Setup
+++ b/Modules/Setup
@@ -343,7 +343,7 @@ _symtable symtablemodule.c
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -lz
# Interface to the Expat XML parser
# More information on Expat can be found at www.libexpat.org.

View File

@@ -1,6 +1,6 @@
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1600,6 +1600,7 @@ libinstall: build_all $(srcdir)/Modules/
@@ -2084,6 +2084,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi
@@ -8,7 +8,7 @@
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
-j0 -d $(LIBDEST) -f \
@@ -1627,6 +1628,7 @@ libinstall: build_all $(srcdir)/Modules/
@@ -2111,6 +2112,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

View File

@@ -1,6 +1,6 @@
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -163,7 +163,7 @@ int Py_NoSiteFlag = 0; /* Suppress 'impo
@@ -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 */

View File

@@ -1,6 +1,6 @@
--- a/setup.py
+++ b/setup.py
@@ -822,16 +822,9 @@ class PyBuildExt(build_ext):
@@ -843,16 +843,9 @@ class PyBuildExt(build_ext):
add_dir_to_list(dir_list, directory)
def configure_compiler(self):

View File

@@ -1,10 +0,0 @@
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -91,6 +91,7 @@ class build_scripts(Command):
adjust = True
post_interp = match.group(1) or b''
+ adjust = 0
if adjust:
log.info("copying and adjusting %s -> %s", script,
self.build_dir)

View File

@@ -36,7 +36,7 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
self.library_dirs.append('.')
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -123,10 +123,17 @@ _SCHEME_KEYS = ('stdlib', 'platstdlib',
@@ -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]}'

View File

@@ -1,6 +1,6 @@
--- a/configure
+++ b/configure
@@ -15616,7 +15616,7 @@ $as_echo_n "checking ABIFLAGS... " >&6;
@@ -20712,7 +20712,7 @@ $as_echo_n "checking ABIFLAGS... " >&6;
$as_echo "$ABIFLAGS" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
$as_echo_n "checking SOABI... " >&6; }
@@ -11,7 +11,7 @@
--- a/configure.ac
+++ b/configure.ac
@@ -4824,7 +4824,7 @@ AC_SUBST(SOABI)
@@ -5684,7 +5684,7 @@ AC_SUBST(SOABI)
AC_MSG_CHECKING(ABIFLAGS)
AC_MSG_RESULT($ABIFLAGS)
AC_MSG_CHECKING(SOABI)

View File

@@ -1,6 +1,6 @@
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -407,6 +407,7 @@ def get_makefile_filename():
@@ -461,6 +461,7 @@ def get_makefile_filename():
def _get_sysconfigdata_name():
@@ -10,7 +10,7 @@
'_PYTHON_SYSCONFIGDATA_NAME',
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1593,7 +1593,7 @@ libinstall: build_all $(srcdir)/Modules/
@@ -2077,7 +2077,7 @@ libinstall: all $(srcdir)/Modules/xxmodu
esac; \
done; \
done
@@ -19,7 +19,7 @@
$(DESTDIR)$(LIBDEST); \
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
@@ -1753,7 +1753,7 @@ sharedinstall: sharedmods
@@ -2239,7 +2239,7 @@ sharedinstall: all
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
--root=$(DESTDIR)/
@@ -30,16 +30,16 @@
# Here are a couple of targets for MacOSX again, to install a full
--- a/configure
+++ b/configure
@@ -3019,7 +3019,7 @@ $as_echo_n "checking for python interpre
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
$as_echo "$interp" >&6; }
- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata '$interp
@@ -3262,7 +3262,7 @@ fi
fi
elif test "$cross_compiling" = maybe; then
as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
@@ -15686,7 +15686,7 @@ fi
ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python
PYTHON_FOR_FREEZE="$with_build_python"
- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$with_build_python
+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata '$with_build_python
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_build_python" >&5
$as_echo "$with_build_python" >&6; }
@@ -20782,7 +20782,7 @@ fi
@@ -50,16 +50,16 @@
LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,7 @@ if test "$cross_compiling" = yes; then
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
fi
AC_MSG_RESULT($interp)
- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata '$interp
fi
elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
@@ -4882,7 +4882,7 @@ fi],
@@ -162,7 +162,7 @@ AC_ARG_WITH(
dnl Build Python interpreter is used for regeneration and freezing.
ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python
PYTHON_FOR_FREEZE="$with_build_python"
- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$with_build_python
+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata '$with_build_python
AC_MSG_RESULT([$with_build_python])
], [
AS_VAR_IF([cross_compiling], [yes],
@@ -5742,7 +5742,7 @@ fi],
dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
AC_SUBST(PY_ENABLE_SHARED)

View File

@@ -1,6 +1,6 @@
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1645,7 +1645,7 @@ python-config: $(srcdir)/Misc/python-con
@@ -2129,7 +2129,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).

View File

@@ -1,6 +1,6 @@
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1361,7 +1361,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
@@ -1839,7 +1839,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
$(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
fi

View File

@@ -1,75 +0,0 @@
From 3f79de7b8411c76a1fcd1ca850ea62500be7a881 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Sat, 29 Jan 2022 00:02:54 +0100
Subject: [PATCH 1/2] bpo-43112: detect musl as a separate SOABI (GH-24502)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
musl libc and gnu libc are not ABI compatible so we need set different
SOABI for musl and not simply assume that all linux is linux-gnu.
Replace linux-gnu with the detected os for the build from config.guess
for linux-musl*.
(cherry picked from commit 1f036ede59e2c4befc07714cf76603c591d5c972)
Signed-off-by: Šimon Bořek <simon.borek@nic.cz>
---
Lib/test/test_sysconfig.py | 8 ++++----
.../next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst | 1 +
configure | 5 +++++
configure.ac | 5 +++++
4 files changed, 15 insertions(+), 4 deletions(-)
create mode 100644 Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -425,11 +425,11 @@ class TestSysConfig(unittest.TestCase):
self.assertTrue('linux' in suffix, suffix)
if re.match('(i[3-6]86|x86_64)$', machine):
if ctypes.sizeof(ctypes.c_char_p()) == 4:
- self.assertTrue(suffix.endswith('i386-linux-gnu.so') or
- suffix.endswith('x86_64-linux-gnux32.so'),
- suffix)
+ expected_suffixes = 'i386-linux-gnu.so', 'x86_64-linux-gnux32.so', 'i386-linux-musl.so'
else: # 8 byte pointer size
- self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix)
+ expected_suffixes = 'x86_64-linux-gnu.so', 'x86_64-linux-musl.so'
+ self.assertTrue(suffix.endswith(expected_suffixes),
+ f'unexpected suffix {suffix!r}')
@unittest.skipUnless(sys.platform == 'darwin', 'OS X-specific test')
def test_osx_ext_suffix(self):
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2021-02-10-17-54-04.bpo-43112.H5Lat6.rst
@@ -0,0 +1 @@
+Detect musl libc as a separate SOABI (tagged as ``linux-musl``).
\ No newline at end of file
--- a/configure
+++ b/configure
@@ -5376,6 +5376,11 @@ 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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5
$as_echo "$PLATFORM_TRIPLET" >&6; }
else
--- a/configure.ac
+++ b/configure.ac
@@ -866,6 +866,11 @@ 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
AC_MSG_RESULT([$PLATFORM_TRIPLET])
else
AC_MSG_RESULT([none])

View File

@@ -27,7 +27,7 @@ Signed-off-by: Šimon Bořek <simon.borek@nic.cz>
--- a/configure
+++ b/configure
@@ -5376,7 +5376,7 @@ EOF
@@ -6186,7 +6186,7 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
@@ -38,7 +38,7 @@ Signed-off-by: Šimon Bořek <simon.borek@nic.cz>
;;
--- a/configure.ac
+++ b/configure.ac
@@ -866,7 +866,7 @@ EOF
@@ -1081,7 +1081,7 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`