File aria2.spec of Package aria2

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

%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
* Mon Oct 13 2008 poeml@suse.de
- Pascal's changes reviewed by me as required by Factory policy.
* Mon Oct 06 2008 pascal.bleser@opensuse.org
- update to 0.16:
  + add Firefox3 Cookie support
  + add ability to select the fastest server(URI) using the
  download speed observed in the previous downloads
  + add ability to get a timestamp from a remote server and apply
  it to a local file
  + add an option to specify the connect timeout
  + now uses netrc for HTTP
* Sat Sep 06 2008 pascal.bleser@opensuse.org
- update to 0.15.3:
  + fixed chunk checksum validation cannot detect trailing garbage
  data; BUG#2074141
  + made files whose name ends with ".gz", ".tgz" not inflated by
  Content Encoding Decoder
  + fixed infinite loop bug in FTP when SIZE command failed
  + contact tracker frequently when the number of connections are
  0 and is not finished yet
  + added -lrt to LIBCARES_LIBS if -lrt is needed to link program
  with -lcares
  + if an error occurred with a URI, remove identical URI from
  remaining URI list
  + added Turkish translation
  + updated German and Russian translations
- dropped patch8 gzip_in_metalink.patch, merged upstream
* Tue Sep 02 2008 poeml@suse.de
- add patch r679(stable-0.15 branch)
  fixes segmentation fault when Metalink file contains gzipped
  file and its filesize is provided.
* Sat Aug 16 2008 pascal.bleser@opensuse.org
- update to 0.15.2:
  + fixed memory leak
  + removed max chunk size check:
  http://sourceforge.net/tracker/index.php?func=detail&aid=2040169&group_id=159897&atid=813673
  + fixed unmatched malloc/free
  + now aria2 uses name attribute in Metalink as local filename
  in BitTorrent downloads:
  http://sourceforge.net/tracker/index.php?func=detail&aid=2033999&group_id=159897&atid=813673
  + fixed occasional assertion failure in PieceSegment
  + fixed man page: --follow-bittorrent should be --follow-torrent
  + added Danish and Greek translations
  + updated Catalan, Norwegian Nynorsk and Spanish translations
* Fri Aug 15 2008 poeml@suse.de
- remove hardcoded %%debug_package
- expand tabs in spec file header
- indent some macros at the top which break the internal
  check_if_valid_source_dir tool
