#
# spec file for package libmetalink
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define soname 3
Name:           libmetalink
Version:        0.1.3
Release:        3.6
Summary:        Metalink Library
License:        MIT
Group:          System/Libraries
Url:            https://launchpad.net/libmetalink
Source:         https://launchpad.net/libmetalink/trunk/libmetalink-%{version}/+download/%{name}-%{version}.tar.xz
Patch0:         libmetalink-autotools.patch
BuildRequires:  libtool
BuildRequires:  pkgconfig
%if 0%{?suse_version} > 1310
BuildRequires:  pkgconfig(cunit)
%endif
%if 0%{?suse_version} >= 1310
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(libxml-2.0)
%else
BuildRequires:  libexpat-devel
BuildRequires:  libxml2-devel
%endif
BuildRequires:  xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Libmetalink is a Metalink library written in C language. It is intended to
provide the programs written in C to add Metalink functionality such as parsing
Metalink XML files.

%package -n libmetalink%{soname}
Summary:        Metalink Library
Group:          System/Libraries

%description -n libmetalink%{soname}
Libmetalink is a Metalink library written in C language. It is intended to
provide the programs written in C to add Metalink functionality such as parsing
Metalink XML files.

%package -n libmetalink-devel
Summary:        Metalink Library
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libmetalink%{soname} = %{version}

%description -n libmetalink-devel
Libmetalink is a Metalink library written in C language. It is intended to
provide the programs written in C to add Metalink functionality such as parsing
Metalink XML files.

%prep
%setup -q
%patch0

%build
autoreconf -fiv
%configure \
	 --disable-static \
    --with-libexpat

make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
rm -rf "%{buildroot}%{_datadir}/doc"
find %{buildroot} -type f -name "*.la" -delete -print

%post   -n libmetalink%{soname} -p /sbin/ldconfig

%postun -n libmetalink%{soname} -p /sbin/ldconfig

%check
make %{?_smp_mflags} test

%files -n libmetalink%{soname}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS ChangeLog README
%{_libdir}/libmetalink.so.%{soname}
%{_libdir}/libmetalink.so.%{soname}.*

%files -n libmetalink-devel
%defattr(-,root,root)
%{_includedir}/metalink
%{_libdir}/libmetalink.so
%{_libdir}/pkgconfig/libmetalink.pc
%{_mandir}/man3/metalink*.3*

%changelog
* Thu May 24 2018 kukuk@suse.de
- Use %%license instead of %%doc [bsc#1082318]
* Wed Mar 21 2018 crrodriguez@opensuse.org
- libmetalink-autotools.patch: update, export only
  metalink_ symbols using -export-symbols-regex, there
  is an upstream configure option --enable-gcc-visibility
  but it is currently incomplete and cannot be used as is
* Tue Dec  1 2015 p.drouand@gmail.com
- Update to version 0.1.3
  * This release fixes the bug that signature element in metalink v4
    was not parsed correctly.
- Update libmetalink-autotools.patch
- Use download Url as source
- Perform a spec-cleaner
- Build with libxml2 and cunit support
* Tue Nov 20 2012 crrodriguez@opensuse.org
- Fornat spec file for factory
* Tue Nov 20 2012 crrodriguez@opensuse.org
- Update to version 0.1.2
  * This release adds RFC 5854 Metalink 4.0 support
  * adds dynamic attribute of the origin element in Metalink
- libmetalink-autotools.patch : multiple pet peeves in autotools.
* Sat Sep 24 2011 andreas.stieger@gmx.de
- remove dependency on licenses, no longer in Factory
* Sun Nov  8 2009 pascal.bleser@opensuse.org
- add support for libxml2 and expat, which makes the build include
  all API functions, unlike the previous, crippled builds
* Mon Nov  2 2009 pascal.bleser@opensuse.org
- initial package: 0.0.3