tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
fix for py-libxml2 setup
As just mentioned on pkgsrc-users, py-libxml2 produces a broken package
on older macOS. The reason is that the python build picks up the native
xml2 includes, which enable legacy ABI, while the pkgsrc xml2 does not.
That happens because setup.py looks in random places for headers, and
orders /usr/include before $prefix/usr/include. There is code in pkgsrc
to avoid some of this, but it seems bitrotted.
With this, py-libxml2 builds a valid python extension on older macOS.
What do people think? I am inclined to wait until post branch, unless
people that understand python better than me say this is right.
Index: libxml2/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/textproc/libxml2/distinfo,v
retrieving revision 1.144
diff -u -p -r1.144 distinfo
--- libxml2/distinfo 15 Apr 2023 13:06:21 -0000 1.144
+++ libxml2/distinfo 18 Sep 2023 13:58:12 -0000
@@ -6,3 +6,4 @@ Size (libxml2-2.10.4.tar.xz) = 2643600 b
SHA1 (patch-configure) = 3d73d05780562dccd5f9621d9e9f15f2d62cfa87
SHA1 (patch-encoding.c) = 7fe0f67db061a2f46abe1c4b6b4d8a0402f82830
SHA1 (patch-error.c) = 77561e820e0da96acb572378c2f2a0b9b84112e1
+SHA1 (patch-python_setup.py.in) = 79eb05998be43359e31efeca72201820b58048d2
Index: libxml2/patches/patch-python_setup.py.in
===================================================================
RCS file: libxml2/patches/patch-python_setup.py.in
diff -N libxml2/patches/patch-python_setup.py.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libxml2/patches/patch-python_setup.py.in 18 Sep 2023 13:58:12 -0000
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Work around upstream's setup looking in random places. Instead we
+control the -I path more strictly, and look for libxslt after $prefix.
+See py-libxml2 for the 2nd half of this change and a longer
+explanation.
+
+Not yet sent upstream because it seems unlikely they would be
+receptive.
+
+--- python/setup.py.in.orig 2023-04-11 10:36:35.000000000 +0000
++++ python/setup.py.in
+@@ -66,11 +66,8 @@ else:
+ # - libxml2/libxml/tree.h
+ # - libxslt/xsltconfig.h
+ includes_dir = [
+-"/usr/include",
+-"/usr/local/include",
+-"/opt/include",
+ os.path.join(ROOT,'include'),
+-HOME
++"@LIBXSLT_INCLUDE@"
+ ];
+
+ xml_includes=""
Index: py-libxml2/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/textproc/py-libxml2/Makefile,v
retrieving revision 1.88
diff -u -p -r1.88 Makefile
--- py-libxml2/Makefile 18 Sep 2023 13:21:40 -0000 1.88
+++ py-libxml2/Makefile 18 Sep 2023 13:58:12 -0000
@@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.88 2023/09/18 13:21:40 gdt Exp $
-PKGREVISION= 1
+PKGREVISION= 2
.include "../../textproc/libxml2/Makefile.common"
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
@@ -20,24 +20,16 @@ USE_TOOLS+= pkg-config
# $prefix/include. This can result in finding an old system libxml2,
# which is problematic in general, but can result in enabling legacy
# functions e.g. xmlCleanupPredefinedEntities which will then fail at
-# import time.
-#
-# The following attempts to patch around this, but it is not good
-# enough with pkgsrc xml2 and native iconv because the iconv include
-# path is first. This can happen on old macOS.
-#
-# \todo Patch setup.py.in to have @LIBXML2_PREFIX@ and @ICONV_PREFIX@
-# (in order) and then substite those, or at least ensure that the
-# iconv prefix is afterwwards.
-#
+# import time. To fix, we assume that libxml2 is from pkgsrc (because
+# py-libxml2 is from pkgsrc), and that therefore we should -I from
+# pkgsrc before iconv (which might be pkgsrc or native). setup.py.in
+# is patched to have a token to receive xslt's build path, after
+# $prefix/include.
SUBST_CLASSES+= setup
-SUBST_MESSAGE.setup= Fixing hardcoded paths.
+SUBST_MESSAGE.setup= Substituing libxslt include path
SUBST_STAGE.setup= pre-build
SUBST_FILES.setup= python/setup.py
-SUBST_NOOP_OK.setup= yes # PREFIX may be /usr/local
-SUBST_SED.setup= -e "/ROOT/s,'/usr/local','${BUILDLINK_PREFIX.libxml2}',g"
-SUBST_SED.setup+= -e "/^\"/s,/usr/include,${BUILDLINK_PREFIX.iconv}/include,g"
-SUBST_SED.setup+= -e "/^\"/s,/usr/local/include,${BUILDLINK_PREFIX.iconv}/include,g"
+SUBST_SED.setup+= -e "s,@LIBXSLT_INCLUDE@,${BUILDLINK_PREFIX.iconv}/include,g"
BUILDLINK_TRANSFORM.Darwin+= opt:-bundle:-dynamiclib
Home |
Main Index |
Thread Index |
Old Index