File aria2.spec of Package aria2

#
# spec file for package aria2
#
# Copyright (c) 2015 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/
#


# The checks seem to need network connection
%bcond_with make_check

Name:           aria2
Version:        1.19.0
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://prdownloads.sourceforge.net/aria2/aria2-%{version}.tar.xz
Source1:        %{name}.changes
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
BuildRequires:  gmp-devel
BuildRequires:  pkgconfig(libssh2)
BuildRequires:  pkgconfig(nettle)
# aria2-bash-completion was split for last time in openSUSE 12.2
Provides:       aria2-bash-completion = %{version}
Obsoletes:      aria2-bash-completion < %{version}
%if 0%{?suse_version} >= 1130
Recommends:     ca-certificates
%endif
%if 0%{?suse_version} > 1320
BuildRequires:  pkgconfig(libuv)
%endif
Recommends:     %{name}-lang

%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.

%lang_package

%prep
%setup -q
# Do not use current date
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{SOURCE1}")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find .  -name '*.cc' |\
    xargs sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g"

%build
%configure --docdir=%{_defaultdocdir}/%{name}/ \
           --with-bashcompletiondir=%{_sysconfdir}/bash_completion.d/ \
           %if 0%{?suse_version} > 1320
           --with-libuv \
           %endif
           --disable-silent-rules
# We don't specify a ca-bundle because that makes aria2 call gnutls_certificate_set_x509_trust_file()
# insted of gnutls_certificate_set_x509_system_trust().
#           --with-ca-bundle=/etc/ssl/ca-bundle.pem

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,pt}/
# Only installation instructions
rm -rf %{buildroot}%{_defaultdocdir}/%{name}/bash_completion

%find_lang aria2 --with-man

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

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

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by