Fri Dec 11 12:13:00 2015 UTC ()
Fix two problems when building on NetBSD-6.x.

Mention upstream bug reports filed for them.

Addresses PR 50521 by Uwe Toenjes.

While here, add reload command to rc.d script and bump PKGREVISION.


(wiz)
diff -r1.106 -r1.107 pkgsrc/net/tor/Makefile
diff -r1.68 -r1.69 pkgsrc/net/tor/distinfo
diff -r1.4 -r1.5 pkgsrc/net/tor/files/tor.in
diff -r0 -r1.1 pkgsrc/net/tor/patches/patch-src_common_compat__pthreads.c

cvs diff -r1.106 -r1.107 pkgsrc/net/tor/Makefile (expand / switch to unified diff)

--- pkgsrc/net/tor/Makefile 2015/12/08 13:19:38 1.106
+++ pkgsrc/net/tor/Makefile 2015/12/11 12:13:00 1.107
@@ -1,28 +1,31 @@ @@ -1,28 +1,31 @@
1# $NetBSD: Makefile,v 1.106 2015/12/08 13:19:38 wiz Exp $ 1# $NetBSD: Makefile,v 1.107 2015/12/11 12:13:00 wiz Exp $
2 2
3DISTNAME= tor-0.2.7.5 3DISTNAME= tor-0.2.7.5
 4PKGREVISION= 1
4CATEGORIES= net security 5CATEGORIES= net security
5MASTER_SITES= http://www.torproject.org/dist/ 6MASTER_SITES= http://www.torproject.org/dist/
6 7
7MAINTAINER= athaba@users.sourceforge.net 8MAINTAINER= athaba@users.sourceforge.net
8HOMEPAGE= http://www.torproject.org/ 9HOMEPAGE= http://www.torproject.org/
9COMMENT= Anonymizing overlay network for TCP 10COMMENT= Anonymizing overlay network for TCP
10LICENSE= modified-bsd 11LICENSE= modified-bsd
11 12
12.include "../../mk/bsd.prefs.mk" 13.include "../../mk/bsd.prefs.mk"
13 14
14USE_LANGUAGES= c99 15USE_LANGUAGES= c99
15USE_PKGLOCALEDIR= yes 16USE_PKGLOCALEDIR= yes
 17# https://trac.torproject.org/projects/tor/ticket/17818
 18USE_TOOLS+= gmake
16GNU_CONFIGURE= yes 19GNU_CONFIGURE= yes
17 20
18CONFIGURE_ENV+= CPP=${CPP:Q} 21CONFIGURE_ENV+= CPP=${CPP:Q}
19CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR} 22CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR}
20 23
21TEST_TARGET= check 24TEST_TARGET= check
22 25
23TOR_USER?= tor 26TOR_USER?= tor
24TOR_GROUP?= tor 27TOR_GROUP?= tor
25PKG_GECOS.${TOR_USER}= Torifier 28PKG_GECOS.${TOR_USER}= Torifier
26PKG_HOME.${TOR_USER}= ${VARBASE}/chroot/tor 29PKG_HOME.${TOR_USER}= ${VARBASE}/chroot/tor
27BUILD_DEFS+= VARBASE 30BUILD_DEFS+= VARBASE
28PKG_SYSCONFSUBDIR= tor 31PKG_SYSCONFSUBDIR= tor

cvs diff -r1.68 -r1.69 pkgsrc/net/tor/distinfo (expand / switch to unified diff)

--- pkgsrc/net/tor/distinfo 2015/12/08 13:19:38 1.68
+++ pkgsrc/net/tor/distinfo 2015/12/11 12:13:00 1.69
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
1$NetBSD: distinfo,v 1.68 2015/12/08 13:19:38 wiz Exp $ 1$NetBSD: distinfo,v 1.69 2015/12/11 12:13:00 wiz Exp $
2 2
3SHA1 (tor-0.2.7.5.tar.gz) = ff099ddea9b33788d6f6ad8ed7f38479be197086 3SHA1 (tor-0.2.7.5.tar.gz) = ff099ddea9b33788d6f6ad8ed7f38479be197086
4RMD160 (tor-0.2.7.5.tar.gz) = 964a3d0080684e159a85a2e257a4051667279e5d 4RMD160 (tor-0.2.7.5.tar.gz) = 964a3d0080684e159a85a2e257a4051667279e5d
5SHA512 (tor-0.2.7.5.tar.gz) = c57b3ee6ecc36456182c7130db671c5581914cddf973c9460625cd5ecd10d128f3e4832f1520269f6ab145cc0dcb218df2a19fb659b778fb31d9f69de5362678 5SHA512 (tor-0.2.7.5.tar.gz) = c57b3ee6ecc36456182c7130db671c5581914cddf973c9460625cd5ecd10d128f3e4832f1520269f6ab145cc0dcb218df2a19fb659b778fb31d9f69de5362678
6Size (tor-0.2.7.5.tar.gz) = 4838541 bytes 6Size (tor-0.2.7.5.tar.gz) = 4838541 bytes
 7SHA1 (patch-src_common_compat__pthreads.c) = 6c1be2f8e66e3796272eaad2d8a37ada6aa5e6ff

