File aria2.spec of Package aria2

#
# spec file for package aria2
#
# Copyright (c) 2016 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         somajor 0
Name:           aria2
Version:        1.24.0
Release:        0
Summary:        Parallelizing Multi-Protocol Utility for Downloading Files
License:        SUSE-GPL-2.0-with-openssl-exception
Group:          Productivity/Networking/Other
Url:            https://aria2.github.io
Source0:        https://github.com/aria2/aria2/releases/download/release-%{version}/aria2-%{version}.tar.xz
Source1:        %{name}.changes
BuildRequires:  bison
BuildRequires:  gcc-c++
BuildRequires:  gmp-devel
BuildRequires:  pkgconfig(cppunit)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(libcares)
BuildRequires:  pkgconfig(libssh2)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(nettle)
BuildRequires:  pkgconfig(pkg-config)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(zlib)
Recommends:     %{name}-lang
Recommends:     ca-certificates
%if 0%{?suse_version} > 1320
BuildRequires:  pkgconfig(libuv)
%endif

%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

%package -n lib%{name}-%{somajor}
Summary:        Shared library for %{name}
Group:          System/Libraries

%description -n lib%{name}-%{somajor}
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.

This package contains shared library

%package devel
Summary:        Devel files for %{name}
Group:          Development/Libraries/C and C++
Requires:       lib%{name}-%{somajor} = %{version}

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

This package contains devel files for its shared library

%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/ \
  --enable-libaria2 \
  %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
find %{buildroot} -type f -name "*.la" -delete -print
# Only installation instructions
rm -rf %{buildroot}%{_defaultdocdir}/%{name}/bash_completion

%find_lang aria2 --with-man

# Testsuite needs working network connection
# %%check
# make %{?_smp_mflags} check

%post -n lib%{name}-%{somajor} -p /sbin/ldconfig
%postun -n lib%{name}-%{somajor} -p /sbin/ldconfig

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

%files lang -f %{name}.lang
%defattr(-,root,root)

%files -n lib%{name}-%{somajor}
%defattr(-,root,root)
%doc COPYING
%{_libdir}/libaria2.so.%{somajor}*

%files devel
%defattr(-,root,root)
%doc COPYING
%{_includedir}/aria2/
%{_libdir}/libaria2.so
%{_libdir}/pkgconfig/libaria2.pc

%changelog