tsocks: add to portage-stable

We need this for net-misc/tor.

BUG=chromium-os:17514
TEST=Adhoc
emerge-$board tsocks

Change-Id: I8e561709ab52996d6e0912c97a939416c07bbf50
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/5158
Reviewed-by: Anush Elangovan <anush@chromium.org>
diff --git a/net-proxy/tsocks/ChangeLog b/net-proxy/tsocks/ChangeLog
new file mode 100644
index 0000000..fe943c1
--- /dev/null
+++ b/net-proxy/tsocks/ChangeLog
@@ -0,0 +1,178 @@
+# ChangeLog for net-proxy/tsocks
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/tsocks/ChangeLog,v 1.34 2009/07/19 18:46:15 nixnut Exp $
+
+  19 Jul 2009; nixnut <nixnut@gentoo.org> tsocks-1.8_beta5-r5.ebuild:
+  ppc stable #274790
+
+  06 Jul 2009; Raúl Porcel <armin76@gentoo.org> tsocks-1.8_beta5-r5.ebuild:
+  sparc stable wrt #274790
+
+  04 Jul 2009; Brent Baude <ranger@gentoo.org> tsocks-1.8_beta5-r5.ebuild:
+  stable ppc64, bug 274790
+
+  28 Jun 2009; Tobias Klausmann <klausman@gentoo.org>
+  tsocks-1.8_beta5-r5.ebuild:
+  Stable on alpha, bug #274790
+
+  28 Jun 2009; Markus Meier <maekke@gentoo.org> tsocks-1.8_beta5-r5.ebuild:
+  amd64/x86 stable, bug #274790
+
+*tsocks-1.8_beta5-r5 (20 Jun 2009)
+
+  20 Jun 2009; Alin Năstac <mrness@gentoo.org>
+  +files/tsocks-1.8_beta5-gentoo-r3.patch, +tsocks-1.8_beta5-r5.ebuild:
+  Link tsocks-saveme dinamically (#273339). Migrate to EAPI 2.
+
+*tsocks-1.8_beta5-r4 (18 Feb 2009)
+
+  18 Feb 2009; Alin Năstac <mrness@gentoo.org>
+  -files/tsocks-1.8_beta5-gentoo.patch,
+  +files/tsocks-1.8_beta5-gentoo-r2.patch, -tsocks-1.8_beta5-r2.ebuild,
+  +tsocks-1.8_beta5-r4.ebuild:
+  Fix LD_PRELOAD setup, thanks to Yuval Hager <yuval at avramzon dot net>
+  (#255960).
+
+  22 Aug 2008; Markus Meier <maekke@gentoo.org> metadata.xml,
+  tsocks-1.8_beta5-r3.ebuild:
+  amd64 stable, bug #231690; add GLEP 56 USE flag desc from use.local.desc
+
+  21 Jul 2008; nixnut <nixnut@gentoo.org> tsocks-1.8_beta5-r3.ebuild:
+  Stable on ppc wrt bug 231690
+
+  17 Jul 2008; Markus Rothe <corsair@gentoo.org> tsocks-1.8_beta5-r3.ebuild:
+  Stable on ppc64; bug #231690
+
+  17 Jul 2008; Raúl Porcel <armin76@gentoo.org> tsocks-1.8_beta5-r3.ebuild:
+  alpha/x86 stable wrt #231690
+
+  16 Jul 2008; Friedrich Oslage <bluebird@gentoo.org>
+  tsocks-1.8_beta5-r3.ebuild:
+  Stable on sparc, bug #231690
+
+*tsocks-1.8_beta5-r3 (13 Feb 2008)
+
+  13 Feb 2008; Alin Năstac <mrness@gentoo.org>
+  +files/tsocks-1.8_beta5-gentoo-r1.patch, +tsocks-1.8_beta5-r3.ebuild:
+  Link programs using user selected LDFLAGS (#209703). Fix library path in
+  tsocks script.
+
+  17 Jun 2007; Alin Năstac <mrness@gentoo.org> -tsocks-1.8_beta5.ebuild,
+  -tsocks-1.8_beta5-r1.ebuild:
+  Remove old revisions.
+
+  22 Apr 2007; Bryan Østergaard <kloeri@gentoo.org>
+  tsocks-1.8_beta5-r2.ebuild:
+  Stable on Alpha, bug 174160.
+
+  11 Apr 2007; Alin Năstac <mrness@gentoo.org> tsocks-1.8_beta5-r2.ebuild:
+  Stable on amd64.
+
+  01 Apr 2007; Michael Hanselmann <hansmi@gentoo.org>
+  tsocks-1.8_beta5-r2.ebuild:
+  Stable on ppc.
+
+  03 Dec 2006; Markus Rothe <corsair@gentoo.org> tsocks-1.8_beta5-r2.ebuild:
+  Stable on ppc64
+
+  07 Nov 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  tsocks-1.8_beta5-r2.ebuild:
+  Stable on sparc
+
+  01 Nov 2006; Alin Nastac <mrness@gentoo.org> tsocks-1.8_beta5-r2.ebuild:
+  Add SONAME to libtsocks. Stable on x86.
+
+  20 Oct 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  tsocks-1.8_beta5-r1.ebuild:
+  Stable on sparc
+
+  29 Sep 2006; Markus Rothe <corsair@gentoo.org> tsocks-1.8_beta5-r1.ebuild:
+  Stable on ppc64
+
+  24 Sep 2006; Michael Hanselmann <hansmi@gentoo.org>
+  tsocks-1.8_beta5-r1.ebuild:
+  Stable on ppc.
+
+*tsocks-1.8_beta5-r2 (22 Sep 2006)
+
+  22 Sep 2006; Alin Nastac <mrness@gentoo.org>
+  +files/tsocks-1.8_beta5-gentoo.patch, +tsocks-1.8_beta5-r2.ebuild:
+  Rename saveme and validateconf executables. Add tordns patch & local USE
+  flag (#148550).
+
+  20 Sep 2006; Alin Nastac <mrness@gentoo.org> tsocks-1.8_beta5-r1.ebuild:
+  Stable on x86.
+
+*tsocks-1.8_beta5-r1 (16 Jul 2006)
+
+  16 Jul 2006; Diego Pettenò <flameeyes@gentoo.org>
+  +files/tsocks-1.8_beta5-bsd.patch, +tsocks-1.8_beta5-r1.ebuild:
+  Add tsocks with a little cleanup and patch for BSD compatibility (bug #140612).
+
+  04 Oct 2005; Alin Nastac <mrness@gentoo.org> -tsocks-1.8_beta4.ebuild,
+  tsocks-1.8_beta5.ebuild:
+  Remove obsolete version. Remove INSTALL from docs.
+
+  13 Aug 2005; Michael Hanselmann <hansmi@gentoo.org>
+  tsocks-1.8_beta5.ebuild:
+  Stable on ppc.
+
+  02 Aug 2005; Gustavo Zacarias <gustavoz@gentoo.org>
+  tsocks-1.8_beta5.ebuild:
+  Stable on sparc
+
+  30 Jul 2005; Alin Nastac <mrness@gentoo.org> tsocks-1.8_beta5.ebuild:
+  Stable on x86.
+
+  20 Jul 2005; Herbie Hopkins <herbs@gentoo.org> tsocks-1.8_beta5.ebuild:
+  Stable on amd64.
+
+  18 May 2005; Markus Rothe <corsair@gentoo.org> tsocks-1.8_beta5.ebuild:
+  Stable on ppc64
+
+  22 Apr 2005; Alin Nastac <mrness@gentoo.org> +metadata.xml:
+  Move net-misc/tsocks to net-proxy/tsocks. Add metadata.
+
+  29 Mar 2005; Markus Rothe <corsair@gentoo.org> tsocks-1.8_beta5.ebuild:
+  Added ~ppc64 to KEYWORDS; bug #86993
+
+  22 Feb 2005; Jeremy Huddleston <eradicator@gentoo.org>
+  tsocks-1.8_beta5.ebuild:
+  Multilib cleanup.
+
+  29 Dec 2004; Ciaran McCreesh <ciaranm@gentoo.org> :
+  Change encoding to UTF-8 for GLEP 31 compliance
+
+  08 Jun 2004; Bryan Østergaard <kloeri@gentoo.org> tsocks-1.8_beta5.ebuild:
+  Stable on alpha.
+
+*tsocks-1.8_beta5 (22 Feb 2004)
+
+  22 Feb 2004; Mike Frysinger <vapier@gentoo.org> :
+  Version bump #42394 by Scott Jones.
+
+  07 Dec 2003; David Holm <dholm@gentoo.org> tsocks-1.8_beta4.ebuild:
+  Added to ~ppc.
+
+  21 Aug 2003; Will Woods <wwoods@gentoo.org> tsocks-1.8_beta4.ebuild:
+  Added ~alpha to KEYWORDS
+
+  12 Jun 2003; <msterret@gentoo.org> tsocks-1.8_beta4.ebuild:
+  add Header
+
+  06 Dec 2002; Rodney Rees <manson@gentoo.org> : changed sparc ~sparc keywords
+
+*tsocks-1.8_beta4 (10 Jun 2002)
+
+  11 Jul 2002; lamer <lamer@gentoo.org> tsocks-1.8beta4.ebuild : 
+  Added "dobin validateconf saveme inspectsocks" to src_install
+
+  09 Jul 2002; phoen][x <phoenix@gentoo.org> tsocks-1.8beta4.ebuild :
+  Added KEYWORDS, SLOT.
+
+  10 Jun 2002; Ben Lutgens <lamer@gentoo.org> tsocks-1.8_beta4: Ebuild for
+  tsocks submitted to bugs.gentoo.org by a gentoo user *THANKS*
+  bardur-gta@odense.kollegienet.dk. It should be noted that as per the
+  install docs, this stuff gets installed to /lib. Mainly due to the fact
+  that it's often needed before /usr gets mounted. So the old
+  /etc/ld.so.preload trick won't work!
diff --git a/net-proxy/tsocks/files/tsocks-1.8_beta5-bsd.patch b/net-proxy/tsocks/files/tsocks-1.8_beta5-bsd.patch
new file mode 100644
index 0000000..e003475
--- /dev/null
+++ b/net-proxy/tsocks/files/tsocks-1.8_beta5-bsd.patch
@@ -0,0 +1,22 @@
+Index: tsocks-1.8/configure.in
+===================================================================
+--- tsocks-1.8.orig/configure.in
++++ tsocks-1.8/configure.in
+@@ -122,7 +122,7 @@ LIBS=
+ 
+ dnl Checks for libraries.
+ dnl Replace `main' with a function in -ldl:
+-AC_CHECK_LIB(dl, dlsym,,AC_MSG_ERROR("libdl is required"))
++AC_CHECK_FUNC([dlsym], [], [AC_CHECK_LIB(dl, dlsym,,AC_MSG_ERROR("libdl is required"))])
+ 
+ dnl If we're using gcc here define _GNU_SOURCE
+ AC_MSG_CHECKING("for RTLD_NEXT from dlfcn.h")
+@@ -312,7 +312,7 @@ AC_DEFINE_UNQUOTED(CLOSE_SIGNATURE, [${P
+ dnl Find the correct poll prototype on this machine 
+ AC_MSG_CHECKING(for correct poll prototype)
+ PROTO=
+-for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout' 
++for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout' 'struct pollfd ufds[[]], nfds_t nfds, int timeout'
+ do
+   if test "${PROTO}" = ""; then
+     AC_TRY_COMPILE([
diff --git a/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r1.patch b/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r1.patch
new file mode 100644
index 0000000..21065ad
--- /dev/null
+++ b/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r1.patch
@@ -0,0 +1,128 @@
+diff -Nru tsocks-1.8.orig/Makefile.in tsocks-1.8/Makefile.in
+--- tsocks-1.8.orig/Makefile.in	2002-03-16 12:12:40.000000000 +0200
++++ tsocks-1.8/Makefile.in	2008-02-13 18:06:05.000000000 +0200
+@@ -28,6 +28,7 @@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ CFLAGS = @CFLAGS@
++LDFLAGS = @LDFLAGS@
+ INCLUDES = -I.
+ LIBS = @LIBS@
+ SPECIALLIBS = @SPECIALLIBS@
+@@ -41,16 +42,16 @@
+ all: ${TARGETS}
+ 
+ ${VALIDATECONF}: ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -o ${VALIDATECONF} ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o ${LIBS}
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${VALIDATECONF} ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o ${LIBS}
+ 
+ ${INSPECT}: ${INSPECT}.c ${COMMON}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
+ 
+ ${SAVE}: ${SAVE}.c
+-	${SHCC} ${CFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
++	${SHCC} ${LDFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
+ 
+ ${SHLIB}: ${OBJS} ${COMMON}.o ${PARSER}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
++	${SHCC} ${LDFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
+ 	ln -sf ${SHLIB} ${LIB_NAME}.so
+ 
+ %.so: %.c
+diff -Nru tsocks-1.8.orig/tsocks tsocks-1.8/tsocks
+--- tsocks-1.8.orig/tsocks	2002-03-16 12:27:18.000000000 +0200
++++ tsocks-1.8/tsocks	2008-02-13 18:05:11.000000000 +0200
+@@ -46,10 +46,10 @@
+ 	on)
+ 		if [ -z "$LD_PRELOAD" ]
+ 			then
+-				export LD_PRELOAD="/usr/lib/libtsocks.so"
++				export LD_PRELOAD="/lib/libtsocks.so"
+ 			else
+-				echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \
+-				export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"
++				echo $LD_PRELOAD | grep -q "/lib/libtsocks\.so" || \
++				export LD_PRELOAD="/lib/libtsocks.so $LD_PRELOAD"
+ 		fi
+ 	;;
+ 	off)
+@@ -68,10 +68,10 @@
+ 	*)
+ 		if [ -z "$LD_PRELOAD" ]
+ 		then
+-			export LD_PRELOAD="/usr/lib/libtsocks.so"
++			export LD_PRELOAD="/lib/libtsocks.so"
+ 		else
+-			echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \
+-			export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"
++			echo $LD_PRELOAD | grep -q "/lib/libtsocks\.so" || \
++			export LD_PRELOAD="/lib/libtsocks.so $LD_PRELOAD"
+ 		fi
+ 
+ 		if [ $# = 0 ]
+diff -Nru tsocks-1.8.orig/tsocks.8 tsocks-1.8/tsocks.8
+--- tsocks-1.8.orig/tsocks.8	2002-03-16 12:20:51.000000000 +0200
++++ tsocks-1.8/tsocks.8	2008-02-13 18:06:05.000000000 +0200
+@@ -127,8 +127,8 @@
+ libtsocks in /etc/ld.so.preload. Please make sure you correctly enter the
+ full path to the library in this file if you do this. If you get it wrong,
+ you will be UNABLE TO DO ANYTHING with the machine and will have to boot
+-it with a rescue disk and remove the file (or try the saveme program, see
+-the INSTALL file for more info).  THIS IS A ***WARNING***, please be
++it with a rescue disk and remove the file (or try the tsocks-saveme program,
++simply unlinks /etc/ld.so.preload ). THIS IS A ***WARNING***, please be
+ careful. Also be sure the library is in the root filesystem as all hell
+ will break loose if the directory it is in is not available at boot time.
+ 
+diff -Nru tsocks-1.8.orig/tsocks.conf.5 tsocks-1.8/tsocks.conf.5
+--- tsocks-1.8.orig/tsocks.conf.5	2002-05-18 05:13:08.000000000 +0300
++++ tsocks-1.8/tsocks.conf.5	2008-02-13 18:06:05.000000000 +0200
+@@ -139,21 +139,20 @@
+ the version that server supports. 
+ 
+ .TP
+-validateconf
+-validateconf can be used to verify the configuration file. It checks the format
+-of the file and also the contents for errors. Having read the file it dumps 
+-the configuration to the screen in a formatted, readable manner. This can be 
+-extremely useful in debugging problems.
+-
+-validateconf can read a configuration file from a location other than the 
+-location specified at compile time with the -f <filename> command line 
+-option.
+-
+-Normally validateconf simply dumps the configuration read to the screen (in
+-a nicely readable format), however it also has a useful 'test' mode. When
+-passed a hostname/ip on the command line like -t <hostname/ip>, validateconf 
+-determines which of the SOCKS servers specified in the configuration file 
+-would be used by tsocks to access the specified host. 
++tsocks-validateconf
++tsocks-validateconf can be used to verify the configuration file. It checks
++the format of the file and also the contents for errors. Having read the file 
++it dumps the configuration to the screen in a formatted, readable manner.
++This can be extremely useful in debugging problems.
++
++tsocks-validateconf can read a configuration file from a location other than the 
++location specified at compile time with the -f <filename> command line option.
++
++Normally tsocks-validateconf simply dumps the configuration read to the screen 
++(in a nicely readable format), however it also has a useful 'test' mode. When
++passed a hostname/ip on the command line like -t <hostname/ip>, 
++tsocks-validateconf determines which of the SOCKS servers specified in the 
++configuration file would be used by tsocks to access the specified host. 
+ 
+ .SH SEE ALSO
+ tsocks(8)
+diff -Nru tsocks-1.8.orig/validateconf.c tsocks-1.8/validateconf.c
+--- tsocks-1.8.orig/validateconf.c	2002-02-07 12:49:59.000000000 +0200
++++ tsocks-1.8/validateconf.c	2008-02-13 18:06:05.000000000 +0200
+@@ -23,7 +23,7 @@
+ */
+ 
+ /* Global configuration variables */ 
+-char *progname = "validateconf";	      /* Name for error msgs      */
++char *progname = "tsocks-validateconf";	      /* Name for error msgs      */
+ 
+ /* Header Files */
+ #include <config.h>
diff --git a/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r2.patch b/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r2.patch
new file mode 100644
index 0000000..adb1206
--- /dev/null
+++ b/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r2.patch
@@ -0,0 +1,133 @@
+diff -Naur tsocks-1.8.orig/Makefile.in tsocks-1.8/Makefile.in
+--- tsocks-1.8.orig/Makefile.in	2002-03-16 12:12:40.000000000 +0200
++++ tsocks-1.8/Makefile.in	2009-01-22 10:30:17.000000000 +0200
+@@ -28,6 +28,7 @@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ CFLAGS = @CFLAGS@
++LDFLAGS = @LDFLAGS@
+ INCLUDES = -I.
+ LIBS = @LIBS@
+ SPECIALLIBS = @SPECIALLIBS@
+@@ -41,16 +42,16 @@
+ all: ${TARGETS}
+ 
+ ${VALIDATECONF}: ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -o ${VALIDATECONF} ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o ${LIBS}
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${VALIDATECONF} ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o ${LIBS}
+ 
+ ${INSPECT}: ${INSPECT}.c ${COMMON}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
+ 
+ ${SAVE}: ${SAVE}.c
+-	${SHCC} ${CFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
++	${SHCC} ${LDFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
+ 
+ ${SHLIB}: ${OBJS} ${COMMON}.o ${PARSER}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
++	${SHCC} ${LDFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
+ 	ln -sf ${SHLIB} ${LIB_NAME}.so
+ 
+ %.so: %.c
+diff -Naur tsocks-1.8.orig/tsocks tsocks-1.8/tsocks
+--- tsocks-1.8.orig/tsocks	2002-03-16 12:27:18.000000000 +0200
++++ tsocks-1.8/tsocks	2009-01-22 10:30:34.000000000 +0200
+@@ -46,14 +46,14 @@
+ 	on)
+ 		if [ -z "$LD_PRELOAD" ]
+ 			then
+-				export LD_PRELOAD="/usr/lib/libtsocks.so"
++				export LD_PRELOAD="/lib/libtsocks.so"
+ 			else
+-				echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \
+-				export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"
++				echo $LD_PRELOAD | grep -q "/lib/libtsocks\.so" || \
++				export LD_PRELOAD="/lib/libtsocks.so $LD_PRELOAD"
+ 		fi
+ 	;;
+ 	off)
+-		export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/usr\/lib\/libtsocks.so \?//'`
++		export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/lib\/libtsocks.so \?//'`
+ 		if [ -z "$LD_PRELOAD" ]
+ 			then
+ 				unset LD_PRELOAD
+@@ -68,10 +68,10 @@
+ 	*)
+ 		if [ -z "$LD_PRELOAD" ]
+ 		then
+-			export LD_PRELOAD="/usr/lib/libtsocks.so"
++			export LD_PRELOAD="/lib/libtsocks.so"
+ 		else
+-			echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \
+-			export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"
++			echo $LD_PRELOAD | grep -q "/lib/libtsocks\.so" || \
++			export LD_PRELOAD="/lib/libtsocks.so $LD_PRELOAD"
+ 		fi
+ 
+ 		if [ $# = 0 ]
+diff -Naur tsocks-1.8.orig/tsocks.8 tsocks-1.8/tsocks.8
+--- tsocks-1.8.orig/tsocks.8	2002-03-16 12:20:51.000000000 +0200
++++ tsocks-1.8/tsocks.8	2009-01-22 10:30:17.000000000 +0200
+@@ -127,8 +127,8 @@
+ libtsocks in /etc/ld.so.preload. Please make sure you correctly enter the
+ full path to the library in this file if you do this. If you get it wrong,
+ you will be UNABLE TO DO ANYTHING with the machine and will have to boot
+-it with a rescue disk and remove the file (or try the saveme program, see
+-the INSTALL file for more info).  THIS IS A ***WARNING***, please be
++it with a rescue disk and remove the file (or try the tsocks-saveme program,
++simply unlinks /etc/ld.so.preload ). THIS IS A ***WARNING***, please be
+ careful. Also be sure the library is in the root filesystem as all hell
+ will break loose if the directory it is in is not available at boot time.
+ 
+diff -Naur tsocks-1.8.orig/tsocks.conf.5 tsocks-1.8/tsocks.conf.5
+--- tsocks-1.8.orig/tsocks.conf.5	2002-05-18 05:13:08.000000000 +0300
++++ tsocks-1.8/tsocks.conf.5	2009-01-22 10:30:17.000000000 +0200
+@@ -139,21 +139,20 @@
+ the version that server supports. 
+ 
+ .TP
+-validateconf
+-validateconf can be used to verify the configuration file. It checks the format
+-of the file and also the contents for errors. Having read the file it dumps 
+-the configuration to the screen in a formatted, readable manner. This can be 
+-extremely useful in debugging problems.
+-
+-validateconf can read a configuration file from a location other than the 
+-location specified at compile time with the -f <filename> command line 
+-option.
+-
+-Normally validateconf simply dumps the configuration read to the screen (in
+-a nicely readable format), however it also has a useful 'test' mode. When
+-passed a hostname/ip on the command line like -t <hostname/ip>, validateconf 
+-determines which of the SOCKS servers specified in the configuration file 
+-would be used by tsocks to access the specified host. 
++tsocks-validateconf
++tsocks-validateconf can be used to verify the configuration file. It checks
++the format of the file and also the contents for errors. Having read the file 
++it dumps the configuration to the screen in a formatted, readable manner.
++This can be extremely useful in debugging problems.
++
++tsocks-validateconf can read a configuration file from a location other than the 
++location specified at compile time with the -f <filename> command line option.
++
++Normally tsocks-validateconf simply dumps the configuration read to the screen 
++(in a nicely readable format), however it also has a useful 'test' mode. When
++passed a hostname/ip on the command line like -t <hostname/ip>, 
++tsocks-validateconf determines which of the SOCKS servers specified in the 
++configuration file would be used by tsocks to access the specified host. 
+ 
+ .SH SEE ALSO
+ tsocks(8)
+diff -Naur tsocks-1.8.orig/validateconf.c tsocks-1.8/validateconf.c
+--- tsocks-1.8.orig/validateconf.c	2002-02-07 12:49:59.000000000 +0200
++++ tsocks-1.8/validateconf.c	2009-01-22 10:30:17.000000000 +0200
+@@ -23,7 +23,7 @@
+ */
+ 
+ /* Global configuration variables */ 
+-char *progname = "validateconf";	      /* Name for error msgs      */
++char *progname = "tsocks-validateconf";	      /* Name for error msgs      */
+ 
+ /* Header Files */
+ #include <config.h>
diff --git a/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r3.patch b/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r3.patch
new file mode 100644
index 0000000..1c9dd18
--- /dev/null
+++ b/net-proxy/tsocks/files/tsocks-1.8_beta5-gentoo-r3.patch
@@ -0,0 +1,133 @@
+diff -Nru tsocks-1.8.orig/Makefile.in tsocks-1.8/Makefile.in
+--- tsocks-1.8.orig/Makefile.in	2002-03-16 11:12:40.000000000 +0100
++++ tsocks-1.8/Makefile.in	2009-06-20 13:56:56.000000000 +0200
+@@ -28,6 +28,7 @@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ CFLAGS = @CFLAGS@
++LDFLAGS = @LDFLAGS@
+ INCLUDES = -I.
+ LIBS = @LIBS@
+ SPECIALLIBS = @SPECIALLIBS@
+@@ -41,16 +42,16 @@
+ all: ${TARGETS}
+ 
+ ${VALIDATECONF}: ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -o ${VALIDATECONF} ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o ${LIBS}
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${VALIDATECONF} ${VALIDATECONF}.c ${COMMON}.o ${PARSER}.o ${LIBS}
+ 
+ ${INSPECT}: ${INSPECT}.c ${COMMON}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
+ 
+ ${SAVE}: ${SAVE}.c
+-	${SHCC} ${CFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
++	${SHCC} ${LDFLAGS} ${INCLUDES} -o ${SAVE} ${SAVE}.c
+ 
+ ${SHLIB}: ${OBJS} ${COMMON}.o ${PARSER}.o
+-	${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
++	${SHCC} ${LDFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
+ 	ln -sf ${SHLIB} ${LIB_NAME}.so
+ 
+ %.so: %.c
+diff -Nru tsocks-1.8.orig/tsocks tsocks-1.8/tsocks
+--- tsocks-1.8.orig/tsocks	2002-03-16 11:27:18.000000000 +0100
++++ tsocks-1.8/tsocks	2009-06-20 13:56:38.000000000 +0200
+@@ -46,14 +46,14 @@
+ 	on)
+ 		if [ -z "$LD_PRELOAD" ]
+ 			then
+-				export LD_PRELOAD="/usr/lib/libtsocks.so"
++				export LD_PRELOAD="/lib/libtsocks.so"
+ 			else
+-				echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \
+-				export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"
++				echo $LD_PRELOAD | grep -q "/lib/libtsocks\.so" || \
++				export LD_PRELOAD="/lib/libtsocks.so $LD_PRELOAD"
+ 		fi
+ 	;;
+ 	off)
+-		export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/usr\/lib\/libtsocks.so \?//'`
++		export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/lib\/libtsocks.so \?//'`
+ 		if [ -z "$LD_PRELOAD" ]
+ 			then
+ 				unset LD_PRELOAD
+@@ -68,10 +68,10 @@
+ 	*)
+ 		if [ -z "$LD_PRELOAD" ]
+ 		then
+-			export LD_PRELOAD="/usr/lib/libtsocks.so"
++			export LD_PRELOAD="/lib/libtsocks.so"
+ 		else
+-			echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \
+-			export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"
++			echo $LD_PRELOAD | grep -q "/lib/libtsocks\.so" || \
++			export LD_PRELOAD="/lib/libtsocks.so $LD_PRELOAD"
+ 		fi
+ 
+ 		if [ $# = 0 ]
+diff -Nru tsocks-1.8.orig/tsocks.8 tsocks-1.8/tsocks.8
+--- tsocks-1.8.orig/tsocks.8	2002-03-16 11:20:51.000000000 +0100
++++ tsocks-1.8/tsocks.8	2009-06-20 13:56:38.000000000 +0200
+@@ -127,8 +127,8 @@
+ libtsocks in /etc/ld.so.preload. Please make sure you correctly enter the
+ full path to the library in this file if you do this. If you get it wrong,
+ you will be UNABLE TO DO ANYTHING with the machine and will have to boot
+-it with a rescue disk and remove the file (or try the saveme program, see
+-the INSTALL file for more info).  THIS IS A ***WARNING***, please be
++it with a rescue disk and remove the file (or try the tsocks-saveme program,
++simply unlinks /etc/ld.so.preload ). THIS IS A ***WARNING***, please be
+ careful. Also be sure the library is in the root filesystem as all hell
+ will break loose if the directory it is in is not available at boot time.
+ 
+diff -Nru tsocks-1.8.orig/tsocks.conf.5 tsocks-1.8/tsocks.conf.5
+--- tsocks-1.8.orig/tsocks.conf.5	2002-05-18 04:13:08.000000000 +0200
++++ tsocks-1.8/tsocks.conf.5	2009-06-20 13:56:38.000000000 +0200
+@@ -139,21 +139,20 @@
+ the version that server supports. 
+ 
+ .TP
+-validateconf
+-validateconf can be used to verify the configuration file. It checks the format
+-of the file and also the contents for errors. Having read the file it dumps 
+-the configuration to the screen in a formatted, readable manner. This can be 
+-extremely useful in debugging problems.
+-
+-validateconf can read a configuration file from a location other than the 
+-location specified at compile time with the -f <filename> command line 
+-option.
+-
+-Normally validateconf simply dumps the configuration read to the screen (in
+-a nicely readable format), however it also has a useful 'test' mode. When
+-passed a hostname/ip on the command line like -t <hostname/ip>, validateconf 
+-determines which of the SOCKS servers specified in the configuration file 
+-would be used by tsocks to access the specified host. 
++tsocks-validateconf
++tsocks-validateconf can be used to verify the configuration file. It checks
++the format of the file and also the contents for errors. Having read the file 
++it dumps the configuration to the screen in a formatted, readable manner.
++This can be extremely useful in debugging problems.
++
++tsocks-validateconf can read a configuration file from a location other than the 
++location specified at compile time with the -f <filename> command line option.
++
++Normally tsocks-validateconf simply dumps the configuration read to the screen 
++(in a nicely readable format), however it also has a useful 'test' mode. When
++passed a hostname/ip on the command line like -t <hostname/ip>, 
++tsocks-validateconf determines which of the SOCKS servers specified in the 
++configuration file would be used by tsocks to access the specified host. 
+ 
+ .SH SEE ALSO
+ tsocks(8)
+diff -Nru tsocks-1.8.orig/validateconf.c tsocks-1.8/validateconf.c
+--- tsocks-1.8.orig/validateconf.c	2002-02-07 11:49:59.000000000 +0100
++++ tsocks-1.8/validateconf.c	2009-06-20 13:56:38.000000000 +0200
+@@ -23,7 +23,7 @@
+ */
+ 
+ /* Global configuration variables */ 
+-char *progname = "validateconf";	      /* Name for error msgs      */
++char *progname = "tsocks-validateconf";	      /* Name for error msgs      */
+ 
+ /* Header Files */
+ #include <config.h>
diff --git a/net-proxy/tsocks/metadata.xml b/net-proxy/tsocks/metadata.xml
new file mode 100644
index 0000000..f70a637
--- /dev/null
+++ b/net-proxy/tsocks/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-proxy</herd>
+<longdescription>tsocks' role is to allow 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.</longdescription>
+<use>
+	<flag name='tordns'>
+		Apply tordns patch which allows transparent TORification of the DNS queries
+	</flag>
+</use>
+</pkgmetadata>
diff --git a/net-proxy/tsocks/tsocks-1.8_beta5-r3.ebuild b/net-proxy/tsocks/tsocks-1.8_beta5-r3.ebuild
new file mode 100644
index 0000000..c9c0aa4
--- /dev/null
+++ b/net-proxy/tsocks/tsocks-1.8_beta5-r3.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/tsocks/tsocks-1.8_beta5-r3.ebuild,v 1.6 2008/08/22 21:58:52 maekke Exp $
+
+inherit multilib eutils autotools toolchain-funcs
+
+DESCRIPTION="Transparent SOCKS v4 proxying library"
+HOMEPAGE="http://tsocks.sourceforge.net/"
+SRC_URI="mirror://sourceforge/tsocks/${PN}-${PV/_}.tar.gz
+	tordns? ( mirror://gentoo/${PN}-${PV/_beta/b}-tordns1-gentoo-r1.patch.gz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="tordns"
+
+S="${WORKDIR}/${P%%_*}"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	epatch "${FILESDIR}/${P}-gentoo-r1.patch"
+	epatch "${FILESDIR}/${P}-bsd.patch"
+	use tordns && epatch "../${PN}-${PV/_beta/b}-tordns1-gentoo-r1.patch"
+	eautoconf
+}
+
+src_compile() {
+	tc-export CC
+
+	# NOTE: the docs say to install it into /lib. If you put it into
+	# /usr/lib and add it to /etc/ld.so.preload on many systems /usr isn't
+	# mounted in time :-( (Ben Lutgens) <lamer@gentoo.org>
+	econf \
+		--with-conf=/etc/socks/tsocks.conf \
+		--libdir=/$(get_libdir) || die "configure failed"
+	# Fix QA notice lack of SONAME
+	emake DYNLIB_FLAGS=-Wl,--soname,libtsocks.so.${PV/_beta*} || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+	newbin validateconf tsocks-validateconf
+	newbin saveme tsocks-saveme
+	dobin inspectsocks
+	insinto /etc/socks
+	doins tsocks.conf.*.example
+	dodoc FAQ
+	use tordns && dodoc README*
+}
+
+pkg_postinst() {
+	einfo "Make sure you create /etc/socks/tsocks.conf from one of the examples in that directory"
+	einfo "The following executables have been renamed:"
+	einfo "    /usr/bin/saveme renamed to tsocks-saveme"
+	einfo "    /usr/bin/validateconf renamed to tsocks-validateconf"
+}
diff --git a/net-proxy/tsocks/tsocks-1.8_beta5-r4.ebuild b/net-proxy/tsocks/tsocks-1.8_beta5-r4.ebuild
new file mode 100644
index 0000000..df9c2c4
--- /dev/null
+++ b/net-proxy/tsocks/tsocks-1.8_beta5-r4.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/tsocks/tsocks-1.8_beta5-r4.ebuild,v 1.1 2009/02/18 00:01:46 mrness Exp $
+
+inherit multilib eutils autotools toolchain-funcs
+
+DESCRIPTION="Transparent SOCKS v4 proxying library"
+HOMEPAGE="http://tsocks.sourceforge.net/"
+SRC_URI="mirror://sourceforge/tsocks/${PN}-${PV/_}.tar.gz
+	tordns? ( mirror://gentoo/${PN}-${PV/_beta/b}-tordns1-gentoo-r1.patch.gz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="tordns"
+
+S="${WORKDIR}/${P%%_*}"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	epatch "${FILESDIR}/${P}-gentoo-r2.patch"
+	epatch "${FILESDIR}/${P}-bsd.patch"
+	use tordns && epatch "../${PN}-${PV/_beta/b}-tordns1-gentoo-r1.patch"
+	eautoconf
+}
+
+src_compile() {
+	tc-export CC
+
+	# NOTE: the docs say to install it into /lib. If you put it into
+	# /usr/lib and add it to /etc/ld.so.preload on many systems /usr isn't
+	# mounted in time :-( (Ben Lutgens) <lamer@gentoo.org>
+	econf \
+		--with-conf=/etc/socks/tsocks.conf \
+		--libdir=/$(get_libdir) || die "configure failed"
+	# Fix QA notice lack of SONAME
+	emake DYNLIB_FLAGS=-Wl,--soname,libtsocks.so.${PV/_beta*} || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+	newbin validateconf tsocks-validateconf
+	newbin saveme tsocks-saveme
+	dobin inspectsocks
+	insinto /etc/socks
+	doins tsocks.conf.*.example
+	dodoc FAQ
+	use tordns && dodoc README*
+}
+
+pkg_postinst() {
+	einfo "Make sure you create /etc/socks/tsocks.conf from one of the examples in that directory"
+	einfo "The following executables have been renamed:"
+	einfo "    /usr/bin/saveme renamed to tsocks-saveme"
+	einfo "    /usr/bin/validateconf renamed to tsocks-validateconf"
+}
diff --git a/net-proxy/tsocks/tsocks-1.8_beta5-r5.ebuild b/net-proxy/tsocks/tsocks-1.8_beta5-r5.ebuild
new file mode 100644
index 0000000..428d39c
--- /dev/null
+++ b/net-proxy/tsocks/tsocks-1.8_beta5-r5.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/tsocks/tsocks-1.8_beta5-r5.ebuild,v 1.6 2009/07/19 18:46:15 nixnut Exp $
+
+EAPI="2"
+
+inherit multilib eutils autotools toolchain-funcs
+
+DESCRIPTION="Transparent SOCKS v4 proxying library"
+HOMEPAGE="http://tsocks.sourceforge.net/"
+SRC_URI="mirror://sourceforge/tsocks/${PN}-${PV/_}.tar.gz
+	tordns? ( mirror://gentoo/${PN}-${PV/_beta/b}-tordns1-gentoo-r1.patch.gz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="tordns"
+
+S="${WORKDIR}/${P%%_*}"
+
+src_prepare() {
+	epatch "${FILESDIR}/${P}-gentoo-r3.patch"
+	epatch "${FILESDIR}/${P}-bsd.patch"
+	use tordns && epatch "../${PN}-${PV/_beta/b}-tordns1-gentoo-r1.patch"
+	eautoreconf
+}
+
+src_configure() {
+	tc-export CC
+
+	# NOTE: the docs say to install it into /lib. If you put it into
+	# /usr/lib and add it to /etc/ld.so.preload on many systems /usr isn't
+	# mounted in time :-( (Ben Lutgens) <lamer@gentoo.org>
+	econf \
+		--with-conf=/etc/socks/tsocks.conf \
+		--libdir=/$(get_libdir) || die "configure failed"
+}
+
+src_compile() {
+	# Fix QA notice lack of SONAME
+	emake DYNLIB_FLAGS=-Wl,--soname,libtsocks.so.${PV/_beta*} || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+	newbin validateconf tsocks-validateconf
+	newbin saveme tsocks-saveme
+	dobin inspectsocks
+	insinto /etc/socks
+	doins tsocks.conf.*.example
+	dodoc FAQ
+	use tordns && dodoc README*
+}
+
+pkg_postinst() {
+	einfo "Make sure you create /etc/socks/tsocks.conf from one of the examples in that directory"
+	einfo "The following executables have been renamed:"
+	einfo "    /usr/bin/saveme renamed to tsocks-saveme"
+	einfo "    /usr/bin/validateconf renamed to tsocks-validateconf"
+}