2009-06-18 18:16:21 +00:00
#
2024-02-10 12:10:37 +00:00
# spec file for package libxml2
2009-06-18 18:16:21 +00:00
#
2025-01-20 08:42:54 +00:00
# Copyright (c) 2025 SUSE LLC
2009-06-18 18:16:21 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
2019-01-28 07:51:27 +00:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
2009-06-18 18:16:21 +00:00
#
2012-06-13 14:07:50 +00:00
2022-03-20 19:44:40 +00:00
%define base_name libxml2
%define libname libxml2-2
2022-03-21 14:09:59 +00:00
%define flavor @BUILD_FLAVOR@%nil
%if "%{flavor}" == "python"
%define dash -
%define buildpython 1
%endif
2022-03-20 19:44:40 +00:00
2024-11-12 14:57:39 +00:00
%{?sle15allpythons}
2022-03-21 14:09:59 +00:00
Name : libxml2%{?dash} %{flavor}
2025-04-22 08:35:55 +00:00
Version : 2.13.8
2011-07-11 09:00:20 +00:00
Release : 0
2011-12-27 17:37:11 +00:00
License : MIT
2021-10-25 13:06:46 +00:00
Summary : A Library to Manipulate XML Files
2022-03-20 19:44:40 +00:00
URL : https://gitlab.gnome.org/GNOME/libxml2
2025-01-20 08:42:54 +00:00
Source0 : https://download.gnome.org/sources/%{name} /2.13/libxml2-%{version} .tar.xz
2022-03-20 19:44:40 +00:00
Source1 : baselibs.conf
2022-10-31 18:19:13 +00:00
# W3C Conformance tests
Source2 : https://www.w3.org/XML/Test/xmlts20080827.tar.gz
2022-03-20 19:44:40 +00:00
### -- Upstream patches range from 0 to 999 -- ###
2021-10-25 13:06:46 +00:00
# PATCH-FIX-UPSTREAM libxml2-python3-unicode-errors.patch bsc#1064286 mcepl@suse.com
# remove segfault after doc.freeDoc()
2022-03-20 19:44:40 +00:00
Patch0 : libxml2-python3-unicode-errors.patch
2019-07-31 13:47:56 +00:00
# PATCH-FIX-UPSTREAM libxml2-python3-string-null-check.patch bsc#1065270 mgorse@suse.com
2021-06-01 08:19:29 +00:00
# https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/15
2022-03-20 19:44:40 +00:00
Patch1 : libxml2-python3-string-null-check.patch
2023-11-16 15:42:22 +00:00
2022-03-20 19:44:40 +00:00
#
### -- openSUSE patches range from 1000 to 1999 -- ###
# PATCH-FIX-OPENSUSE
#Patch1000:
#
### -- SUSE patches starts from 2000 -- ###
2023-11-16 15:56:37 +00:00
## TODO -- Is libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch really
## SUSE-specific? If so, shouldn't it be applied only for SLE distributions?
# PATCH-FIX-SUSE bsc#1135123 Added a new configurable variable XPATH_DEFAULT_MAX_NODESET_LENGTH to avoid nodeset limit
Patch2000 : libxml2-make-XPATH_MAX_NODESET_LENGTH-configurable.patch
2025-07-01 10:08:47 +00:00
# CVE-2025-6170 [bsc#1244700], stack buffer overflow may lead to a crash|CVE-2025-6021 [bsc#1244580], Integer Overflow in xmlBuildQName() Leads to Stack Buffer Overflow in libxml2
Patch2001 : libxml2-CVE-2025-6170,6021.patch
2025-07-07 12:23:45 +00:00
# CVE-2025-49794 [bsc#1244554], heap use after free (UAF) can lead to Denial of service (DoS)|CVE-2025-49796 [bsc#1244557], type confusion may lead to Denial of service (DoS)
Patch2002 : libxml2-CVE-2025-49794,49796.patch
# CVE-2025-49795 [bsc#1244555], null pointer dereference may lead to Denial of service (DoS)
Patch2003 : libxml2-CVE-2025-49795.patch
2022-03-20 19:44:40 +00:00
#
2015-11-26 08:56:39 +00:00
BuildRequires : fdupes
2017-09-10 10:05:02 +00:00
BuildRequires : pkgconfig
2010-12-03 12:27:15 +00:00
BuildRequires : readline-devel
2017-09-10 10:05:02 +00:00
BuildRequires : pkgconfig(liblzma)
2021-10-25 13:06:46 +00:00
BuildRequires : pkgconfig(zlib)
2022-03-21 14:09:59 +00:00
%if 0%{?buildpython}
BuildRequires : %{python_module devel}
2023-10-24 07:38:21 +00:00
BuildRequires : %{python_module pip}
BuildRequires : %{python_module setuptools}
BuildRequires : %{python_module wheel}
2022-03-21 14:09:59 +00:00
BuildRequires : %{python_module xml}
BuildRequires : python-rpm-macros
BuildRequires : pkgconfig(libxml-2.0)
2021-10-25 13:06:46 +00:00
# TW: generate subpackages for every python3 flavor
%define python_subpackage_only 1
2020-10-29 15:26:01 +00:00
%python_subpackages
2022-03-21 14:09:59 +00:00
%endif
2009-06-18 18:16:21 +00:00
%description
The XML C library was initially developed for the GNOME project. It is
now used by many programs to load and save extensible data structures
or manipulate any kind of XML files.
2022-03-20 19:44:40 +00:00
%package -n %{libname}
2012-02-23 12:37:52 +00:00
Summary : A Library to Manipulate XML Files
2022-03-20 19:44:40 +00:00
%description -n %{libname}
2012-02-23 12:37:52 +00:00
The XML C library was initially developed for the GNOME project. It is
now used by many programs to load and save extensible data structures
or manipulate any kind of XML files.
This library implements a number of existing standards related to
markup languages, including the XML standard, name spaces in XML, XML
Base, RFC 2396, XPath, XPointer, HTML4, XInclude, SGML catalogs, and
XML catalogs. In most cases, libxml tries to implement the
specification in a rather strict way. To some extent, it provides
support for the following specifications, but does not claim to
implement them: DOM, FTP client, HTTP client, and SAX.
The library also supports RelaxNG. Support for W3C XML Schemas is in
progress.
%package tools
Summary : Tools using libxml
2022-03-20 19:44:40 +00:00
Provides : %{base_name} = %{version} -%{release}
# Use hardcoded version to avoid unwanted behavior in the future.
Obsoletes : %{base_name} < 2.9.13
2012-02-23 12:37:52 +00:00
%description tools
This package contains xmllint, a very useful tool proving libxml's power.
2009-06-18 18:16:21 +00:00
%package devel
2017-09-21 14:42:13 +00:00
Summary : Development files for libxml2, an XML manipulation library
2022-03-20 19:44:40 +00:00
Requires : %{base_name} = %{version}
Requires : %{base_name} -tools = %{version}
Requires : %{libname} = %{version}
2009-06-18 18:16:21 +00:00
Requires : glibc-devel
2021-10-25 13:06:46 +00:00
Requires : libxml2 = %{version}
2010-12-03 12:27:15 +00:00
Requires : readline-devel
2019-07-31 13:47:56 +00:00
Requires : xz-devel
2017-09-10 10:05:02 +00:00
Requires : pkgconfig(liblzma)
Requires : pkgconfig(zlib)
2009-06-18 18:16:21 +00:00
%description devel
2017-09-21 14:42:13 +00:00
The XML C library can load and save extensible data structures
or manipulate any kind of XML files.
This subpackage contains header files for developing
applications that want to make use of libxml.
2009-06-18 18:16:21 +00:00
%package doc
2017-09-21 14:42:13 +00:00
Summary : Documentation for libxml, an XML manipulation library
2022-03-20 19:44:40 +00:00
Requires : %{libname} = %{version}
2010-01-14 21:26:40 +00:00
BuildArch : noarch
2009-06-18 18:16:21 +00:00
%description doc
The XML C library was initially developed for the GNOME project. It is
now used by many programs to load and save extensible data structures
or manipulate any kind of XML files.
2022-03-21 14:09:59 +00:00
%package -n python-libxml2
2021-10-25 13:06:46 +00:00
Summary : Python Bindings for %{name}
2022-03-20 19:44:40 +00:00
Requires : %{libname} = %{version}
2021-10-25 13:06:46 +00:00
Requires : python-extras
2022-03-20 19:44:40 +00:00
Provides : %{base_name} -python = %{version} -%{release}
2021-10-25 13:06:46 +00:00
Provides : python-libxml2-python = %{version} -%{release}
2022-03-20 19:44:40 +00:00
# Use hardcoded version to avoid unwanted behavior in the future.
Obsoletes : %{base_name} -python < 2.9.13
Obsoletes : python-libxml2-python < 2.9.13
2021-10-25 13:06:46 +00:00
2022-03-21 14:09:59 +00:00
%description -n python-libxml2
2021-10-25 13:06:46 +00:00
This package contains a module that permits
applications written in the Python programming language to use the
interface supplied by the libxml2 library to manipulate XML files.
This library allows manipulation of XML files. It includes support for
reading, modifying, and writing XML and HTML files. There is DTD
support that includes parsing and validation even with complex DTDs,
either at parse time or later once the document has been modified.
2009-06-18 18:16:21 +00:00
%prep
2021-10-25 13:06:46 +00:00
%autosetup -p1 -n libxml2-%{version}
2022-09-01 10:19:03 +00:00
sed -i '1 s|/usr/bin/env python|/usr/bin/python3|' doc/apibuild.py
2010-11-02 14:10:34 +00:00
2009-06-18 18:16:21 +00:00
%build
2022-03-21 14:09:59 +00:00
%if ! 0%{?buildpython}
2022-03-20 19:44:40 +00:00
# TODO -- Document why are we using the -fno-strict-aliasing extra flag.
2019-07-31 13:47:56 +00:00
export CFLAGS=" %{optflags} - f n o - s t r i c t - a l i a s i n g "
2017-09-10 10:05:02 +00:00
%configure \
--disable-silent-rules \
--disable-static \
2022-03-20 19:44:40 +00:00
--docdir=%{_docdir} /%{base_name} \
2019-07-31 13:47:56 +00:00
--without-python \
2009-06-18 18:16:21 +00:00
--with-history \
2010-03-18 21:52:34 +00:00
--enable-ipv6 \
2010-04-07 11:14:45 +00:00
--with-sax1 \
--with-regexps \
--with-threads \
--with-reader \
2022-09-01 10:19:03 +00:00
--with-ftp \
2022-09-01 16:11:04 +00:00
--with-http \
2025-06-26 12:54:45 +00:00
--with-legacy
2010-04-07 11:14:45 +00:00
2022-03-20 19:44:40 +00:00
%make_build BASE_DIR=" %{_docdir} " DOC_MODULE=" %{base_name} "
2022-03-21 14:09:59 +00:00
%else
2022-09-01 10:19:03 +00:00
%configure --with-python=%{__python 3}
2019-07-31 13:47:56 +00:00
pushd python
2024-11-13 10:54:56 +00:00
%if 0%{suse_version} > 1500
2023-10-24 07:38:21 +00:00
export PYTHONPATH=" . "
%pyproject_wheel
2024-11-13 10:54:56 +00:00
%else
%python_build
%endif
2019-07-31 13:47:56 +00:00
popd
2022-03-21 14:09:59 +00:00
%endif
2009-06-18 18:16:21 +00:00
2010-01-14 21:26:40 +00:00
%install
2022-03-21 14:09:59 +00:00
%if ! 0%{?buildpython}
2022-03-20 19:44:40 +00:00
%make_install BASE_DIR=" %{_docdir} " DOC_MODULE=" %{base_name} "
2019-08-01 10:53:38 +00:00
find %{buildroot} -type f -name " * . l a " -delete -print
2022-03-20 19:44:40 +00:00
mkdir -p " %{buildroot} / %{_docdir} / %{base_name} "
2023-05-03 16:01:24 +00:00
cp -a NEWS README.md %{buildroot} %{_docdir} /%{base_name} /
2010-12-03 12:27:15 +00:00
ln -s libxml2/libxml %{buildroot} %{_includedir} /libxml
2019-07-31 13:47:56 +00:00
# Remove duplicated file Copyright as not found by fdupes
2022-03-20 19:44:40 +00:00
rm -fr %{buildroot} %{_docdir} /%{base_name} /Copyright
2015-11-26 08:56:39 +00:00
%fdupes %{buildroot} %{_datadir}
2022-03-21 14:09:59 +00:00
%else
2019-07-31 13:47:56 +00:00
pushd python
2024-11-13 10:54:56 +00:00
%if 0%{suse_version} > 1500
2023-10-24 07:38:21 +00:00
%pyproject_install
2024-11-13 10:54:56 +00:00
%else
%python_install
%endif
2019-07-31 13:47:56 +00:00
popd
chmod a-x python/tests/*.py
%python_expand %fdupes %{buildroot} %{$python_sitearch}
2022-03-21 14:09:59 +00:00
%endif
2010-01-14 21:26:40 +00:00
2022-03-21 14:09:59 +00:00
%if ! 0%{?buildpython}
2009-06-18 18:16:21 +00:00
%check
2010-01-06 21:09:24 +00:00
# qemu-arm can't keep up atm, disabling check for arm
2017-09-10 10:05:02 +00:00
%ifnarch %{arm}
2022-10-31 18:19:13 +00:00
tar xzvf %{SOURCE2} # add conformance tests where they are expected
2020-03-16 10:02:14 +00:00
%make_build check
2022-10-31 18:19:13 +00:00
rm -rf xmlconf/ # remove the conformance tests afterwards
2010-01-06 21:09:24 +00:00
%endif
2009-06-18 18:16:21 +00:00
2022-03-20 19:44:40 +00:00
%ldconfig_scriptlets -n %{libname}
2009-06-18 18:16:21 +00:00
2022-03-20 19:44:40 +00:00
%files -n %{libname}
2012-02-23 12:37:52 +00:00
%{_libdir} /lib*.so.*
2022-08-18 11:47:37 +00:00
%license Copyright
2022-03-20 19:44:40 +00:00
%doc %dir %{_docdir} /%{base_name}
%doc %{_docdir} /%{base_name} /[ANRCT]*
2012-02-23 12:37:52 +00:00
2022-03-20 19:44:40 +00:00
# the -n %%base_name tag is necessary so that python_subpackages does not interfere
%files -n %{base_name}-tools
2009-06-18 18:16:21 +00:00
%{_bindir} /xmllint
%{_bindir} /xmlcatalog
2018-03-20 12:38:04 +00:00
%{_mandir} /man1/xmllint.1%{?ext_man}
%{_mandir} /man1/xmlcatalog.1%{?ext_man}
2009-06-18 18:16:21 +00:00
2022-03-20 19:44:40 +00:00
%files -n %{base_name}-devel
2009-06-18 18:16:21 +00:00
%{_bindir} /xml2-config
2011-12-27 17:37:11 +00:00
%dir %{_datadir} /aclocal
2009-06-18 18:16:21 +00:00
%{_datadir} /aclocal/libxml.m4
%{_includedir} /libxml
%{_includedir} /libxml2
%{_libdir} /lib*.so
%{_libdir} /pkgconfig/*.pc
2014-10-31 16:08:17 +00:00
%{_libdir} /cmake
2018-03-20 12:38:04 +00:00
%{_mandir} /man1/xml2-config.1%{?ext_man}
2009-06-18 18:16:21 +00:00
2022-03-20 19:44:40 +00:00
%files -n %{base_name}-doc
2009-06-18 18:16:21 +00:00
%{_datadir} /gtk-doc/html/*
2022-08-18 11:47:37 +00:00
%doc %{_docdir} /%{base_name} /*.html
2009-06-18 18:16:21 +00:00
# owning these directories prevents gtk-doc <-> libxml2 build loop:
%dir %{_datadir} /gtk-doc
%dir %{_datadir} /gtk-doc/html
2022-03-21 14:09:59 +00:00
%else
%files %{python_files libxml2}
2019-07-31 13:47:56 +00:00
%doc python/libxml2class.txt
%doc doc/*.py
2022-08-18 11:47:37 +00:00
%doc python/README
2020-10-29 15:26:01 +00:00
%pycache_only %{python_sitearch} /__pycache__/*libxml2*
%{python_sitearch} /*libxml2*
2022-03-21 14:09:59 +00:00
%endif
2019-07-31 13:47:56 +00:00
2009-06-18 18:16:21 +00:00
%changelog