SUMMARY="An efficient feature complete C++ bittorrent implementation"
DESCRIPTION="libtorrent is a feature complete C++ bittorrent implementation \
focusing on efficiency and scalability. It runs on embedded devices as well \
as desktops. It boasts a well documented library interface that is easy to \
use. It comes with a simple bittorrent client demonstrating the use of the \
library.

The main goals of libtorrent are:

 * to be cpu efficient
 * to be memory efficient
 * to be very easy to use"
HOMEPAGE="https://www.libtorrent.org/"
COPYRIGHT="2003-2019 Arvid Norberg
	Andrei Kurushin
	Steven Siloti
	Thomas Fischer
	Massaroddel
	Tianhao Qiu.
	Shyam
	Magnus Jonsson
	Daniel Wallin
	Cory Nelson
	Stas Khirman
	Ryan Norton
	Andrew Resch
	Michael Wojciechowski
	Peter Koeleman
	Reimond Retz"
LICENSE="BSD (2-clause)"
REVISION="6"
SOURCE_URI="https://github.com/arvidn/libtorrent/releases/download/libtorrent-${portVersion//./_}/libtorrent-rasterbar-$portVersion.tar.gz"
CHECKSUM_SHA256="1582fdbbd0449bcfe4ffae2ccb9e5bf0577459a32bb25604e01accb847da1a2d"
SOURCE_DIR="libtorrent-rasterbar-$portVersion"
PATCHES="libtorrent_rasterbar-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libVersion="10.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libtorrent_rasterbar$secondaryArchSuffix = $portVersion
	lib:libtorrent_rasterbar$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_chrono$secondaryArchSuffix
	lib:libboost_random$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"

PROVIDES_devel="
	libtorrent_rasterbar${secondaryArchSuffix}_devel = $portVersion
	devel:libtorrent_rasterbar$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libtorrent_rasterbar$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_chrono$secondaryArchSuffix >= 1.69.0
	devel:libboost_random$secondaryArchSuffix >= 1.69.0
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:libiconv$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libtorrent_rasterbar$secondaryArchSuffix \
	$libDir/libtorrent-rasterbar.so.$libVersion

BUILD()
{
	runConfigure ./configure \
		--disable-static \
		--with-libiconv \
		--with-boost-system=boost_system

	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libtorrent-rasterbar.la

	prepareInstalledDevelLib libtorrent-rasterbar
	fixPkgconfig

	packageEntries devel \
		$developDir
}