* Fri Aug 15 2008 poeml@suse.de
- initial submission to openSUSE Factory.
  Previous changelog:
  | * Mon Aug  4 2008 Peter Poeml <poeml@suse.de> 0.15.1+1
  | - new upstream version 0.15.1+1:
  |   * Fixed the bug that causes segmentaion fault when resuming download
  |     using metalink without size tag. Reproducible only using HTTP URI.
  | - a buglet in the configure script causes this directive to cause the
  |   opposite, so comment out the "--enable-metalink"
  | * Thu Jul 31 2008 Pascal Bleser <guru@unixtech.be> 0.15.1
  | - new upstream version:
  |   * fixes broken gzip inflation
  |   * lowers CPU usage
  |   * other minor fixes
  |   * Bulgarian and French translations were updated
  | * Wed Jul 23 2008 Pascal Bleser <guru@unixtech.be> 0.15.0
  | - new upstream version:
  |   * adds HTTP gzip content encoding support
  |   * adds the ability to save a signature in Metalink as a file
  |   * adds the option to skip hash checking in BitTorrent seeding
  |   * adds support for FTP servers that don't support the SIZE/REST command
  |   * a Bulgarian translation was added
  | * Sat Jun 21 2008 Pascal Bleser <guru@unixtech.be> 0.14.0
  | - new upstream version:
  |   * adds epoll support for Linux
  |   * adds the ability to limit the number of files to be opened to support more than 1024 files in a multi-file torrent
  |   * several bugs in BitTorrent downloads are fixed
  |   * from this release, aria2 downloads a file using 5 connections in HTTP/FTP by default, and the behavior of the -s option has changed
  | * Sun May 25 2008 Pascal Bleser <guru@unixtech.be> 0.13.2
  | - new upstream version:
  |   * adds the ability to specify any number of URIs, torrents, and metalinks in a command-line
  |   * adds option to set user-defined HTTP headers
  |   * adds support for transparent Metalink and connection reuse for HTTP/FTP downloads
  |   * adds output at given interval of a download progress summary
  |   * adds option to suppress any console output
  | * Tue May 20 2008 Pascal Bleser <guru@unixtech.be> 0.13.1+2
  | - new upstream version
  | * Mon Apr 28 2008 Pascal Bleser <guru@unixtech.be> 0.13.1
  | - bumped up in-tree libxml2 to 2.6.32
  | * Sat Mar 15 2008 Pascal Bleser <guru@unixtech.be> 0.13.1
  | - new upstream version
  | * Sat Mar  1 2008 Pascal Bleser <guru@unixtech.be> 0.13.0
  | - new upstream version
  | * Fri Feb 15 2008 Pascal Bleser <guru@unixtech.be> 0.12.1+1
  | - new upstream version
  | * Tue Feb 12 2008 Pascal Bleser <guru@unixtech.be> 0.12.1
  | - bumped intree libxml2 to latest 2.6.31
  | - new upstream version
  | * Sun Dec 30 2007 Pascal Bleser <guru@unixtech.be> 0.12.0
  | - fixed build on Factory
  | * Sun Dec  9 2007 Pascal Bleser <guru@unixtech.be> 0.12.0
  | - new upstream version
  | * Sat Nov 17 2007 Pascal Bleser <guru@unixtech.be> 0.11.5
  | - new upstream version
  | * Sun Oct 28 2007 Pascal Bleser <guru@unixtech.be> 0.11.4
  | - don't use intree libxml2 on openSUSE 10.3, as 10.3 ships a sufficiently recent libxml2-2.6.30
  | - new upstream version
  | * Mon Sep 10 2007 Pascal Bleser <guru@unixtech.be> 0.11.3
  | - new upstream version
  | * Sat Sep  8 2007 Pascal Bleser <guru@unixtech.be> 0.11.2
  | - moved to openSUSE Build Service
  | * Fri Aug 24 2007 Pascal Bleser <guru@unixtech.be> 0.11.2-2
  | - built against c-ares 1.4.0
  | - bumped in-tree libxml2 to 2.6.30
  | * Thu Aug  9 2007 Pascal Bleser <guru@unixtech.be> 0.11.2-1
  | - bumped in-tree libxml2 to 2.6.29
  | - new upstream version
  | * Tue Jun 12 2007 Pascal Bleser <guru@unixtech.be> 0.11.0-1
  | - new upstream version
  | * Fri Apr 27 2007 Pascal Bleser <guru@unixtech.be> 0.10.2.1-1
  | - new upstream version
  | * Wed Apr 18 2007 Pascal Bleser <guru@unixtech.be> 0.10.2-2
  | - update in-tree libxml2 version to 2.6.28
  | * Wed Mar 28 2007 Pascal Bleser <guru@unixtech.be> 0.10.2-1
  | - new upstream version
  | - CHANGES: adds netrc support
  | - CHANGES: adds user configuration file support
  | - CHANGES: adds the ability to change user-agent
  | - CHANGES: adds the ability to resume downloading a partially downloaded file by other programs that download files sequentially from the beginning
  | - CHANGES: numerous improvements and bugfixes have also been made
  | * Wed Feb  7 2007 Pascal Bleser <guru@unixtech.be> 0.10.1-1
  | - new upstream version
  | * Fri Feb  2 2007 Pascal Bleser <guru@unixtech.be> 0.10.0.1-1
  | - new upstream version
  | * Sun Jan 28 2007 Pascal Bleser <guru@unixtech.be> 0.10.0-1
  | - bundle libxml2 on SUSE < 10.0 to avoid forcing an upgrade that breaks stuff
  | - new upstream version
  | * Thu Dec  7 2006 Pascal Bleser <guru@unixtech.be> 0.9.0-2
  | - statically link libcares
  | * Wed Nov  8 2006 Pascal Bleser <guru@unixtech.be> 0.9.0-1
  | - new upstream version
  | * Sun Oct  1 2006 Pascal Bleser <guru@unixtech.be> 0.8.1-1
  | - new upstream version
  | * Sun Sep 24 2006 Pascal Bleser <guru@unixtech.be> 0.8.0-1
  | - new upstream version
  | * Tue Aug 29 2006 Pascal Bleser <guru@unixtech.be> 0.7.3-1
  | - added missing buildrequires for libgcrypt-devel
  | - new upstream version
  | * Mon Aug 21 2006 Pascal Bleser <guru@unixtech.be> 0.7.2-1
  | - new upstream version
  | * Mon Aug 14 2006 Pascal Bleser <guru@unixtech.be> 0.7.1-1
  | - add buildrequiers for c-ares[-devel] to support async DNS
  | - new upstream version
  | * Tue Aug  8 2006 Pascal Bleser <guru@unixtech.be> 0.7.0-1
  | - new upstream version
  | * Fri Jul 21 2006 Pascal Bleser <guru@unixtech.be> 0.6.0-1
  | - new upstream version
  | * Sun Jun 25 2006 Pascal Bleser <guru@unixtech.be> 0.5.2-1
  | - new upstream version
  | * Sun Jun 18 2006 Pascal Bleser <guru@unixtech.be> 0.5.1-1
  | - dropped patch, has been sent and merged upstream
  | - new upstream version
  | * Fri May 26 2006 Pascal Bleser <guru@unixtech.be> 0.5.0-1
  | - new upstream version
  | * Sun Apr 30 2006 Pascal Bleser <guru@unixtech.be> 0.4.1-1
  | - moved autoreconf and configure to build section
  | - new upstream version
  | * Fri Apr 21 2006 Pascal Bleser <guru@unixtech.be> 0.4.0-1
  | - added binary stripping for SUSE < 9.3
  | - new upstream version
  | - removed Distribution and Packager, injected by rpmmacros
  | * Sat Apr  1 2006 Pascal Bleser <guru@unixtech.be> 0.3.2-1
  | - added gnutls support, used by default, rebuild with --with openssl to use openssl instead
  | - new upstream version
  | * Fri Mar 24 2006 Pascal Bleser <guru@unixtech.be> 0.3.1-1
  | - new package
openSUSE Build Service is sponsored by