Skip to content

Commit

Permalink
textproc/libxml2: Update to 2.11.6
Browse files Browse the repository at this point in the history
Changelog: https://gitlab.gnome.org/GNOME/libxml2/-/blob/v2.11.6/NEWS

PR:		273210
Reviewed by:	fluffy
Approved by:	desktop (arrowd)
Exp-run by:	antoine
  • Loading branch information
Daniel Engberg authored and Daniel Engberg committed Jan 12, 2024
1 parent 362c9e8 commit 25e6f68
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 126 deletions.
54 changes: 18 additions & 36 deletions textproc/libxml2/Makefile
@@ -1,6 +1,6 @@
PORTNAME= libxml2
DISTVERSION= 2.10.4
PORTREVISION?= 2
DISTVERSION= 2.11.6
PORTREVISION?= 0
CATEGORIES?= textproc gnome
MASTER_SITES= GNOME/sources/${PORTNAME}/${DISTVERSION:R}/
DIST_SUBDIR= gnome
Expand All @@ -11,51 +11,40 @@ WWW= http://xmlsoft.org/

LICENSE= MIT

# Upstream offers CMake in addition to autotools, but we use the latter.
# CMake is a heavy build system, heavier than autotools, and this
# port has many consumers of its core functionality. Some such
# consumers, especially when optioned appropriately (and users have
# a right to do so), may become dependencies of dependencies of CMake.
# Additionally, some consumers rely on symbol versioning that CMake
# does not support (as of Q2 2022) without a hack. Please consider the
# effects of the ecosystem and technical merits before considering
# switching build systems again. Any changes to this end not dogfooded
# thoroughly may be reverted.
USES+= cpe iconv libtool localbase pathfix pkgconfig tar:xz
USES+= cmake:testing cpe iconv localbase:ldflags pathfix \
pkgconfig tar:xz
CPE_VENDOR= xmlsoft
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
# Don't build with Python support unless requested
CONFIGURE_ARGS= --sysconfdir=${PREFIX}/share/ \
--with-lzma=/usr \
--${LIBXML2_SLAVE:Dwith:Uwithout}-python${LIBXML2_SLAVE:D=${PYTHON_CMD}:U}
CMAKE_${LIBXML2_SLAVE:DON:UOFF}=LIBXML2_WITH_PYTHON

# Many symbols in the linker version script libxml2.syms are only defined when
# --with-xptr-locs is enabled at configure time. Suppress errors with lld >= 17
# due to these undefined symbols.
LDFLAGS+= -Wl,--undefined-version

INSTALL_TARGET= install-strip
TEST_TARGET= check
CMAKE_TESTING_ON= LIBXML2_WITH_TESTS

CMAKE_ARGS= -DCMAKE_INSTALL_SYSCONFDIR=share
CMAKE_OFF+= LIBXML2_WITH_TESTS

PLIST_SUB+= LIBVERSION=${DISTVERSION}

OPTIONS_DEFINE= DOCS ICU MEM_DEBUG READLINE STATIC THREAD_ALLOC
OPTIONS_DEFAULT= READLINE STATIC
OPTIONS_DEFINE= DOCS ICU MEM_DEBUG READLINE THREAD_ALLOC
OPTIONS_DEFAULT= READLINE
OPTIONS_SUB= yes

MEM_DEBUG_DESC= Memory debugging (DEVELOPERS ONLY!)
READLINE_DESC= History for xmllint
THREAD_ALLOC_DESC= Per-thread memory (DEVELOPERS ONLY!)

ICU_LIB_DEPENDS= libicudata.so:devel/icu
ICU_CONFIGURE_WITH= icu
MEM_DEBUG_CONFIGURE_WITH= mem-debug
ICU_CMAKE_BOOL= LIBXML2_WITH_ICU
MEM_DEBUG_CONFIGURE_WITH= LIBXML2_WITH_MEM_DEBUG
READLINE_LIB_DEPENDS= libreadline.so:devel/readline
READLINE_CONFIGURE_WITH= history \
readline
STATIC_CONFIGURE_ENABLE= static
THREAD_ALLOC_CONFIGURE_WITH= thread-alloc
READLINE_CMAKE_OFF= -DHAVE_LIBHISTORY=false \
-DHAVE_LIBREADLINE=false
THREAD_ALLOC_CMAKE_BOOL= LIBXML2_WITH_THREAD_ALLOC

post-patch:
@${REINPLACE_CMD} -e \
Expand All @@ -64,15 +53,8 @@ post-patch:
${WRKSRC}/doc/xmllint.1

