SUMMARY="BitTorrent Client using libtorrent"
DESCRIPTION="rTorrent is a text-based ncurses BitTorrent client written in C++, \
based on the libTorrent libraries for Unix, whose author's goal is 'a \
focus on high performance and good code'."
HOMEPAGE="http://libtorrent.rakshasa.no/"
COPYRIGHT="2005-2019 Jari Sundell"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/rakshasa/rtorrent/releases/download/v$portVersion/rtorrent-$portVersion.tar.gz"
CHECKSUM_SHA256="9edf0304bf142215d3bc85a0771446b6a72d0ad8218efbe184b41e4c9c7542af"
PATCHES="rtorrent-$portVersion.patchset"

ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	rtorrent$secondaryArchSuffix = $portVersion
	cmd:rtorrent$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcppunit$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libgettextpo$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	lib:libsigc_2.0$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libtorrent$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcppunit$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libgettextlib$secondaryArchSuffix
	devel:libncursesw${secondaryArchSuffix}
	devel:libsigc_2.0$secondaryArchSuffix
	devel:libtorrent$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoreconf
	cmd:g++$secondaryArchSuffix
	cmd:gettext$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	cmd:strip$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -vfi
	export CFLAGS=-D_BSD_SOURCE
	export LDFLAGS=-lnetwork
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	strip $binDir/*
}

TEST()
{
	make check
}
