File aria2.spec of Package aria2

#
# spec file for package aria2 (Version 1.9.3)
#
# 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 0%{?_with_gnutls:1}
 %define with_gnutls 1
 %undefine with_openssl
%else
 %define with_openssl 1
 %undefine with_gnutls
%endif

%if 0%{?opensuse_bs}
%define with_dht 0
%else
%define with_dht 1
%endif
%if 0%{?suse_version} > 0 && 0%{?suse_version} >= 1020
%define with_sqlite 1
%else
%define with_sqlite 0
%endif

Name:           aria2
Version:        1.9.3
Release:        0.<RELEASE1>
Summary:        Parallelizing Multi-Protocol Utility for Downloading Files
Source:         http://prdownloads.sourceforge.net/aria2/aria2-%{version}.tar.bz2
Patch1:         aria2-cares-static.patch
Patch2:         aria2-cares-lib64.patch
Patch4:         aria2-atoi.patch
Url:            http://sourceforge.net/projects/aria2
Group:          Productivity/Networking/Other
License:        GNU General Public License (GPL)
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}
%if 0%{?!suse_version:1} || 0%{?suse_version} >= 1020
BuildRequires:  cppunit-devel
%endif
BuildRequires:  gettext gettext-devel intltool
BuildRequires:  gcc-c++ glibc-devel libstdc++-devel make
%if 0%{?suse_version} >= 1130
BuildRequires:  libcares-devel
%endif #cares
%if 0%{?with_sqlite}
%if 0%{?suse_version} < 1100
BuildRequires:  sqlite-devel
%else
BuildRequires:  sqlite3-devel
%endif #suse_version
%endif #with_sqlite
BuildRequires:  autoconf automake libtool
Provides:       aria2c = %{version}-%{release}

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




Authors:
--------
    Tatsuhiro Tsujikawa <tujikawa@users.sourceforge.net>

%prep
%setup -q -n "aria2-%{version}"
%if 0%{?with_cares}
%patch1
%if "%{_lib}"=="lib64"
%patch2
%endif #%_lib==lib64
%endif #cares
%patch4

%build
export CFLAGS="%{optflags} -DPIC -fPIC"
export CXXFLAGS="${CFLAGS}"
%configure \
	--with%{?!with_gnutls:out}-gnutls \
	--with%{?!with_openssl:out}-openssl \
	--with%{?!with_cares:out}-libcares \
	--without-libxml2 \
%if 0%{?with_sqlite}
    --with-sqlite3 \
%else
    --without-sqlite3 \
%endif
    --enable-epoll \
	--enable-bittorrent \
    --with-openssl-prefix="%{_usr}" \
    --with-libgnutls-prefix="%{_usr}" \
    --with-libgcrypt-prefix="%{_usr}" \
    --with-libz-prefix="%{_usr}" \
    --with-xml-prefix="%{_usr}" \
    --with-sqlite3-prefix="%{_usr}"
# 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"
for l in "en@boldquot" "en@quot"; do
    %__rm -rf "%{buildroot}%{_datadir}/locale/${l}"
done
%if 0%{?suse_version}
%find_lang aria2
%else
# for some reason, find_lang fails to find anything and
# breaks the build on Fedora 9
echo -n > aria2.lang
%endif

#check
#__make check

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

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

%changelog
openSUSE Build Service is sponsored by