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"
SOURCE_URI="http://torsocks.googlecode.com/files/torsocks-1.2.tar.gz"
CHECKSUM_SHA256="bea57d3624d723724fd1e260f0e6b2a354c0da742c023aa994c7692270d111d4"

REVISION="1"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	torsocks = $portVersion
	cmd:torsocks$secondaryArchSuffix
	cmd:usewithtor$secondaryArchSuffix
	lib:libtorsocks$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:make
	"
	
LICENSE="GNU GPL v2"
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
	"

PATCHES="torsocks-1.2.patch"

GLOBAL_WRITABLE_FILES="
	settings/torsocks.conf manual
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoconf
	automake
	
	runConfigure ./configure
	make
}

INSTALL()
{
	make install
	
	# Documentation is put into $dataDir/torsocks
	# as opposed to $dataDir
	
	mkdir /temp
	mv $dataDir/* /temp
	mkdir $dataDir/torsocks
	mv /temp/* $dataDir/torsocks
	rm -r /temp
}
