SUMMARY="A transparent socks proxy for use with tor"
DESCRIPTION="Torsocks allows you to use most socks-friendly applications \
in a safe way with Tor. It ensures that DNS requests are handled safely \
and explicitly rejects UDP traffic from the application you're using."
HOMEPAGE="https://www.torproject.org"
COPYRIGHT="2000-2008 Shaun Clowes
	2008-2011 Robert Hogan
	2005 Total Information Security Ltd.
	2010 Alex Rosenberg
	2004, 2006 Peter Palfrader
	2000 Alessandro Iurlano
	2004 Tomasz Kojm"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/dgoulet/torsocks/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="09debf9e35d70802fdb0e56335bacab65e84fad615f68d7006539713c1698123"
PATCHES="torsocks-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="settings/torsocks.conf manual"

PROVIDES="
	torsocks$secondaryArchSuffix = $portVersion
	cmd:torsocks$secondaryArchSuffix
	cmd:usewithtor$secondaryArchSuffix
	lib:libtorsocks$secondaryArchSuffix = 1.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	torsocks${secondaryArchSuffix}_devel = $portVersion compat >= 1.0
	devel:libtorsocks$secondaryArchSuffix = 1.0.0 compat >= 0
	"
REQUIRES_devel="
	torsocks$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure --datadir=$dataDir/torsocks/
	make
}

INSTALL()
{
	make install

	rm $libDir/*.la
	prepareInstalledDevelLib libtorsocks

	packageEntries devel \
			$developDir

	#link the .so lib so torsocks can find it in $libDir
	ln -s -r $libDir/libtorsocks.so.1.0.0 $libDir/libtorsocks.so
}
