commit 3a5a263756df7257e68b727423cd2dbefe0f60c6
parent 3b9a371beaa89917cde49c35297823c2094a9933
Author: parazyd <parazyd@dyne.org>
Date: Wed, 5 Oct 2016 10:48:37 +0200
net-proxy/torsocks: Add 2.1.0-r99 with musl-libc support.
Diffstat:
5 files changed, 174 insertions(+), 0 deletions(-)
diff --git a/net-proxy/torsocks/Manifest b/net-proxy/torsocks/Manifest
@@ -0,0 +1 @@
+DIST torsocks-2.1.0.tar.gz 106339 SHA256 a72c3ea757f5fe81d1ab91e0d5f0d83f195e235aae66d4df2f88a20db7028104 SHA512 5bdec6fd6c2d99effb73e418acd37ee135b3c912fad7811bfc8c724282370beea23149c6e94b995cfed0e61be43e63ac11d8c6ef420ba0137a19b96d8ac370e5 WHIRLPOOL 4511c9bff51ec25efb9b6f211d4b37931ba9c23ad89b1b272adf6b60351308e59a5e3d5157ba4adfab9e085deba435a9a1a8b4c69ec98514069c42561799c25c
diff --git a/net-proxy/torsocks/files/fix-docdir.patch b/net-proxy/torsocks/files/fix-docdir.patch
@@ -0,0 +1,24 @@
+diff -Naur torsocks-1.2.orig/doc/Makefile.am torsocks-1.2/doc/Makefile.am
+--- torsocks-1.2.orig/doc/Makefile.am 2011-10-26 14:30:26.000000000 -0400
++++ torsocks-1.2/doc/Makefile.am 2011-12-26 20:05:40.000000000 -0500
+@@ -7,8 +7,6 @@
+ # Install man pages
+ dist_man_MANS = torsocks.1 torsocks.8 usewithtor.1 torsocks.conf.5
+
+-dist_data_DATA = socks/SOCKS5 socks/SOCKS4.protocol socks/socks-extensions.txt \
+- patches/compilewarnings.patch patches/conffile.patch patches/getaddrbyhost.patch \
+- patches/getpeername.patch patches/infiniteloop.patch patches/localaddresses.patch \
+- patches/README patches/README.TORDNS patches/tordns.patch notes/DEBUG
++dist_doc_DATA = socks/SOCKS5 socks/SOCKS4.protocol socks/socks-extensions.txt \
++ notes/DEBUG
+
+diff -Naur torsocks-1.2.orig/test/Makefile.am torsocks-1.2/test/Makefile.am
+--- torsocks-1.2.orig/test/Makefile.am 2011-10-26 14:21:57.000000000 -0400
++++ torsocks-1.2/test/Makefile.am 2011-12-26 20:04:34.000000000 -0500
+@@ -4,4 +4,4 @@
+ test_torsocks_LDFLAGS= $(TESTLDFLAGS)
+ CLEANFILES= test_torsocks
+
+-dist_data_DATA = run_tests.sh expectedresults.txt
+\ No newline at end of file
++dist_doc_DATA = run_tests.sh expectedresults.txt
diff --git a/net-proxy/torsocks/files/musl-fix.patch b/net-proxy/torsocks/files/musl-fix.patch
@@ -0,0 +1,85 @@
+diff -u -r torsocks-2.1.0.orig/src/common/compat.c torsocks-2.1.0/src/common/compat.c
+--- torsocks-2.1.0.orig/src/common/compat.c 2015-12-06 19:44:47.251991190 +0100
++++ torsocks-2.1.0/src/common/compat.c 2015-12-06 19:44:58.871959984 +0100
+@@ -19,8 +19,6 @@
+
+ #include "compat.h"
+
+-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+-
+ /*
+ * Initialize a pthread mutex. This never fails.
+ */
+@@ -95,5 +93,3 @@
+ }
+ tsocks_mutex_unlock(&o->mutex);
+ }
+-
+-#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
+diff -u -r torsocks-2.1.0.orig/src/common/compat.h torsocks-2.1.0/src/common/compat.h
+--- torsocks-2.1.0.orig/src/common/compat.h 2015-12-06 19:44:47.251991190 +0100
++++ torsocks-2.1.0/src/common/compat.h 2015-12-06 19:44:51.538646345 +0100
+@@ -22,8 +22,6 @@
+ #define __darwin__ 1
+ #endif
+
+-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+-
+ #define RTLD_NEXT ((void *) -1)
+
+ #include <pthread.h>
+@@ -53,10 +51,6 @@
+
+ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
+
+-#else
+-#error "OS not supported."
+-#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
+-
+ #if defined(__linux__)
+ #include <unistd.h>
+ #include <sys/syscall.h>
+diff -u -r torsocks-2.1.0.orig/src/common/ref.h torsocks-2.1.0/src/common/ref.h
+--- torsocks-2.1.0.orig/src/common/ref.h 2015-12-06 19:44:47.251991190 +0100
++++ torsocks-2.1.0/src/common/ref.h 2015-12-06 19:44:51.538646345 +0100
+@@ -26,8 +26,6 @@
+ long count;
+ };
+
+-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+-
+ /*
+ * Get a reference by incrementing the refcount.
+ */
+@@ -55,8 +53,4 @@
+ }
+ }
+
+-#else
+-#error "OS not supported"
+-#endif /* __GLIBC__, __FreeBSD__, __darwin__ */
+-
+ #endif /* TORSOCKS_REF_H */
+diff -u -r torsocks-2.1.0.orig/src/lib/torsocks.h torsocks-2.1.0/src/lib/torsocks.h
+--- torsocks-2.1.0.orig/src/lib/torsocks.h 2015-12-06 19:44:47.251991190 +0100
++++ torsocks-2.1.0/src/lib/torsocks.h 2015-12-06 19:44:51.538646345 +0100
+@@ -33,8 +33,6 @@
+ #define TSOCKS_DECL(name, type, sig) \
+ extern type tsocks_##name(sig);
+
+-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+-
+ /* connect(2) */
+ #include <sys/types.h>
+ #include <sys/socket.h>
+@@ -205,9 +203,6 @@
+ int sockfd, int backlog
+ #define LIBC_LISTEN_ARGS sockfd, backlog
+
+-#else
+-#error "OS not supported."
+-#endif /* __GLIBC__ , __FreeBSD__, __darwin__, __NetBSD__ */
+
+ #if (defined(__linux__))
+
+
diff --git a/net-proxy/torsocks/files/suppress-warning-msgs.patch b/net-proxy/torsocks/files/suppress-warning-msgs.patch
@@ -0,0 +1,15 @@
+--- torsocks-1.2.orig/src/torsocks.c 2011-10-25 17:49:50.000000000 -0400
++++ torsocks-1.2/src/torsocks.c 2012-02-21 11:09:20.000000000 -0500
+@@ -124,9 +124,9 @@
+ #define LOAD_ERROR(s,l) { \
+ const char *error; \
+ error = dlerror(); \
+- show_msg(l, "The symbol %s() was not found in any shared " \
+- "library. The error reported was: %s!\n", s, \
+- (error)?error:"not found"); \
++ if (error) \
++ show_msg(l, "The symbol %s() was not found in any shared " \
++ "library. The error reported was: %s!\n", s, error); \
+ dlerror(); \
+ }
+ pthread_mutex_lock(&torsocks_init_mutex);
diff --git a/net-proxy/torsocks/torsocks-2.1.0-r99.ebuild b/net-proxy/torsocks/torsocks-2.1.0-r99.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils multilib versionator
+
+MY_PV="$(replace_version_separator 3 -)"
+MY_PF="${PN}-${MY_PV}"
+S=${WORKDIR}/${MY_PF}
+
+DESCRIPTION="Use most socks-friendly applications with Tor"
+HOMEPAGE="https://github.com/dgoulet/torsocks"
+SRC_URI="https://github.com/dgoulet/torsocks/archive/v${MY_PV}.tar.gz -> ${MY_PF}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="static-libs"
+
+# We do not depend on tor which might be running on a different box
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i -e "/dist_doc_DATA/s/^/#/" Makefile.am doc/Makefile.am || die
+
+ # Disable tests requiring network access.
+ sed -i -e '/^\.\/test_dns$/d' tests/test_list || \
+ die "failed to disable network tests"
+
+ eautoreconf
+}
+
+src_configure() {
+ epatch "${FILESDIR}/musl-fix.patch"
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+
+ dodoc ChangeLog README.md TODO doc/notes/DEBUG doc/socks/{SOCKS5,socks-extensions.txt}
+
+ #Remove libtool .la files
+ cd "${D}"/usr/$(get_libdir)/torsocks || die
+ rm -f *.la
+}