cvs diff -r1.4 -r1.5 pkgsrc/net/tor/files/tor.in (expand / switch to unified diff)

--- pkgsrc/net/tor/files/tor.in 2015/12/08 13:19:38 1.4
+++ pkgsrc/net/tor/files/tor.in 2015/12/11 12:13:00 1.5
@@ -1,44 +1,46 @@ @@ -1,44 +1,46 @@
1#!@RCD_SCRIPTS_SHELL@ 1#!@RCD_SCRIPTS_SHELL@
2# 2#
3# $NetBSD: tor.in,v 1.4 2015/12/08 13:19:38 wiz Exp $ 3# $NetBSD: tor.in,v 1.5 2015/12/11 12:13:00 wiz Exp $
4# 4#
5# PROVIDE: tor 5# PROVIDE: tor
6# REQUIRE: DAEMON NETWORKING 6# REQUIRE: DAEMON NETWORKING
7# KEYWORD: shutdown 7# KEYWORD: shutdown
8# 8#
9# You will need to set some variables in /etc/rc.conf to start tor: 9# You will need to set some variables in /etc/rc.conf to start tor:
10# 10#
11# tor=YES 11# tor=YES
12 12
13if [ -f /etc/rc.subr ] 13if [ -f /etc/rc.subr ]
14then 14then
15 . /etc/rc.subr 15 . /etc/rc.subr
16fi 16fi
17 17
18name="tor" 18name="tor"
19rcvar=$name 19rcvar=$name
20command="@PREFIX@/bin/tor" 20command="@PREFIX@/bin/tor"
21required_files="@PKG_SYSCONFDIR@/torrc" 21required_files="@PKG_SYSCONFDIR@/torrc"
22start_cmd="tor_start" 22start_cmd="tor_start"
23stop_cmd="tor_stop" 23stop_cmd="tor_stop"
24pidfile="@PKG_HOME@/${name}.pid" 24pidfile="@PKG_HOME@/${name}.pid"
25restart_cmd="tor_stop ; tor_start" 25restart_cmd="tor_stop ; tor_start"
 26extra_commands="reload"
26 27
27tor_start () 28tor_start ()
28{ 29{
29 ${command} --User @TOR_USER@ --RunAsDaemon 1 \ 30 ${command} --User @TOR_USER@ --RunAsDaemon 1 \
30 --DataDirectory @PKG_HOME@ --PIDFile ${pidfile} 31 --DataDirectory @PKG_HOME@ --PIDFile ${pidfile}
31} 32}
32 33
33tor_stop() 34tor_stop()
34{ 35{
35 kill `cat ${pidfile}` 2>/dev/null 36 kill `cat ${pidfile}` 2>/dev/null
36} 37}
37 38
38if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ] 39if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
39then 40then
40 load_rc_config $name 41 load_rc_config $name
41 run_rc_command "$1" 42 run_rc_command "$1"
42else 43else
43 eval ${start_cmd} 44 eval ${start_cmd}
44fi 45fi
 46

File Added: pkgsrc/net/tor/patches/Attic/patch-src_common_compat__pthreads.c
$NetBSD: patch-src_common_compat__pthreads.c,v 1.1 2015/12/11 12:13:00 wiz Exp $

Disable a function that is not there on NetBSD before 7.
https://trac.torproject.org/projects/tor/ticket/17819

--- src/common/compat_pthreads.c.orig	2015-11-13 13:33:25.000000000 +0000
+++ src/common/compat_pthreads.c
@@ -186,12 +186,14 @@ tor_cond_init(tor_cond_t *cond)
   }
 
 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+#if !defined(__NetBSD__) || (defined(__NetBSD__) && __NetBSD_Version__ > 699999999)
   /* Use monotonic time so when we timedwait() on it, any clock adjustment
    * won't affect the timeout value. */
   if (pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC)) {
     return -1;
   }
 #endif
+#endif
   if (pthread_cond_init(&cond->cond, &condattr)) {
     return -1;
   }