File aria2.spec of Package aria2

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

# norootforbuild

%if %{?_with_gnutls:1}0
 %define with_gnutls 1
 %undefine with_openssl
%else
 %define with_openssl 1
 %undefine with_gnutls
%endif
%if %{?_with_cares:1}0
 %define with_cares 1
%endif

Name:           aria2
Version:        0.16.0
Release:        1.<RELEASE20>
%define pkg_version %{version}
Summary:        Metalink client for the command line.
Source:         http://prdownloads.sourceforge.net/aria2/aria2c-%{pkg_version}.tar.bz2
Patch1:         aria2-cares-static.patch
Patch2:         aria2-cares-lib64.patch
Patch3:         aria2-no-uint64.patch
Patch4:         aria2-atoi.patch
Patch5:         aria2-0.16.0-CVE-2010-1512.patch
Url:            http://aria2.sourceforge.net/
Group:          Productivity/Networking/Other
License:        GPL v2 only
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version:1}
%if %{?with_gnutls:1}0
BuildRequires:  libgcrypt-devel
%if %suse_version > 1030
BuildRequires:  libgnutls-devel
%else
BuildRequires:  gnutls-devel
%endif #%suse_version > 1030
%endif #with_gnutls
%if %{?with_openssl:1}0
%if %suse_version >= 1030
BuildRequires:  libopenssl-devel
%else
BuildRequires:  openssl-devel
%endif #%suse_version >= 1030
%endif #with_openssl
%if %suse_version >= 1030
BuildRequires:  libexpat-devel
%else
BuildRequires:  expat
%endif #expat
%else
%if %{?with_gnutls:1}0
BuildRequires:  expat
%endif #with_gnutls
%if %{?with_openssl:1}0
BuildRequires:  openssl-devel
%endif #with_openssl
BuildRequires:  expat-devel
%endif #0%{?suse_version:1}
BuildRequires:  cppunit-devel gettext gettext-devel intltool
BuildRequires:  gcc-c++ glibc-devel libstdc++-devel make
%if %{?with_cares:1}0
BuildRequires:  libcares-devel
%endif #cares
BuildRequires:  autoconf automake libtool
Provides:       aria2c = %{version}-%{release}

%description
aria2 is a utility for downloading files. The supported protocols are
HTTP(S), FTP, BitTorrent  (DHT, PEX, MSE/PE), and Metalink. It can
download a file from multiple sources/protocols and tries to utilize
your maximum download bandwidth. It even supports downloading a file
from HTTP(S)/FTP and BitTorrent at the same time, while the data
downloaded from HTTP(S)/FTP is uploaded to the BitTorrent swarm. Using
Metalink's chunk checksums, aria2 automatically validates chunks of
data while downloading a file like BitTorrent.



Authors:
--------
    Tatsuhiro Tsujikawa (tujikawa users sourceforge net)

%prep
%setup -q -n "aria2c-%{pkg_version}"
%if %{?with_cares:1}0
%patch1
%if "%{_lib}"=="lib64"
%patch2
%endif
%endif #cares
%if 0%{?suse_version:1}
%if %suse_version < 1000
%patch3
%endif
%endif
%patch4
%patch5 -p1

%build
export CFLAGS="%{optflags} -fPIC"
export CXXFLAGS="${CFLAGS}"
%configure \
	--with%{?!with_gnutls:out}-gnutls \
	--with%{?!with_openssl:out}-openssl \
	--without-libares \
	--with%{?!with_cares:out}-libcares \
	--without-libxml2 \
	--enable-bittorrent
# a buglet in the configure script causes this directive to cause the opposite, so comment it out
# poeml, Mon Aug  4 16:30:55 CEST 2008
	#--enable-metalink
#echo '#define HAVE_LIBGEN_H 1' >> config.h
#%__rm src/libgen.h
%__make %{?jobs:-j%{jobs}}

%install
%makeinstall
%__rm -rf "%{buildroot}%{_datadir}/doc"
%if 0%{?suse_version:1}
%find_lang aria2c
%else
# for some reason, find_lang fails to find anything and
# breaks the build on Fedora 9
echo -n > aria2c.lang
%endif

%clean
%__rm -rf "%{buildroot}"

%files -f "aria2c.lang"
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README TODO
%doc README.html
%doc doc/aria2c.1.html
%{_bindir}/aria2c
%doc %{_mandir}/man1/aria2c.1*

%changelog
openSUSE Build Service is sponsored by