python3.11/python-3.1.1-with-system-expat.patch
dmalcolm 1ae4dd3f5e - update python-3.1.1-config.patch to remove downstream customization of
build of pyexpat and elementtree modules
- add patch adapted from upstream (patch 7) to add support for building
    against system expat; add --with-system-expat to "configure" invocation
- remove embedded copies of expat and zlib from source tree during "prep"
2010-01-28 19:56:39 +00:00

68 lines
2.9 KiB
Diff

diff -up Python-3.1.1/configure.in.expat Python-3.1.1/configure.in
--- Python-3.1.1/configure.in.expat 2010-01-25 23:02:05.488859572 -0500
+++ Python-3.1.1/configure.in 2010-01-25 23:02:21.425857866 -0500
@@ -1853,6 +1853,13 @@ 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,
+ AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
+
+AC_MSG_RESULT($with_system_expat)
+
# Check for use of the system libffi library
AC_MSG_CHECKING(for --with-system-ffi)
AC_ARG_WITH(system_ffi,
diff -up Python-3.1.1/setup.py.expat Python-3.1.1/setup.py
--- Python-3.1.1/setup.py.expat 2010-01-25 23:02:11.254859198 -0500
+++ Python-3.1.1/setup.py 2010-01-25 23:02:21.426857993 -0500
@@ -1110,19 +1110,26 @@ class PyBuildExt(build_ext):
#
# More information on Expat can be found at www.libexpat.org.
#
- expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
- define_macros = [
- ('HAVE_EXPAT_CONFIG_H', '1'),
- ]
+ if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
+ expat_inc = []
+ define_macros = []
+ expat_lib = ['expat']
+ expat_sources = []
+ else:
+ expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
+ define_macros = [
+ ('HAVE_EXPAT_CONFIG_H', '1'),
+ ]
+ expat_lib = []
+ expat_sources = ['expat/xmlparse.c',
+ 'expat/xmlrole.c',
+ 'expat/xmltok.c']
exts.append(Extension('pyexpat',
define_macros = define_macros,
- include_dirs = [expatinc],
- sources = ['pyexpat.c',
- 'expat/xmlparse.c',
- 'expat/xmlrole.c',
- 'expat/xmltok.c',
- ],
+ include_dirs = expat_inc,
+ libraries = expat_lib,
+ sources = ['pyexpat.c'] + expat_sources
))
# Fredrik Lundh's cElementTree module. Note that this also
@@ -1132,7 +1139,8 @@ class PyBuildExt(build_ext):
define_macros.append(('USE_PYEXPAT_CAPI', None))
exts.append(Extension('_elementtree',
define_macros = define_macros,
- include_dirs = [expatinc],
+ include_dirs = expat_inc,
+ libraries = expat_lib,
sources = ['_elementtree.c'],
))
else: