summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-misc/tor
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-misc/tor')
-rw-r--r--net-misc/tor/Manifest3
-rw-r--r--net-misc/tor/files/README.gentoo8
-rw-r--r--net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch31
-rw-r--r--net-misc/tor/files/tor.conf1
-rw-r--r--net-misc/tor/files/tor.confd3
-rw-r--r--net-misc/tor/files/tor.initd-r784
-rw-r--r--net-misc/tor/files/tor.service21
-rw-r--r--net-misc/tor/files/torrc-r17
-rw-r--r--net-misc/tor/metadata.xml17
-rw-r--r--net-misc/tor/tor-0.2.6.10.ebuild101
-rw-r--r--net-misc/tor/tor-0.2.6.7.ebuild100
-rw-r--r--net-misc/tor/tor-0.2.7.2_alpha.ebuild101
12 files changed, 477 insertions, 0 deletions
diff --git a/net-misc/tor/Manifest b/net-misc/tor/Manifest
new file mode 100644
index 000000000000..6a42d2de1bdc
--- /dev/null
+++ b/net-misc/tor/Manifest
@@ -0,0 +1,3 @@
+DIST tor-0.2.6.10.tar.gz 3587211 SHA256 0542c0efe43b86619337862fa7eb02c7a74cb23a79d587090628a5f0f1224b8d SHA512 4d1fd794d48ada725af829e1c1f3f3b7d8d04f2d1dd22e4f175ddc49401834f2001f04d78b011cdc7e953fe44972f2859d87078489a08ae126b44f93f6b9a438 WHIRLPOOL ba2685454ecb0dd94c568e05fb14526cd06beea6e9c6f7b27328f85c555392b6f42f35dc7860ae25299a830c7f6643963a9b9719a2557c28a7216019c96caf21
+DIST tor-0.2.6.7.tar.gz 3595669 SHA256 8c2be88a542ed1b22a8d3d595ec0acd0e28191de273dbcaefc64fdce92b89e6c SHA512 96e3cb5bcafddb1655663091ecf08f708213e47529d9701d67256e88d5fc2e70acffc6c062df6b8f0f4a4e3ef3d0dda76b5127ef9eeee06371ce0a66e53815b0 WHIRLPOOL 5da1f3e2ed1c12a1efba3eee91016beeaa5c40434831e684bb33670ae301e1661096c4a4231cd345c5dd833e8547f71f0c28d22c6d4b51a43bd0d6603160973c
+DIST tor-0.2.7.2-alpha.tar.gz 4759260 SHA256 006de44b01e15916b1f648df92723c2a7d58e6a2cd05484d70d0af2f566b330c SHA512 92d099ecd84ab9fd480198bb902017be4a264cc1a60292fd5d8beea3901932cba47f219681a6edcd12c3bb9f9e8076e03266fb7a269160d6a59650fd6b2dc574 WHIRLPOOL abb1d36ca825620e2b2c82f46049d57f81c350cdb163cc006cd8bfce5eb74d20121b935a0984f30a49434176a35de08f355d56db9661549ab2bfa55f8b8d8439
diff --git a/net-misc/tor/files/README.gentoo b/net-misc/tor/files/README.gentoo
new file mode 100644
index 000000000000..35214ac6fbb5
--- /dev/null
+++ b/net-misc/tor/files/README.gentoo
@@ -0,0 +1,8 @@
+We created a configuration file for tor, /etc/tor/torrc, but you can
+change it according to your needs. Use the torrc.sample that is in
+that directory as a guide. Also, to have privoxy work with tor
+just add the following line
+
+forward-socks4a / localhost:9050 .
+
+to /etc/privoxy/config. Notice the . at the end!
diff --git a/net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch b/net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch
new file mode 100644
index 000000000000..1fa9d2856dc3
--- /dev/null
+++ b/net-misc/tor/files/tor-0.2.3.14_alpha-torrc.sample.patch
@@ -0,0 +1,31 @@
+diff -Naur tor-0.2.3.14-alpha.orig//src/config/torrc.sample.in tor-0.2.3.14-alpha/src/config/torrc.sample.in
+--- tor-0.2.3.14-alpha.orig//src/config/torrc.sample.in 2012-04-23 03:10:14.000000000 -0400
++++ tor-0.2.3.14-alpha/src/config/torrc.sample.in 2012-04-24 06:30:21.000000000 -0400
+@@ -12,6 +12,11 @@
+ ## Tor will look for this file in various places based on your platform:
+ ## https://www.torproject.org/docs/faq#torrc
+
++## Default username and group the server will run as
++User tor
++
++PIDFile /var/run/tor/tor.pid
++
+ ## Tor opens a socks proxy on port 9050 by default -- even if you don't
+ ## configure one below. Set "SocksPort 0" if you plan to run Tor only
+ ## as a relay, and not make any local application connections yourself.
+@@ -41,6 +46,7 @@
+ #Log notice syslog
+ ## To send all messages to stderr:
+ #Log debug stderr
++Log warn syslog
+
+ ## Uncomment this to start the process in the background... or use
+ ## --runasdaemon 1 on the command line. This is ignored on Windows;
+@@ -50,6 +56,7 @@
+ ## The directory for keeping all the keys/etc. By default, we store
+ ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
+ #DataDirectory @LOCALSTATEDIR@/lib/tor
++DataDirectory /var/lib/tor/data
+
+ ## The port on which Tor will listen for local connections from Tor
+ ## controller applications, as documented in control-spec.txt.
diff --git a/net-misc/tor/files/tor.conf b/net-misc/tor/files/tor.conf
new file mode 100644
index 000000000000..188c041e5442
--- /dev/null
+++ b/net-misc/tor/files/tor.conf
@@ -0,0 +1 @@
+d /var/run/tor 0775 tor tor - -
diff --git a/net-misc/tor/files/tor.confd b/net-misc/tor/files/tor.confd
new file mode 100644
index 000000000000..4195bf3237b2
--- /dev/null
+++ b/net-misc/tor/files/tor.confd
@@ -0,0 +1,3 @@
+#
+# Set the file limit
+rc_ulimit="-n 30000"
diff --git a/net-misc/tor/files/tor.initd-r7 b/net-misc/tor/files/tor.initd-r7
new file mode 100644
index 000000000000..799cca17f470
--- /dev/null
+++ b/net-misc/tor/files/tor.initd-r7
@@ -0,0 +1,84 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+PIDFILE=/var/run/tor/tor.pid
+CONFFILE=/etc/tor/torrc
+GRACEFUL_TIMEOUT=${GRACEFUL_TIMEOUT:-60}
+
+# See bug #523552, and https://trac.torproject.org/projects/tor/ticket/5525
+# Graceful = wait 30 secs or so until all connections are properly closed.
+extra_commands="checkconfig"
+extra_started_commands="graceful gracefulstop reload"
+description="Anonymizing overlay network for TCP"
+description_checkconfig="Check for valid config file."
+description_reload="Reload the configuration."
+description_graceful="Gracefully restart."
+description_gracefulstop="Gracefully stop."
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ # first check that it exists
+ if [ ! -f ${CONFFILE} ] ; then
+ eerror "You need to setup ${CONFFILE} first"
+ eerror "Example is in ${CONFFILE}.sample"
+ return 1
+ fi
+
+ # now verify whether the configuration is valid
+ /usr/bin/tor --verify-config -f ${CONFFILE} > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ einfo "Tor configuration (${CONFFILE}) is valid."
+ return 0
+ else
+ eerror "Tor configuration (${CONFFILE}) not valid."
+ /usr/bin/tor --verify-config -f ${CONFFILE}
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ checkpath -d -m 0755 -o tor:tor /var/run/tor
+ ebegin "Starting Tor"
+ HOME=/var/lib/tor
+ start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor -- -f "${CONFFILE}" --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Tor"
+ start-stop-daemon --stop --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
+ eend $?
+}
+
+graceful() {
+ gracefulstop
+ start
+ eend $?
+}
+
+gracefulstop() {
+ local rc=0
+ ebegin "Gracefully stopping Tor"
+ ebegin "This can take up to ${GRACEFUL_TIMEOUT} seconds"
+ start-stop-daemon -P --stop --signal INT -R ${GRACEFUL_TIMEOUT} --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
+ rc=$?
+ eend "done"
+ eend $rc
+}
+
+reload() {
+ if [ ! -f ${PIDFILE} ]; then
+ eerror "${SVCNAME} isn't running"
+ return 1
+ fi
+ checkconfig || return 1
+ ebegin "Reloading Tor configuration"
+ start-stop-daemon --signal HUP --pidfile ${PIDFILE}
+ eend $?
+}
diff --git a/net-misc/tor/files/tor.service b/net-misc/tor/files/tor.service
new file mode 100644
index 000000000000..8fcc6740ed91
--- /dev/null
+++ b/net-misc/tor/files/tor.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=The Onion Router
+
+[Service]
+ExecStartPre=/usr/bin/tor --verify-config -f /etc/tor/torrc
+ExecStart=/usr/bin/tor --RunAsDaemon 0 -f /etc/tor/torrc
+ExecReload=/bin/kill -HUP $MAINPID
+KillSignal=SIGINT
+TimeoutStopSec=32
+LimitNOFILE=30000
+
+# Hardening options:
+CapabilityBoundingSet = CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE
+PrivateTmp = yes
+PrivateDevices = yes
+ProtectHome = yes
+ProtectSystem = full
+NoNewPrivileges = yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-misc/tor/files/torrc-r1 b/net-misc/tor/files/torrc-r1
new file mode 100644
index 000000000000..322a794aa1d5
--- /dev/null
+++ b/net-misc/tor/files/torrc-r1
@@ -0,0 +1,7 @@
+#
+# Minimal torrc so tor will work out of the box
+#
+User tor
+PIDFile /var/run/tor/tor.pid
+Log notice syslog
+DataDirectory /var/lib/tor/data
diff --git a/net-misc/tor/metadata.xml b/net-misc/tor/metadata.xml
new file mode 100644
index 000000000000..dc1abd89bc4b
--- /dev/null
+++ b/net-misc/tor/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+ </maintainer>
+ <use>
+ <flag name='bufferevents'>Use libevent's buffered IO implementation (unstable, buggy)</flag>
+ <flag name='stats'>Enable tracking of how much of each kind of resource we download</flag>
+ <flag name='nat-pmp'>Enable NAT Port Mapping Protocol</flag>
+ <flag name='scrypt'>Use <pkg>app-crypt/libscrypt</pkg> for the scrypt algorithm</flag>
+ <flag name='tor-hardening'>Compile tor with hardening on vanilla compilers/linkers</flag>
+ <flag name='transparent-proxy'>Enable transparent proxying</flag>
+ <flag name='web'>Build a tor2web service instead of a tor client</flag>
+ </use>
+</pkgmetadata>
diff --git a/net-misc/tor/tor-0.2.6.10.ebuild b/net-misc/tor/tor-0.2.6.10.ebuild
new file mode 100644
index 000000000000..7c29500c58e0
--- /dev/null
+++ b/net-misc/tor/tor-0.2.6.10.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils flag-o-matic readme.gentoo systemd toolchain-funcs versionator user
+
+MY_PV="$(replace_version_separator 4 -)"
+MY_PF="${PN}-${MY_PV}"
+DESCRIPTION="Anonymizing overlay network for TCP"
+HOMEPAGE="http://www.torproject.org/"
+SRC_URI="https://www.torproject.org/dist/${MY_PF}.tar.gz
+ https://archive.torproject.org/tor-package-archive/${MY_PF}.tar.gz"
+S="${WORKDIR}/${MY_PF}"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ~mips ppc ppc64 sparc x86"
+IUSE="-bufferevents nat-pmp scrypt seccomp selinux stats systemd tor-hardening transparent-proxy test upnp web"
+
+DEPEND="dev-libs/openssl:=
+ sys-libs/zlib
+ dev-libs/libevent
+ bufferevents? ( dev-libs/libevent[ssl] )
+ nat-pmp? ( net-libs/libnatpmp )
+ scrypt? ( app-crypt/libscrypt )
+ seccomp? ( sys-libs/libseccomp )
+ systemd? ( sys-apps/systemd )
+ upnp? ( net-libs/miniupnpc )"
+RDEPEND="${DEPEND}
+ selinux? ( sec-policy/selinux-tor )"
+
+pkg_setup() {
+ enewgroup tor
+ enewuser tor -1 -1 /var/lib/tor tor
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.2.3.14_alpha-torrc.sample.patch
+ epatch_user
+}
+
+src_configure() {
+ # Upstream isn't sure of all the user provided CFLAGS that
+ # will break tor, but does recommend against -fstrict-aliasing.
+ # We'll filter-flags them here as we encounter them.
+ filter-flags -fstrict-aliasing
+
+ econf \
+ --enable-system-torrc \
+ --enable-asciidoc \
+ --docdir=/usr/share/doc/${PF} \
+ $(use_enable stats instrument-downloads) \
+ $(use_enable bufferevents) \
+ $(use_enable nat-pmp) \
+ $(use_enable scrypt libscrypt) \
+ $(use_enable seccomp) \
+ $(use_enable systemd) \
+ $(use_enable tor-hardening gcc-hardening) \
+ $(use_enable tor-hardening linker-hardening) \
+ $(use_enable transparent-proxy transparent) \
+ $(use_enable upnp) \
+ $(use_enable web tor2web-mode) \
+ $(use_enable test unittests) \
+ $(use_enable test coverage)
+}
+
+src_install() {
+ readme.gentoo_create_doc
+
+ newconfd "${FILESDIR}"/tor.confd tor
+ newinitd "${FILESDIR}"/tor.initd-r7 tor
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_dotmpfilesd "${FILESDIR}/${PN}.conf"
+
+ emake DESTDIR="${D}" install
+
+ keepdir /var/lib/tor
+
+ dodoc README ChangeLog ReleaseNotes doc/HACKING
+
+ fperms 750 /var/lib/tor
+ fowners tor:tor /var/lib/tor
+
+ insinto /etc/tor/
+ newins "${FILESDIR}"/torrc-r1 torrc
+}
+
+pkg_postinst() {
+ readme.gentoo_pkg_postinst
+
+ if [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -eq 8 && $(gcc-micro-version) -ge 1 ]] ; then
+ ewarn "Due to a bug in >=gcc-4.8.1, compiling ${P} with -Os leads to an infinite"
+ ewarn "loop. See:"
+ ewarn
+ ewarn " https://trac.torproject.org/projects/tor/ticket/10259"
+ ewarn " http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59358"
+ ewarn
+ fi
+}
diff --git a/net-misc/tor/tor-0.2.6.7.ebuild b/net-misc/tor/tor-0.2.6.7.ebuild
new file mode 100644
index 000000000000..57ce1990f265
--- /dev/null
+++ b/net-misc/tor/tor-0.2.6.7.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils flag-o-matic readme.gentoo systemd toolchain-funcs versionator user
+
+MY_PV="$(replace_version_separator 4 -)"
+MY_PF="${PN}-${MY_PV}"
+DESCRIPTION="Anonymizing overlay network for TCP"
+HOMEPAGE="http://www.torproject.org/"
+SRC_URI="https://www.torproject.org/dist/${MY_PF}.tar.gz
+ https://archive.torproject.org/tor-package-archive/${MY_PF}.tar.gz"
+S="${WORKDIR}/${MY_PF}"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ~mips ppc ppc64 sparc x86"
+IUSE="-bufferevents nat-pmp scrypt seccomp selinux stats systemd tor-hardening transparent-proxy test upnp web"
+
+DEPEND="dev-libs/openssl
+ sys-libs/zlib
+ dev-libs/libevent
+ bufferevents? ( dev-libs/libevent[ssl] )
+ nat-pmp? ( net-libs/libnatpmp )
+ scrypt? ( app-crypt/libscrypt )
+ seccomp? ( sys-libs/libseccomp )
+ upnp? ( net-libs/miniupnpc )"
+RDEPEND="${DEPEND}
+ selinux? ( sec-policy/selinux-tor )"
+
+pkg_setup() {
+ enewgroup tor
+ enewuser tor -1 -1 /var/lib/tor tor
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.2.3.14_alpha-torrc.sample.patch
+ epatch_user
+}
+
+src_configure() {
+ # Upstream isn't sure of all the user provided CFLAGS that
+ # will break tor, but does recommend against -fstrict-aliasing.
+ # We'll filter-flags them here as we encounter them.
+ filter-flags -fstrict-aliasing
+
+ econf \
+ --enable-system-torrc \
+ --enable-asciidoc \
+ --docdir=/usr/share/doc/${PF} \
+ $(use_enable stats instrument-downloads) \
+ $(use_enable bufferevents) \
+ $(use_enable nat-pmp) \
+ $(use_enable scrypt libscrypt) \
+ $(use_enable seccomp) \
+ $(use_enable systemd) \
+ $(use_enable tor-hardening gcc-hardening) \
+ $(use_enable tor-hardening linker-hardening) \
+ $(use_enable transparent-proxy transparent) \
+ $(use_enable upnp) \
+ $(use_enable web tor2web-mode) \
+ $(use_enable test unittests) \
+ $(use_enable test coverage)
+}
+
+src_install() {
+ readme.gentoo_create_doc
+
+ newconfd "${FILESDIR}"/tor.confd tor
+ newinitd "${FILESDIR}"/tor.initd-r7 tor
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_dotmpfilesd "${FILESDIR}/${PN}.conf"
+
+ emake DESTDIR="${D}" install
+
+ keepdir /var/lib/tor
+
+ dodoc README ChangeLog ReleaseNotes doc/HACKING
+
+ fperms 750 /var/lib/tor
+ fowners tor:tor /var/lib/tor
+
+ insinto /etc/tor/
+ newins "${FILESDIR}"/torrc-r1 torrc
+}
+
+pkg_postinst() {
+ readme.gentoo_pkg_postinst
+
+ if [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -eq 8 && $(gcc-micro-version) -ge 1 ]] ; then
+ ewarn "Due to a bug in >=gcc-4.8.1, compiling ${P} with -Os leads to an infinite"
+ ewarn "loop. See:"
+ ewarn
+ ewarn " https://trac.torproject.org/projects/tor/ticket/10259"
+ ewarn " http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59358"
+ ewarn
+ fi
+}
diff --git a/net-misc/tor/tor-0.2.7.2_alpha.ebuild b/net-misc/tor/tor-0.2.7.2_alpha.ebuild
new file mode 100644
index 000000000000..94a68de5bee0
--- /dev/null
+++ b/net-misc/tor/tor-0.2.7.2_alpha.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils flag-o-matic readme.gentoo systemd toolchain-funcs versionator user
+
+MY_PV="$(replace_version_separator 4 -)"
+MY_PF="${PN}-${MY_PV}"
+DESCRIPTION="Anonymizing overlay network for TCP"
+HOMEPAGE="http://www.torproject.org/"
+SRC_URI="https://www.torproject.org/dist/${MY_PF}.tar.gz
+ https://archive.torproject.org/tor-package-archive/${MY_PF}.tar.gz"
+S="${WORKDIR}/${MY_PF}"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="-bufferevents nat-pmp scrypt seccomp selinux stats systemd tor-hardening transparent-proxy test upnp web"
+
+DEPEND="dev-libs/openssl:=
+ sys-libs/zlib
+ dev-libs/libevent
+ bufferevents? ( dev-libs/libevent[ssl] )
+ nat-pmp? ( net-libs/libnatpmp )
+ scrypt? ( app-crypt/libscrypt )
+ seccomp? ( sys-libs/libseccomp )
+ systemd? ( sys-apps/systemd )
+ upnp? ( net-libs/miniupnpc )"
+RDEPEND="${DEPEND}
+ selinux? ( sec-policy/selinux-tor )"
+
+pkg_setup() {
+ enewgroup tor
+ enewuser tor -1 -1 /var/lib/tor tor
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.2.3.14_alpha-torrc.sample.patch
+ epatch_user
+}
+
+src_configure() {
+ # Upstream isn't sure of all the user provided CFLAGS that
+ # will break tor, but does recommend against -fstrict-aliasing.
+ # We'll filter-flags them here as we encounter them.
+ filter-flags -fstrict-aliasing
+
+ econf \
+ --enable-system-torrc \
+ --enable-asciidoc \
+ --docdir=/usr/share/doc/${PF} \
+ $(use_enable stats instrument-downloads) \
+ $(use_enable bufferevents) \
+ $(use_enable nat-pmp) \
+ $(use_enable scrypt libscrypt) \
+ $(use_enable seccomp) \
+ $(use_enable systemd) \
+ $(use_enable tor-hardening gcc-hardening) \
+ $(use_enable tor-hardening linker-hardening) \
+ $(use_enable transparent-proxy transparent) \
+ $(use_enable upnp) \
+ $(use_enable web tor2web-mode) \
+ $(use_enable test unittests) \
+ $(use_enable test coverage)
+}
+
+src_install() {
+ readme.gentoo_create_doc
+
+ newconfd "${FILESDIR}"/tor.confd tor
+ newinitd "${FILESDIR}"/tor.initd-r7 tor
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_dotmpfilesd "${FILESDIR}/${PN}.conf"
+
+ emake DESTDIR="${D}" install
+
+ keepdir /var/lib/tor
+
+ dodoc README ChangeLog ReleaseNotes doc/HACKING
+
+ fperms 750 /var/lib/tor
+ fowners tor:tor /var/lib/tor
+
+ insinto /etc/tor/
+ newins "${FILESDIR}"/torrc-r1 torrc
+}
+
+pkg_postinst() {
+ readme.gentoo_pkg_postinst
+
+ if [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -eq 8 && $(gcc-micro-version) -ge 1 ]] ; then
+ ewarn "Due to a bug in >=gcc-4.8.1, compiling ${P} with -Os leads to an infinite"
+ ewarn "loop. See:"
+ ewarn
+ ewarn " https://trac.torproject.org/projects/tor/ticket/10259"
+ ewarn " http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59358"
+ ewarn
+ fi
+}