File aria2.spec of Package aria2

#
# spec file for package aria2
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#


# The checks seem to need network connection
%bcond_with make_check

Name:           aria2
Version:        1.15.1
Release:        0
Summary:        Parallelizing Multi-Protocol Utility for Downloading Files
License:        SUSE-GPL-2.0-with-openssl-exception
Group:          Productivity/Networking/Other
Url:            http://aria2.sourceforge.net/
Source0:        http://downloads.sourceforge.net/project/aria2/stable/aria2-%{version}/aria2-%{version}.tar.xz
# PATCH-FEATURE-UPSTREAM aria2-1.15.1-system_certificates.patch sf#3539535 reddwarf@opensuse.org -- add support for system certificates
Patch0:         aria2-1.15.1-system_certificates.patch
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(libcares)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(zlib)
%if %{with make_check}
BuildRequires:  pkgconfig(cppunit)
%endif
# nettle wasn't available until openSUSE 12.1
%if 0%{?suse_version} >= 1210
BuildRequires:  gmp-devel
BuildRequires:  pkgconfig(nettle)
%else
BuildRequires:  libgcrypt-devel
%endif
# In >= 12.2 try to avoid a rebuild when xz is modified
%if 0%{?suse_version} < 1220
BuildRequires:  xz
%endif
# Because of autoreconf
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
# aria2-bash-completion was splitted for last time in openSUSE 12.2
Provides:       aria2-bash-completion = %{version}
Obsoletes:      aria2-bash-completion < %{version}

%description
aria2 is a utility for downloading files. It has completely new design
concept from its predecessor, Aria, and is written from scratch. aria2 has
a segmented downloading engine in its core. It can download one file from
multiple URLs or multiple connections from one URL. This results in very
high speed downloading, much faster than ordinary browsers. This engine in
was implemented in a single-thread model. The architecture is clean and easy
to extend.

aria2 currently supports HTTP, FTP, and BitTorrent.

%prep
%setup -q
%patch0

%build
# Because of aria2-1.15.1-system_certificates.patch
autoreconf -fi
# gnutls < 3.0.20 doesn't provide gnutls_certificate_set_x509_system_trust()
# so we use with-ca-bundle in < 12.2
%configure --docdir=%{_defaultdocdir}/%{name}/ \
%if 0%{?suse_version} < 1220
           --with-ca-bundle=%{_sysconfdir}/ssl/ca-bundle.pem \
%endif
           --with-bashcompletiondir=%{_sysconfdir}/bash_completion.d/
make %{?_smp_mflags}

%install
%make_install
# I guess this is the correct thing to do until bnc#737549 is fixed
rm -rf %{buildroot}%{_mandir}/ru/
# Only installation instructions
rm -rf %{buildroot}%{_defaultdocdir}/%{name}/bash_completion
%find_lang aria2 --with-man

%if %{with make_check}
%check
make check
%endif

%files -f aria2.lang
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS
%{_bindir}/aria2c
%config %{_sysconfdir}/bash_completion.d/aria2c
%{_mandir}/man1/aria2c.1%{ext_man}

%changelog