diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..86b0022
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ python
+
diff --git a/libxml2.changes b/libxml2.changes
index 6883a33..70519fa 100644
--- a/libxml2.changes
+++ b/libxml2.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Fri Mar 18 09:46:03 UTC 2022 - Dominique Leuenberger
+
+- Build python bindings in a 2nd run, using multibuild: otherwise,
+ libxml2 requires pkgconfig(libxml-2.0) to build, causing issues
+ to bootstrap.
+
-------------------------------------------------------------------
Tue Mar 8 06:32:13 UTC 2022 - Luciano Santos
diff --git a/libxml2.spec b/libxml2.spec
index 940c07d..dd3c316 100644
--- a/libxml2.spec
+++ b/libxml2.spec
@@ -1,5 +1,5 @@
#
-# spec file for package libxml2
+# spec file
#
# Copyright (c) 2022 SUSE LLC
#
@@ -18,14 +18,19 @@
%define base_name libxml2
%define libname libxml2-2
+%define flavor @BUILD_FLAVOR@%nil
+%if "%{flavor}" == "python"
+%define dash -
+%define buildpython 1
+%endif
-Name: libxml2
+Name: libxml2%{?dash}%{flavor}
Version: 2.9.13
Release: 0
License: MIT
Summary: A Library to Manipulate XML Files
URL: https://gitlab.gnome.org/GNOME/libxml2
-Source0: https://download.gnome.org/sources/%{name}/2.9/%{name}-%{version}.tar.xz
+Source0: https://download.gnome.org/sources/%{name}/2.9/libxml2-%{version}.tar.xz
Source1: baselibs.conf
#
### -- Upstream patches range from 0 to 999 -- ###
@@ -46,18 +51,20 @@ Patch1: libxml2-python3-string-null-check.patch
# 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
#
-BuildRequires: %{python_module devel}
-BuildRequires: %{python_module xml}
BuildRequires: fdupes
BuildRequires: pkgconfig
-BuildRequires: python-rpm-macros
BuildRequires: readline-devel
BuildRequires: pkgconfig(liblzma)
-BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(zlib)
+%if 0%{?buildpython}
+BuildRequires: %{python_module devel}
+BuildRequires: %{python_module xml}
+BuildRequires: python-rpm-macros
+BuildRequires: pkgconfig(libxml-2.0)
# TW: generate subpackages for every python3 flavor
%define python_subpackage_only 1
%python_subpackages
+%endif
%description
The XML C library was initially developed for the GNOME project. It is
@@ -122,7 +129,7 @@ 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.
-%package -n python-%{name}
+%package -n python-libxml2
Summary: Python Bindings for %{name}
Requires: %{libname} = %{version}
Requires: python-extras
@@ -133,7 +140,7 @@ Provides: python-libxml2-python = %{version}-%{release}
Obsoletes: %{base_name}-python < 2.9.13
Obsoletes: python-libxml2-python < 2.9.13
-%description -n python-%{name}
+%description -n python-libxml2
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.
@@ -147,6 +154,7 @@ either at parse time or later once the document has been modified.
%autosetup -p1 -n libxml2-%{version}
%build
+%if ! 0%{?buildpython}
# TODO -- Document why are we using the -fno-strict-aliasing extra flag.
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure \
@@ -165,11 +173,14 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
--with-http
%make_build BASE_DIR="%{_docdir}" DOC_MODULE="%{base_name}"
+%else
pushd python
%python_build
popd
+%endif
%install
+%if ! 0%{?buildpython}
%make_install BASE_DIR="%{_docdir}" DOC_MODULE="%{base_name}"
find %{buildroot} -type f -name "*.la" -delete -print
mkdir -p "%{buildroot}/%{_docdir}/%{base_name}"
@@ -178,13 +189,15 @@ ln -s libxml2/libxml %{buildroot}%{_includedir}/libxml
# Remove duplicated file Copyright as not found by fdupes
rm -fr %{buildroot}%{_docdir}/%{base_name}/Copyright
%fdupes %{buildroot}%{_datadir}
-
+%else
pushd python
%python_install
popd
chmod a-x python/tests/*.py
%python_expand %fdupes %{buildroot}%{$python_sitearch}
+%endif
+%if ! 0%{?buildpython}
%check
# qemu-arm can't keep up atm, disabling check for arm
%ifnarch %{arm}
@@ -227,12 +240,15 @@ chmod a-x python/tests/*.py
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
-%files %{python_files %{name}}
+%else
+
+%files %{python_files libxml2}
%doc python/TODO
%doc python/libxml2class.txt
%doc doc/*.py
%doc doc/python.html
%pycache_only %{python_sitearch}/__pycache__/*libxml2*
%{python_sitearch}/*libxml2*
+%endif
%changelog