[packages/compat-libxml2-2] - just shared library copied from libxml2.spec for 2.13.8 for compatibility with some older (also bi

qboosh qboosh at pld-linux.org
Wed Jul 16 21:44:22 CEST 2025


commit 1551c1f9bd212341fdf3da30f3d61fcbeca16a26
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jul 16 21:45:33 2025 +0200

    - just shared library copied from libxml2.spec for 2.13.8 for compatibility with some older (also binary) software

 compat-libxml2-2.spec   | 109 ++++++++++++++++++++++++++++++++++++++++++++++++
 libxml2-largefile.patch |  12 ++++++
 libxml2-libx32.patch    |  11 +++++
 libxml2-normalize.patch |  27 ++++++++++++
 libxml2-open.gz.patch   |  32 ++++++++++++++
 5 files changed, 191 insertions(+)
---
diff --git a/compat-libxml2-2.spec b/compat-libxml2-2.spec
new file mode 100644
index 0000000..f3a98ef
--- /dev/null
+++ b/compat-libxml2-2.spec
@@ -0,0 +1,109 @@
+#
+# Conditional build:
+%bcond_with	ftp		# FTP support
+%bcond_without	legacy		# legacy API support
+%bcond_without	zlib		# zlib support
+%bcond_without	tests		# "make check" call
+
+Summary:	libXML library version 2, soname libxml2.so.2 for backward compatibility
+Summary(pl.UTF-8):	Biblioteka libXML wersja 2, soname libxml2.so.2 dla zgodności wstecznej
+Name:		compat-libxml2
+Version:	2.13.8
+Release:	1
+License:	MIT
+Group:		Libraries
+Source0:	https://download.gnome.org/sources/libxml2/2.13/libxml2-%{version}.tar.xz
+# Source0-md5:	740751403c075e55812ecaaafe9d495f
+Patch0:		libxml2-open.gz.patch
+Patch1:		libxml2-largefile.patch
+Patch2:		libxml2-libx32.patch
+Patch4:		libxml2-normalize.patch
+URL:		http://xmlsoft.org/
+BuildRequires:	autoconf >= 2.68
+BuildRequires:	automake >= 1:1.16.3
+BuildRequires:	libtool >= 2:2.0
+BuildRequires:	pkgconfig
+BuildRequires:	rpm-build >= 4.6
+BuildRequires:	rpmbuild(macros) >= 1.714
+BuildRequires:	tar >= 1:1.22
+BuildRequires:	xz
+BuildRequires:	xz-devel
+%{?with_zlib:BuildRequires:	zlib-devel >= 1.2.3.3}
+Requires:	zlib >= 1.2.3.3
+Provides:	libxml2 = 1:%{version}-%{release}
+Obsoletes:	libxml2 < 1:2.14
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+libxml2 library allows you to manipulate XML files.
+
+This package provides older version of library, with libxml2.so.2
+soname, which has been used for years.
+
+%description -l pl.UTF-8
+Biblioteka libxml2 umożliwia operowanie zawartością plików XML.
+
+Ten pakiet dostarcza starszą wersję biblioteki, o soname libxml2.so.2,
+które było używane przez wiele lat.
+
+%prep
+%setup -q -n libxml2-%{version}
+%if %{with zlib}
+%patch -P0 -p1
+%endif
+%patch -P1 -p1
+%patch -P2 -p1
+%patch -P4 -p1
+
+%build
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+	--disable-silent-rules \
+	--disable-static \
+	%{?with_ftp:--with-ftp} \
+	--with-http \
+	%{?with_legacy:--with-legacy} \
+	--with-lzma \
+	--without-python \
+	--with-tls \
+	%{?with_zlib:--with-zlib}
+
+%{__make}
+
+%if %{with tests}
+%{__make} check
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT \
+	devhelpdir=%{_gtkdocdir}/libxml2
+
+# keep only shared library
+%{__rm} $RPM_BUILD_ROOT%{_bindir}/{xml2-config,xmlcatalog,xmllint}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libxml2.{la,so}
+%{__rm} $RPM_BUILD_ROOT%{_pkgconfigdir}/libxml-2.0.pc
+%{__rm} $RPM_BUILD_ROOT%{_aclocaldir}/libxml.m4
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/{xml2-config,xmlcatalog,xmllint}.1
+%{__rm} -r $RPM_BUILD_ROOT%{_includedir}/libxml2
+%{__rm} -r $RPM_BUILD_ROOT%{_libdir}/cmake/libxml2
+%{__rm} -r $RPM_BUILD_ROOT%{_gtkdocdir}/libxml2
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/libxml2
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc Copyright NEWS README.md
+%attr(755,root,root) %{_libdir}/libxml2.so.*.*.*
+%ghost %{_libdir}/libxml2.so.2
diff --git a/libxml2-largefile.patch b/libxml2-largefile.patch
new file mode 100644
index 0000000..79d1c67
--- /dev/null
+++ b/libxml2-largefile.patch
@@ -0,0 +1,12 @@
+--- libxml2-2.11.0/libxml.h.orig	2023-04-29 12:27:04.077844048 +0200
++++ libxml2-2.11.0/libxml.h	2023-04-29 12:28:21.828831198 +0200
+@@ -17,6 +17,9 @@
+   #ifndef _LARGEFILE_SOURCE
+     #define _LARGEFILE_SOURCE
+   #endif
++  #ifndef _LARGEFILE64_SOURCE
++    #define _LARGEFILE64_SOURCE
++  #endif
+   #ifndef _FILE_OFFSET_BITS
+     #define _FILE_OFFSET_BITS 64
+   #endif
diff --git a/libxml2-libx32.patch b/libxml2-libx32.patch
new file mode 100644
index 0000000..70cd4bf
--- /dev/null
+++ b/libxml2-libx32.patch
@@ -0,0 +1,11 @@
+--- libxml2-2.10.0/xml2-config.in.orig	2022-08-18 16:32:47.652266712 +0200
++++ libxml2-2.10.0/xml2-config.in	2022-08-18 16:33:48.715269239 +0200
+@@ -89,7 +89,7 @@ while test $# -gt 0; do
+             libs="@XML_LIBS@ @XML_PRIVATE_LIBS@ @MODULE_PLATFORM_LIBS@ @LIBS@"
+         fi
+ 
+-        if [ "@XML_LIBDIR@" != "-L/usr/lib" -a "@XML_LIBDIR@" != "-L/usr/lib64" ]; then
++        if [ "@XML_LIBDIR@" != "-L/usr/lib" -a "@XML_LIBDIR@" != "-L/usr/lib64" -a "@XML_LIBDIR@" != "-L/usr/libx32" ]; then
+             libs="@XML_LIBDIR@ $libs"
+         fi
+         ;;
diff --git a/libxml2-normalize.patch b/libxml2-normalize.patch
new file mode 100644
index 0000000..f8de820
--- /dev/null
+++ b/libxml2-normalize.patch
@@ -0,0 +1,27 @@
+Fix check for absolute path.
+Before that xmlNormalizePath("../xml/../../../../libmm-glib/generated/mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Simple.xml")
+returned "../../libmm-glib/generated/mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Simple.xml"
+instead of "../../../../libmm-glib/generated/mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Simple.xml"
+--- libxml2-2.13.7/uri.c.orig	2025-04-12 07:07:38.185693733 +0200
++++ libxml2-2.13.7/uri.c	2025-04-12 07:43:59.817208154 +0200
+@@ -1560,7 +1560,7 @@ xmlNormalizePath(char *path, int isFile)
+                         break;
+                     cur += 3;
+                     continue;
+-                } else if (out[0] == '/') {
++                } else if (path[0] == '/') {
+                     /* Ignore extraneous ".." in absolute paths */
+                     if (cur[2] == 0)
+                         break;
+diff -Nur libxml2-2.13.7/result.orig/XInclude/base.xml libxml2-2.13.7/result/XInclude/base.xml
+--- libxml2-2.13.7/result.orig/XInclude/base.xml	2025-03-27 14:37:41.000000000 +0100
++++ libxml2-2.13.7/result/XInclude/base.xml	2025-04-12 08:04:50.813764257 +0200
+@@ -6,7 +6,7 @@
+         ents/one/two2
+     </elem><elem xml:base="../../ents/one2/two">
+         ents/one2/two
+-    </elem><elem xml:base="two/three/four">
++    </elem><elem xml:base="../../../docs/one/two/three/four">
+         docs/one/two/three/four
+     </elem>
+ </doc>
diff --git a/libxml2-open.gz.patch b/libxml2-open.gz.patch
new file mode 100644
index 0000000..0f34ab6
--- /dev/null
+++ b/libxml2-open.gz.patch
@@ -0,0 +1,32 @@
+--- libxml2-2.13.0/xmlIO.c.orig	2024-06-14 12:32:12.257784372 +0200
++++ libxml2-2.13.0/xmlIO.c	2024-06-14 19:23:06.355299914 +0200
+@@ -547,6 +547,29 @@
+     fd = open(filename, flags, 0666);
+ #endif /* WIN32 */
+ 
++#ifdef LIBXML_ZLIB_ENABLED
++    if (fd < 0 && errno == ENOENT) {
++        /* If we cannot open `foo.xml', we try `foo.xml.gz'. However we i
++         * append .gz only if filename doesn't alreay end with .gz. */
++        if (strlen(filename) < 3 || strcmp(filename + strlen(filename) - 3, ".gz") != 0) {
++            char *gz_filename = xmlMalloc(strlen(filename) + 4);
++            int gz_fd;
++
++            if (gz_filename != NULL) {
++                strcpy(gz_filename, filename);
++                strcat(gz_filename, ".gz");
++            }
++
++            gz_fd = open(gz_filename, flags, 0777);
++
++            if (gz_fd >= 0)
++                fd = gz_fd;
++
++            xmlFree(gz_filename);
++        }
++    }
++
++#endif /* LIBXML_ZLIB_ENABLED */
+     if (fd < 0) {
+         /*
+          * Windows and possibly other platforms return EINVAL
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/compat-libxml2-2.git/commitdiff/1551c1f9bd212341fdf3da30f3d61fcbeca16a26



More information about the pld-cvs-commit mailing list