# $Id: Portfile,v 1.5 2006/05/31 03:22:46 markd Exp $

PortSystem 1.0
name             tsocks
version          1.8beta5
revision         3
categories       net
maintainers      toby@opendarwin.org
description      Transparent SOCKS proxying library
long_description \
	tsocks allows non SOCKS aware applications (e.g \
	telnet, ssh, ftp etc) to use SOCKS without any \
	modification. It does this by intercepting the \
	calls that applications make to establish \
	network connections and negotating them through \
	a SOCKS server as necessary.
homepage         http://tsocks.sourceforge.net/
platforms        darwin
master_sites     sourceforge
checksums        md5 51caefd77e5d440d0bbd6443db4fc0f8
worksrcdir       ${name}-1.8
use_autoconf     yes
patchfiles       patch-configure.in \
		 patch-Makefile.in \
		 patch-tsocks.in \
		 patch-tsocks.c \
		 patch-parser.c

configure.args   --with-conf=${prefix}/etc/tsocks.conf \
		 --libdir=${prefix}/lib \
		 --mandir=${prefix}/share/man

platform darwin 8 {
	configure.env CC=/usr/bin/gcc-3.3 CPP=/usr/bin/cpp-3.3 \
	CXX=/usr/bin/g++-3.3
}

post-extract {
	reinplace "s|/etc/tsocks.conf|${prefix}/etc/tsocks.conf|g" \
		${worksrcpath}/tsocks.1 \
		${worksrcpath}/tsocks.8

	reinplace "s|TSOCKS_CONFFILE|TSOCKS_CONF_FILE|g" \
                ${worksrcpath}/tsocks.8
}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/etc
	xinstall -m 755 ${worksrcpath}/tsocks.conf.simple.example ${destroot}${prefix}/etc/tsocks.conf.sample
	
	xinstall -m 755 -d ${destroot}${prefix}/share/examples/tsocks
	eval xinstall -m 755 [glob ${worksrcpath}/*.example] ${destroot}${prefix}/share/examples/tsocks

	xinstall -m 755 -d ${destroot}${prefix}/share/doc/tsocks
	foreach doc { COPYING ChangeLog FAQ INSTALL TODO } {
		xinstall -m 755 ${worksrcpath}/${doc} ${destroot}${prefix}/share/doc/tsocks/${doc}
}
}

post-activate { ui_msg "\n
The tsocks.conf.sample file is in ${prefix}/etc.  Rename it to tsocks.conf to use it. \n"
}
