File libxml2.spec of Package libxml2
%define realname libxml2
%define realver 2.9.4
%define srcext tar.gz
%define so_ver 2
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
%if 0%{?suse_version}
%define python_pkg python-%{realname}
%else
%define python_pkg %{realname}-python
%endif
# Common info
Name: %{realname}%{?suse_version:-%{so_ver}}
Version: %{realver}
Release: %{?extraver:0.}1%{?dist}
License: MIT
Group: System/Libraries
URL: http://xmlsoft.org/
Summary: XML C parser and toolkit developed for the Gnome project
# Install-time parameters
%if ! 0%{?suse_version}
Provides: %{realname}-tools
%else
Provides: %{realname}
%endif
# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: zlib-devel xz-devel
BuildRoot: %{_tmppath}/%{name}-root
Source: ftp://xmlsoft.org/libxml2/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
Libxml2 is the XML C parser and toolkit developed for the Gnome project (but
usable outside of the Gnome platform), it is free software available under the
MIT License.
%package -n %{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for %{realname}
Requires: %{name} = %{version}
Requires: libicu-devel
Requires: zlib-devel xz-devel
%description -n %{realname}-devel
Development files for %{name}
%if 0%{?suse_version}
%package -n %{realname}-tools
Group: System/Libraries
Summary: Tools using libxml
Requires: %{name} = %{version}
%description -n %{realname}-tools
This package contains xmllint, a very useful tool proving libxml's power.
%endif
%package -n %{python_pkg}
Group: Development/Languages/Python
Summary: Python binding for %{realname}
Requires: %{name} = %{version}
Requires: python%{?suse_version:-base}
Provides: python-libxml2 = %{version}
Provides: libxml2-python = %{version}
%description -n %{python_pkg}
This is the libxml2 python module, providing access to the
libxml2 and libxslt (if available) libraries.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%build
%configure \
--disable-static \
CFLAGS="%{optflags} %{?gcc_lto}" \
CXXFLAGS="%{optflags} %{?gcc_lto}" \
LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
if [ "%{buildroot}" != "/" ]
then
%{__rm} -rf %{buildroot}%{_datadir}/doc
%{__rm} -rf %{buildroot}%{_datadir}/gtk-doc
fi
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc AUTHORS COPYING Copyright NEWS README
%{_libdir}/%{realname}.so.%{?so_ver}*
%if ! 0%{?suse_version}
%{_bindir}/xmlcatalog
%{_bindir}/xmllint
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man1/xmllint.1*
%endif
# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%{_bindir}/xml2-config
%{_libdir}/pkgconfig/*.pc
%dir %{_includedir}/%{realname}/libxml
%dir %{_includedir}/%{realname}/
%{_includedir}/%{realname}/libxml/*.h
%{_libdir}/%{realname}.so
%{_libdir}/xml2Conf.sh
%exclude %{_libdir}/cmake/libxml2/libxml2-config.cmake
%exclude %{_libdir}/*.la
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/libxml.m4
%doc %{_mandir}/man1/xml2-config.1*
%doc %{_mandir}/man3/*
%if 0%{?suse_version}
%files -n %{realname}-tools
%defattr(-,root,root)
%{_bindir}/xmlcatalog
%{_bindir}/xmllint
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man1/xmllint.1*
%endif
%files -n %{python_pkg}
%defattr(-,root,root)
%doc python/README
%{python_sitearch}/*
%exclude %{python_sitearch}/*.la
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog