More fixes; now packages on NetBSD.

This commit is contained in:
Thomas Klausner 2013-11-05 14:56:42 +00:00
parent fd4fee8951
commit 2e73777467
8 changed files with 133 additions and 6 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1 2013/11/04 00:23:46 thomasklausner Exp $
# $NetBSD: Makefile,v 1.2 2013/11/05 14:56:42 thomasklausner Exp $
DISTNAME= v2.0.0-rc3
PKGNAME= torsocks-${DISTNAME:S/v//:S/-rc/rc/}
@ -15,6 +15,7 @@ DIST_SUBDIR= torsocks
WRKSRC= ${WRKDIR}/torsocks-${DISTNAME:S/v//}
USE_TOOLS+= autoreconf autoconf automake
GNU_CONFIGURE= yes
USE_LIBTOOL= yes
CONFIGURE_ENV+= LIBC_PATH=/lib/libc.so
pre-configure:

View file

@ -1 +1,11 @@
@comment $NetBSD: PLIST,v 1.1 2013/11/04 00:23:46 thomasklausner Exp $
@comment $NetBSD: PLIST,v 1.2 2013/11/05 14:56:42 thomasklausner Exp $
bin/torsocks
etc/tor/torsocks.conf
lib/torsocks/libtorsocks.la
man/man1/torsocks.1
man/man5/torsocks.conf.5
man/man8/torsocks.8
share/DEBUG
share/SOCKS5
share/doc/torsocks/ChangeLog
share/socks-extensions.txt

View file

@ -1 +1,2 @@
Needs porting for NetBSD; and at least PLIST fixes for other platforms.
Config file needs fixing.
Untested.

View file

@ -1,7 +1,10 @@
$NetBSD: distinfo,v 1.1 2013/11/04 00:23:47 thomasklausner Exp $
$NetBSD: distinfo,v 1.2 2013/11/05 14:56:42 thomasklausner Exp $
SHA1 (torsocks/v2.0.0-rc3.tar.gz) = fe6a73a471e02b2ee58f1a4bccf93b6a06bc3c3a
RMD160 (torsocks/v2.0.0-rc3.tar.gz) = ca7626a676dff3172f77f25ac633535c8aa8dae4
Size (torsocks/v2.0.0-rc3.tar.gz) = 109998 bytes
SHA1 (patch-src_common_compat.h) = d855d6144e225a1b48ff16517cacb3f81f0d35fe
SHA1 (patch-src_common_compat.c) = 95c51dfa7117f349444434e23051c2aad97f566f
SHA1 (patch-src_common_compat.h) = 5217e5e67986ef32cee913a35ed64a2e8adb57b9
SHA1 (patch-src_common_ref.h) = b20d5934a2be10f98bcfe5111e2dc9e26aa7319d
SHA1 (patch-src_lib_torsocks.h) = 0182c1858644c9df49c925ad72e50bfb3a493ccc
SHA1 (patch-tests_utils_tap_tap.c) = 53dba971eb2d68eaff4fc2a86f55702644364fd9

View file

@ -0,0 +1,21 @@
$NetBSD: patch-src_common_compat.c,v 1.1 2013/11/05 14:56:42 thomasklausner Exp $
Handle NetBSD like FreeBSD.
--- src/common/compat.c.orig 2013-11-03 18:24:51.000000000 +0000
+++ src/common/compat.c
@@ -19,7 +19,7 @@
#include "compat.h"
-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__))
+#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
/*
* Initialize a pthread mutex. This never fails.
@@ -71,4 +71,4 @@ void tsocks_mutex_unlock(tsocks_mutex_t
assert(!ret);
}
-#endif /* __GLIBC__, __darwin__, __FreeBSD__ */
+#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */

View file

@ -1,4 +1,4 @@
$NetBSD: patch-src_common_compat.h,v 1.1 2013/11/04 00:23:47 thomasklausner Exp $
$NetBSD: patch-src_common_compat.h,v 1.2 2013/11/05 14:56:43 thomasklausner Exp $
Handle NetBSD like FreeBSD.
@ -13,3 +13,36 @@ Handle NetBSD like FreeBSD.
#define RTLD_NEXT ((void *) -1)
@@ -43,7 +43,7 @@ void tsocks_mutex_unlock(tsocks_mutex_t
#else
#error "OS not supported."
-#endif /* __GLIBC__, __darwin__, __FreeBSD__ */
+#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
#if defined(__linux__)
@@ -84,17 +84,21 @@ void tsocks_mutex_unlock(tsocks_mutex_t
#endif /* __linux__ */
-#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__darwin__))
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__darwin__) || defined(__NetBSD__))
#include <sys/syscall.h>
#include <unistd.h>
+#if defined(__NetBSD__)
+#define SYS_socket SYS___socket30
+#endif
+
#define TSOCKS_NR_SOCKET SYS_socket
#define TSOCKS_NR_CONNECT SYS_connect
#define TSOCKS_NR_CLOSE SYS_close
#define TSOCKS_NR_MMAP SYS_mmap
#define TSOCKS_NR_MUNMAP SYS_munmap
-#endif /* __FreeBSD__, __FreeBSD_kernel__, __darwin__ */
+#endif /* __FreeBSD__, __FreeBSD_kernel__, __darwin__, __NetBSD__ */
#endif /* TORSOCKS_COMPAT_H */

View file

@ -0,0 +1,42 @@
$NetBSD: patch-src_lib_torsocks.h,v 1.1 2013/11/05 14:56:43 thomasklausner Exp $
Handle NetBSD like FreeBSD.
--- src/lib/torsocks.h.orig 2013-11-03 18:24:51.000000000 +0000
+++ src/lib/torsocks.h
@@ -33,7 +33,7 @@
#define TSOCKS_DECL(name, type, sig) \
extern type tsocks_##name(sig);
-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__))
+#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
/* connect(2) */
#include <sys/types.h>
@@ -171,7 +171,7 @@ struct hostent **__result, int *__h_errn
#else
#error "OS not supported."
-#endif /* __GLIBC__ , __FreeBSD__, __darwin__ */
+#endif /* __GLIBC__ , __FreeBSD__, __darwin__, __NetBSD__ */
#if (defined(__linux__))
@@ -186,7 +186,7 @@ struct hostent **__result, int *__h_errn
#endif /* __linux__ */
-#if (defined(__FreeBSD__) || defined(__darwin__))
+#if (defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
/* syscall(2) */
#define LIBC_SYSCALL_NAME syscall
@@ -195,7 +195,7 @@ struct hostent **__result, int *__h_errn
#define LIBC_SYSCALL_SIG int __number, ...
#define LIBC_SYSCALL_ARGS __number
-#endif /* __FreeBSD__, __darwin__ */
+#endif /* __FreeBSD__, __darwin__, __NetBSD__ */
#if defined(__GLIBC__) && defined(__FreeBSD_kernel__)

View file

@ -0,0 +1,16 @@
$NetBSD: patch-tests_utils_tap_tap.c,v 1.1 2013/11/05 14:56:43 thomasklausner Exp $
isdigit() only accepts unsigned chars and -1.
NetBSD's version is quite picky about this.
--- tests/utils/tap/tap.c.orig 2013-11-03 18:24:51.000000000 +0000
+++ tests/utils/tap/tap.c
@@ -94,7 +94,7 @@ _gen_result(int ok, const char *func, ch
if(local_test_name) {
name_is_digits = 1;
for(c = local_test_name; *c != '\0'; c++) {
- if(!isdigit(*c) && !isspace(*c)) {
+ if(!isdigit((unsigned char)*c) && !isspace((unsigned char)*c)) {
name_is_digits = 0;
break;
}