SUMMARY="Transmission is a cross-platform open source BitTorrent client"
DESCRIPTION="Transmission has the features you want from a BitTorrent client: \
encryption, a web interface, peer exchange, magnet links, DHT, µTP, UPnP and \
NAT-PMP port forwarding, webseed support, watch directories, tracker editing, \
global and per-torrent speed limits, and more."
HOMEPAGE="http://www.transmissionbt.com/"
COPYRIGHT="2005-2013 By the respective authors"
LICENSE="Transmission
	MIT
	GNU GPL v2"
REVISION="4"
SOURCE_URI="https://transmission.cachefly.net/transmission-$portVersion.tar.xz"
CHECKSUM_SHA256="a9fc1936b4ee414acc732ada04e84339d6755cd0d097bcbd11ba2cfc540db9eb"
PATCHES="transmission-$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"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"

PROVIDES="
	transmission$secondaryArchSuffix = $portVersion
	cmd:transmission_cli$secondaryArchSuffix
	cmd:transmission_create$secondaryArchSuffix
	cmd:transmission_daemon$secondaryArchSuffix
	cmd:transmission_edit$secondaryArchSuffix
	cmd:transmission_remote$secondaryArchSuffix
	cmd:transmission_show$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libevent$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libssl$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libevent$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libgettextlib$secondaryArchSuffix >= 0.14.1
	intltool >= 0.40
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:make
	cmd:awk
	"

BUILD()
{
	export CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS"
	export CXXFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS"
	export LDFLAGS="-lposix_error_mapper"
	runConfigure ./configure --without-gtk --datadir=$dataDir
	make
}

INSTALL()
{
	make install
}
