SUMMARY="A download utility with segmented downloading and BitTorrent support"
DESCRIPTION="
aria2 is a utility for downloading files. The supported protocols are \
HTTP(S), FTP, BitTorrent, and Metalink. aria2 can download a file from \
multiple sources/protocols and tries to utilize your maximum download \
bandwidth. It 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.
"
HOMEPAGE="http://aria2.sourceforge.net"
LICENSE="GNU GPL v2"
COPYRIGHT="2006-2014 Tatsuhiro Tsujikawa"
SOURCE_URI="http://sourceforge.net/projects/aria2/files/stable/aria2-$portVersion/aria2-$portVersion.tar.xz"
CHECKSUM_SHA256="4a7be62cac075e4ad14c91dd4ab9f22afe6e21507255142c20de252e15a7b1e7"
REVISION="1"

PATCHES="aria2-$portVersion.patchset"

ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	aria2$secondaryArchSuffix = $portVersion compat >= 1
	cmd:aria2c
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	devel:libiconv$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:gettext
	cmd:find
	"

BUILD()
{
	autoreconf -fi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make tests
}
