+# TODO:
+# - fix build without libxml2-devel (python library uses old headers)
#
# Conditional build:
-%bcond_without python # don't build python module
-%bcond_without static_libs # don't build static libraries
-#
-Summary: libXML library
+%bcond_without apidocs # do not build and package API docs
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+%bcond_without static_libs # static library
+%bcond_without zlib # zlib support
+%bcond_with mem_debug # libxml2 memory debuging
+%bcond_without tests # "make check" call
+
+Summary: libXML library version 2
Summary(es.UTF-8): Biblioteca libXML version 2
Summary(pl.UTF-8): Biblioteka libXML wersja 2
Summary(pt_BR.UTF-8): Biblioteca libXML versão 2
Name: libxml2
-Version: 2.7.3
+Version: 2.9.8
Release: 2
Epoch: 1
License: MIT
Group: Libraries
#Source0: http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/%{name}-%{version}.tar.bz2
Source0: ftp://xmlsoft.org/libxml2/%{name}-%{version}.tar.gz
-# Source0-md5: 8f4fda3969237c2a33bdb1583b5d06b2
-Patch0: %{name}-amfix.patch
-Patch1: %{name}-man_fixes.patch
-Patch2: %{name}-open.gz.patch
+# Source0-md5: b786e353e2aa1b872d70d5d1ca0c740d
+Patch0: %{name}-man_fixes.patch
+Patch1: %{name}-open.gz.patch
+Patch2: %{name}-largefile.patch
+
+Patch4: %{name}-libx32.patch
+# Patch5-md5: be948499ae913253ad06ae2b0d0c2f12
URL: http://xmlsoft.org/
-BuildRequires: autoconf >= 2.2
+BuildRequires: autoconf >= 2.68
BuildRequires: automake >= 1.4
-BuildRequires: libtool >= 1:1.4.2-9
-%{?with_python:BuildRequires: python-devel}
-%{?with_python:BuildRequires: python-modules}
-%{?with_python:BuildRequires: rpm-pythonprov}
-BuildRequires: rpmbuild(macros) >= 1.219
-BuildRequires: zlib-devel
+BuildRequires: libtool >= 2:2.0
+%if %{with python2}
+BuildRequires: python-devel >= 2.0
+BuildRequires: python-modules >= 2.0
+BuildRequires: rpm-pythonprov
+%endif
+%if %{with python3}
+BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: rpm-pythonprov
+%endif
+BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: xz-devel
+%{?with_zlib:BuildRequires: zlib-devel >= 1.2.3.3}
# history support in xmllint is disabled by default
#BuildRequires: ncurses-devel
#BuildRequires: readline-devel >= 4.2
+Requires: zlib >= 1.2.3.3
Obsoletes: xml-common
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
Summary(pt_BR.UTF-8): Bibliotecas e arquivos de inclusão para desenvolvimento de aplicações que usem a biblioteca libxml
Group: Development/Libraries
Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires: xz-devel
Requires: zlib-devel
%description devel
Summary(pl.UTF-8): Dokumentacja API libxml2
Group: Documentation
Requires: gtk-doc-common
+%if "%{_rpmversion}" >= "5"
+BuildArch: noarch
+%endif
%description apidocs
libxml2 API documentation.
Analizator składniowy plików XML.
%package -n python-%{name}
-Summary: Python support for libxml2
-Summary(pl.UTF-8): Moduły języka Python dla biblioteki libxml2
+Summary: libxml2 module for Python 2.x
+Summary(pl.UTF-8): Moduł libxml2 dla Pythona 2.x
Group: Libraries/Python
Requires: %{name} = %{epoch}:%{version}-%{release}
-%pyrequires_eq python-libs
+Requires: python-libs
Obsoletes: libxml2-python
%description -n python-%{name}
-Python support for libxml2.
+This is the libxml2 module for Python 2.x, providing access to the
+libxml2 library.
%description -n python-%{name} -l pl.UTF-8
-Moduły języka Python dla biblioteki libxml2.
+Ten pakiet zawiera moduł libxml2 dla Pythona 2.x, zapewniający dostęp
+do biblioteki libxml2.
+
+%package -n python3-%{name}
+Summary: libxml2 module for Python 3.x
+Summary(pl.UTF-8): Moduł libxml2 dla Pythona 3.x
+Group: Libraries/Python
+Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires: python3-libs
+
+%description -n python3-%{name}
+This is the libxml2 module for Python 3.x, providing access to the
+libxml2 library.
+
+%description -n python3-%{name} -l pl.UTF-8
+Ten pakiet zawiera moduł libxml2 dla Pythona 3.x, zapewniający dostęp
+do biblioteki libxml2.
%prep
%setup -q
%patch0 -p1
+%if %{with zlib}
%patch1 -p1
+%endif
%patch2 -p1
+%patch4 -p1
+
%build
%{__libtoolize}
%{__aclocal}
%{__autoheader}
%{__automake}
%configure \
- %{!?with_static_libs:--enable-static=no} \
- %{!?with_python:--without-python}
+ --disable-silent-rules \
+ %{!?with_static_libs:--disable-static=no} \
+ --without-python \
+ %{!?with_zlib:--without-zlib} \
+ --with-lzma \
+ --with%{!?with_mem_debug:out}-mem-debug
%{__make}
+%if %{with python2}
+cd python
+%py_build
+cd ..
+%endif
+
+
+%if %{with python3}
+cd python
+%py3_build
+cd ..
+%endif
+
+%if %{with tests}
+%{__make} check
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT \
- DEVHELP_DIR=%{_gtkdocdir}/libxml2 \
+ devhelpdir=%{_gtkdocdir}/libxml2 \
m4datadir=%{_aclocaldir} \
pkgconfigdir=%{_pkgconfigdir}
-# move examples to proper dir
-install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-devel-%{version} \
- $RPM_BUILD_ROOT%{_examplesdir}/python-%{name}-%{version}
-mv $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/examples/* \
- $RPM_BUILD_ROOT%{_examplesdir}/%{name}-devel-%{version}
-%if %{with python}
-mv -f $RPM_BUILD_ROOT%{_docdir}/%{name}-python-%{version}/examples/* \
- $RPM_BUILD_ROOT%{_examplesdir}/python-%{name}-%{version}
+%if %{with python2}
+cd python
+%py_install
+
+%py_postclean
+cd ..
+%endif
+
+%if %{with python3}
+cd python
+%py3_install
+cd ..
%endif
# move html doc to -devel package
install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-devel-%{version}
-mv -f $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html \
+%{__mv} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html \
$RPM_BUILD_ROOT%{_docdir}/%{name}-devel-%{version}
-rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
# install catalog file
install -d $RPM_BUILD_ROOT%{_sysconfdir}/xml
LD_LIBRARY_PATH=.libs ./xmlcatalog --create \
> $RPM_BUILD_ROOT%{_sysconfdir}/xml/catalog
-%if %{with python}
-%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
-%py_comp $RPM_BUILD_ROOT%{py_sitedir}
-%py_postclean
-rm -f $RPM_BUILD_ROOT%{py_sitedir}/*.{la,a}
-%endif
-
%clean
rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_bindir}/xml2-config
%attr(755,root,root) %{_libdir}/libxml2.so
%{_libdir}/libxml2.la
+%attr(755,root,root) %{_libdir}/xml2Conf.sh
+%{_libdir}/cmake/libxml2
%{_pkgconfigdir}/libxml-2.0.pc
%{_aclocaldir}/libxml.m4
%{_includedir}/libxml2
%{_mandir}/man1/xml2-config.1*
-%{_examplesdir}/%{name}-devel-%{version}
%if %{with static_libs}
%files static
%{_libdir}/libxml2.a
%endif
+%if %{with apidocs}
%files apidocs
%defattr(644,root,root,755)
%{_gtkdocdir}/libxml2
+%endif
%files progs
%defattr(644,root,root,755)
%{_mandir}/man1/xmlcatalog.1*
%{_mandir}/man1/xmllint.1*
-%if %{with python}
+%if %{with python2}
%files -n python-%{name}
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/libxml2mod.so
%{py_sitedir}/drv_libxml2.py[co]
%{py_sitedir}/libxml2.py[co]
-%{_examplesdir}/python-%{name}-%{version}
+%if "%{py_ver}" > "2.4"
+%{py_sitedir}/libxml2_python-*.egg-info
+%endif
+%endif
+
+%if %{with python3}
+%files -n python3-%{name}
+%defattr(644,root,root,755)
+%{py3_sitedir}/__pycache__/*.py[co]
+%{py3_sitedir}/drv_libxml2.py
+%{py3_sitedir}/libxml2.py
+%{py3_sitedir}/libxml2_python-%{version}-py*.egg-info
+%attr(755,root,root) %{py3_sitedir}/libxml2mod.cpython-*.so
%endif