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}
%define python_pkg %{realname}-python

# Common info
Name:          %{realname}%{?suse_version:-%{so_ver}}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Libraries
Summary:       XML C parser and toolkit developed for the Gnome project

# Install-time parameters
%if ! 0%{?suse_version}
Provides:      %{realname}-tools
Provides:      %{realname}

# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: zlib-devel xz-devel
BuildRoot:     %{_tmppath}/%{name}-root

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.

%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)
%setup -q -n %{realname}-%{realver}%{?extraver}

%configure \
 --disable-static \
 CFLAGS="%{optflags} %{?gcc_lto}" \
 CXXFLAGS="%{optflags} %{?gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%{__make} %{?_smp_mflags}

%{__make} install DESTDIR=%{buildroot}
if [ "%{buildroot}" != "/" ]
  %{__rm} -rf %{buildroot}%{_datadir}/doc
  %{__rm} -rf %{buildroot}%{_datadir}/gtk-doc

[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%if ! 0%{?suse_version}
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man1/xmllint.1*

# Development stuff
%files -n %{realname}-devel
%dir %{_includedir}/%{realname}/libxml
%dir %{_includedir}/%{realname}/
%exclude %{_libdir}/cmake/libxml2/libxml2-config.cmake
%exclude %{_libdir}/*.la
%dir %{_datadir}/aclocal
%doc %{_mandir}/man1/xml2-config.1*
%doc %{_mandir}/man3/*

%if 0%{?suse_version}
%files -n %{realname}-tools
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man1/xmllint.1*

%files -n %{python_pkg}
%doc python/README
%exclude %{python_sitearch}/*.la

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

openSUSE Build Service is sponsored by