post-install:
.if !defined(LIBXML2_SLAVE)
# Documentation should be in DOCSDIR
@${MV} ${STAGEDIR}${PREFIX}/share/gtk-doc/html/libxml2 \
${STAGEDIR}${DOCSDIR}/devhelp
@${RM} -r ${STAGEDIR}${PREFIX}/share/gtk-doc
# Install remaining documentation that's not connected to autotools
${INSTALL_MAN} ${WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR}
.else
${STRIP_CMD} ${STAGEDIR}${PYTHON_LIBDIR}/site-packages/libxml2mod${PYTHON_EXT_SUFFIX}.so
.if defined(LIBXML2_SLAVE)
${STRIP_CMD} ${STAGEDIR}${PYTHON_LIBDIR}/site-packages/libxml2mod.so
.endif

.include <bsd.port.mk>
6 changes: 3 additions & 3 deletions textproc/libxml2/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1681763197
SHA256 (gnome/libxml2-2.10.4.tar.xz) = ed0c91c5845008f1936739e4eee2035531c1c94742c6541f44ee66d885948d45
SIZE (gnome/libxml2-2.10.4.tar.xz) = 2643600
TIMESTAMP = 1700425627
SHA256 (gnome/libxml2-2.11.6.tar.xz) = c90eee7506764abbe07bb616b82da452529609815aefef423d66ef080eb0c300
SIZE (gnome/libxml2-2.11.6.tar.xz) = 2628652
33 changes: 33 additions & 0 deletions textproc/libxml2/files/patch-CMakeLists.txt
@@ -0,0 +1,33 @@
--- CMakeLists.txt.orig 2023-08-11 18:59:11 UTC
+++ CMakeLists.txt
@@ -395,13 +395,17 @@ if(LIBXML2_WITH_ICU)
if(WIN32)
set(ICU_LIBS "-licudt -licuin -licuuc")
else()
- set(ICU_LIBS "-licudata -licui18n -licuuc")
+ set(ICU_LIBS_DIR "${ICU_INCLUDE_DIRS}")
+ STRING(REGEX REPLACE "include" "lib" ICU_LIBS_DIR ${ICU_LIBS_DIR})
+ set(ICU_LIBS "-L${ICU_LIBS_DIR} -licudata -licui18n -licuuc")
endif()
endif()

if(LIBXML2_WITH_LZMA)
target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA)
- set(LZMA_LIBS "-llzma")
+ set(LZMA_LIBS_DIR "${LIBLZMA_INCLUDE_DIRS}")
+ STRING(REGEX REPLACE "include" "lib" LZMA_LIBS_DIR ${LZMA_LIBS_DIR})
+ set(LZMA_LIBS "-L${LZMA_LIBS_DIR} -llzma")
endif()

if(LIBXML2_WITH_THREADS)
@@ -411,7 +415,9 @@ endif()

if(LIBXML2_WITH_ZLIB)
target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB)
- set(Z_LIBS "-lz")
+ set(Z_LIBS_DIR "${ZLIB_INCLUDE_DIRS}")
+ STRING(REGEX REPLACE "include" "lib" Z_LIBS_DIR ${Z_LIBS_DIR})
+ set(Z_LIBS "-L${Z_LIBS_DIR} -lz")
endif()

