xref: /OK3568_Linux_fs/buildroot/package/python3/0017-Add-an-option-to-disable-expat.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom 7e0e7dc25f50acd6922493ae620ee5cbf107a79a Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3*4882a593SmuzhiyunDate: Wed, 22 Feb 2017 17:40:45 -0800
4*4882a593SmuzhiyunSubject: [PATCH] Add an option to disable expat
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis patch replaces the existing --with-system-expat option with a
7*4882a593Smuzhiyun--with-expat={system,builtin,none} option, which allows to tell Python
8*4882a593Smuzhiyunwhether we want to use the system expat (already installed), the expat
9*4882a593Smuzhiyunbuiltin the Python sources, or no expat at all (which disables the
10*4882a593Smuzhiyuninstallation of XML modules).
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13*4882a593SmuzhiyunSigned-off-by: Samuel Martin <s.martin49@gmail.com>
14*4882a593Smuzhiyun[ Andrey Smirnov: ported to Python 3.6 ]
15*4882a593SmuzhiyunSigned-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
16*4882a593Smuzhiyun[ Adam Duskett: ported to Python 3.10.0 ]
17*4882a593SmuzhiyunSigned-off-by: Adam Duskett <aduskett@gmail.com>
18*4882a593Smuzhiyun---
19*4882a593Smuzhiyun Makefile.pre.in |  5 ++++-
20*4882a593Smuzhiyun configure.ac    | 18 +++++++++++++-----
21*4882a593Smuzhiyun setup.py        |  2 +-
22*4882a593Smuzhiyun 3 files changed, 18 insertions(+), 7 deletions(-)
23*4882a593Smuzhiyun
24*4882a593Smuzhiyundiff --git a/Makefile.pre.in b/Makefile.pre.in
25*4882a593Smuzhiyunindex f89f155..08c5e8a 100644
26*4882a593Smuzhiyun--- a/Makefile.pre.in
27*4882a593Smuzhiyun+++ b/Makefile.pre.in
28*4882a593Smuzhiyun@@ -1450,7 +1450,6 @@ LIBSUBDIRS=	asyncio \
29*4882a593Smuzhiyun 		urllib \
30*4882a593Smuzhiyun 		venv venv/scripts venv/scripts/common venv/scripts/posix \
31*4882a593Smuzhiyun 		wsgiref \
32*4882a593Smuzhiyun-		$(XMLLIBSUBDIRS) \
33*4882a593Smuzhiyun 		xmlrpc \
34*4882a593Smuzhiyun 		zoneinfo
35*4882a593Smuzhiyun TESTSUBDIRS=	ctypes/test \
36*4882a593Smuzhiyun@@ -1549,6 +1548,10 @@ ifeq (@CURSES@,yes)
37*4882a593Smuzhiyun LIBSUBDIRS += curses
38*4882a593Smuzhiyun endif
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun+ifeq (@EXPAT@,yes)
41*4882a593Smuzhiyun+LIBSUBDIRS += $(XMLLIBSUBDIRS)
42*4882a593Smuzhiyun+endif
43*4882a593Smuzhiyun+
44*4882a593Smuzhiyun TEST_MODULES=@TEST_MODULES@
45*4882a593Smuzhiyun libinstall:	build_all $(srcdir)/Modules/xxmodule.c
46*4882a593Smuzhiyun 	@for i in $(SCRIPTDIR) $(LIBDEST); \
47*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
48*4882a593Smuzhiyunindex 4f1cda5..e99a174 100644
49*4882a593Smuzhiyun--- a/configure.ac
50*4882a593Smuzhiyun+++ b/configure.ac
51*4882a593Smuzhiyun@@ -3094,13 +3094,21 @@ PKG_PROG_PKG_CONFIG
52*4882a593Smuzhiyun AC_SUBST(DISABLED_EXTENSIONS)
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun # Check for use of the system expat library
55*4882a593Smuzhiyun-AC_MSG_CHECKING(for --with-system-expat)
56*4882a593Smuzhiyun-AC_ARG_WITH(system_expat,
57*4882a593Smuzhiyun-            AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)]),
58*4882a593Smuzhiyun+AC_MSG_CHECKING(for --with-expat)
59*4882a593Smuzhiyun+AC_ARG_WITH(expat,
60*4882a593Smuzhiyun+            AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]),
61*4882a593Smuzhiyun             [],
62*4882a593Smuzhiyun-            [with_system_expat="no"])
63*4882a593Smuzhiyun+            [with_expat="builtin"])
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun-AC_MSG_RESULT($with_system_expat)
66*4882a593Smuzhiyun+AC_MSG_RESULT($with_expat)
67*4882a593Smuzhiyun+
68*4882a593Smuzhiyun+if test "$with_expat" != "none"; then
69*4882a593Smuzhiyun+   EXPAT=yes
70*4882a593Smuzhiyun+else
71*4882a593Smuzhiyun+   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat"
72*4882a593Smuzhiyun+   EXPAT=no
73*4882a593Smuzhiyun+fi
74*4882a593Smuzhiyun+AC_SUBST(EXPAT)
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun # Check for use of the system libffi library
77*4882a593Smuzhiyun AC_MSG_CHECKING(for --with-system-ffi)
78*4882a593Smuzhiyundiff --git a/setup.py b/setup.py
79*4882a593Smuzhiyunindex 663fd44..e30ed52 100644
80*4882a593Smuzhiyun--- a/setup.py
81*4882a593Smuzhiyun+++ b/setup.py
82*4882a593Smuzhiyun@@ -1764,7 +1764,7 @@ class PyBuildExt(build_ext):
83*4882a593Smuzhiyun         #
84*4882a593Smuzhiyun         # More information on Expat can be found at www.libexpat.org.
85*4882a593Smuzhiyun         #
86*4882a593Smuzhiyun-        if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
87*4882a593Smuzhiyun+        if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"):
88*4882a593Smuzhiyun             expat_inc = []
89*4882a593Smuzhiyun             define_macros = []
90*4882a593Smuzhiyun             extra_compile_args = []
91*4882a593Smuzhiyun--
92*4882a593Smuzhiyun2.30.2
93*4882a593Smuzhiyun
94