set_target_properties(
38 changes: 0 additions & 38 deletions textproc/libxml2/files/patch-Makefile.in

This file was deleted.

12 changes: 0 additions & 12 deletions textproc/libxml2/files/patch-config.h.in

This file was deleted.

11 changes: 0 additions & 11 deletions textproc/libxml2/files/patch-configure

This file was deleted.

24 changes: 12 additions & 12 deletions textproc/libxml2/files/patch-python_libxml.c
@@ -1,33 +1,33 @@
# Workaround https://bugzilla.gnome.org/show_bug.cgi?id=789714
# Obtained from openSuse / Fedora

--- python/libxml.c.orig 2016-06-07 10:04:14 UTC
--- python/libxml.c.orig 2023-08-11 20:30:35 UTC
+++ python/libxml.c
@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
@@ -1606,12 +1606,19 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx,
PyObject *message;
PyObject *result;
char str[1000];
+ unsigned char *ptr = (unsigned char *)str;

#ifdef DEBUG_ERROR
printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
@@ -1636,12 +1637,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
str[999] = 0;
va_end(ap);
#endif

+#if PY_MAJOR_VERSION >= 3
+ /* Ensure the error string doesn't start at UTF8 continuation. */
+ while (*ptr && (*ptr & 0xc0) == 0x80)
+ ptr++;
+ /* Ensure the error string doesn't start at UTF8 continuation. */
+ while (*ptr && (*ptr & 0xc0) == 0x80)
+ ptr++;
+#endif

+
if (libxml_xmlPythonErrorFuncHandler == NULL) {
va_start(ap, msg);
vfprintf(stderr, msg, ap);
@@ -1625,9 +1632,11 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx,
list = PyTuple_New(2);
PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
- message = libxml_charPtrConstWrap(str);
+ message = libxml_charPtrConstWrap(ptr);
PyTuple_SetItem(list, 1, message);
result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
result = PyObject_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ /* Forget any errors caused in the error handler. */
+ PyErr_Clear();
Py_XDECREF(list);
Expand Down
13 changes: 7 additions & 6 deletions textproc/libxml2/pkg-plist
Expand Up @@ -47,15 +47,17 @@ include/libxml2/libxml/xmlwriter.h
include/libxml2/libxml/xpath.h
include/libxml2/libxml/xpathInternals.h
include/libxml2/libxml/xpointer.h
lib/cmake/libxml2/libxml2-config.cmake
%%STATIC%%lib/libxml2.a
lib/cmake/libxml2-%%LIBVERSION%%/libxml2-config-version.cmake
lib/cmake/libxml2-%%LIBVERSION%%/libxml2-config.cmake
lib/cmake/libxml2-%%LIBVERSION%%/libxml2-export-%%CMAKE_BUILD_TYPE%%.cmake
lib/cmake/libxml2-%%LIBVERSION%%/libxml2-export.cmake
lib/libxml2.so
lib/libxml2.so.2
lib/libxml2.so.%%LIBVERSION%%
libdata/pkgconfig/libxml-2.0.pc
man/man1/xml2-config.1.gz
man/man1/xmlcatalog.1.gz
man/man1/xmllint.1.gz
share/man/man1/xml2-config.1.gz
share/man/man1/xmlcatalog.1.gz
share/man/man1/xmllint.1.gz
share/aclocal/libxml.m4
%%PORTDOCS%%%%DOCSDIR%%/devhelp/general.html
%%PORTDOCS%%%%DOCSDIR%%/devhelp/home.png
Expand Down Expand Up @@ -125,7 +127,6 @@ share/aclocal/libxml.m4
%%PORTDOCS%%%%DOCSDIR%%/examples/testWriter.c
%%PORTDOCS%%%%DOCSDIR%%/examples/tree1.c
%%PORTDOCS%%%%DOCSDIR%%/examples/tree2.c
%%PORTDOCS%%%%DOCSDIR%%/examples/xmllint.c
%%PORTDOCS%%%%DOCSDIR%%/examples/xpath1.c
%%PORTDOCS%%%%DOCSDIR%%/examples/xpath2.c
%%PORTDOCS%%%%DOCSDIR%%/tutorial/apa.html
Expand Down
22 changes: 14 additions & 8 deletions textproc/py-libxml2/Makefile
Expand Up @@ -5,27 +5,33 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
COMMENT= Python interface for XML parser library for GNOME
MASTERDIR= ${.CURDIR}/../libxml2

USES+= gettext-runtime gnome python shebangfix
USES+= gnome python shebangfix
USE_GNOME= libxml2
USE_PYTHON= autoplist distutils
USE_PYTHON= flavors
SHEBANG_FILES= *.py doc/*.py python/*.py python/tests/*.py

# Help CMake determine the correct version of Python if
# multiple versions are installed
CMAKE_ARGS= -DPython_EXECUTABLE=${PYTHON_CMD}

OPTIONS_EXCLUDE= ${OPTIONS_DEFINE}

# Tell master port we're a slave port
LIBXML2_SLAVE= python
# Grab pkg-descr from slave port
DESCR= ${.CURDIR}/pkg-descr

BUILD_WRKSRC= ${WRKSRC}/python
INSTALL_WRKSRC= ${BUILD_WRKSRC}

# Don't append pkg-plist from master port
PLIST=

DOCSDIR= ${PREFIX}/share/doc/py-libxml2
EXAMPLESDIR= ${PREFIX}/share/examples/py-libxml2
PLIST_FILES= ${PYTHON_SITELIBDIR}/drv_libxml2.py \
${PYTHON_SITELIBDIR}/libxml2.py \
${PYTHON_SITELIBDIR}/libxml2mod.so

#do-configure:
do-install:
${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
${INSTALL_SCRIPT} ${WRKSRC}/python/drv_libxml2.py ${STAGEDIR}${PYTHON_SITELIBDIR}
${INSTALL_SCRIPT} ${BUILD_WRKSRC}/libxml2.py ${STAGEDIR}${PYTHON_SITELIBDIR}
${INSTALL_LIB} ${BUILD_WRKSRC}/libxml2mod.so ${STAGEDIR}${PYTHON_SITELIBDIR}

.include "${MASTERDIR}/Makefile"

0 comments on commit 25e6f68

Please sign in to comment.