| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/tor-0.2.3.11_alpha.ebuild,v 1.2 2012/02/07 21:11:21 blueness Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
|
| 7 |
inherit eutils flag-o-matic versionator |
| 8 |
|
| 9 |
MY_PV="$(replace_version_separator 4 -)" |
| 10 |
MY_PF="${PN}-${MY_PV}" |
| 11 |
DESCRIPTION="Anonymizing overlay network for TCP" |
| 12 |
HOMEPAGE="http://www.torproject.org/" |
| 13 |
SRC_URI="http://www.torproject.org/dist/${MY_PF}.tar.gz" |
| 14 |
S="${WORKDIR}/${MY_PF}" |
| 15 |
|
| 16 |
LICENSE="BSD" |
| 17 |
SLOT="0" |
| 18 |
KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" |
| 19 |
IUSE="+bufferevents doc nat-pmp tor-hardening transparent-proxy threads upnp selinux" |
| 20 |
|
| 21 |
DEPEND="dev-libs/openssl |
| 22 |
>=dev-libs/libevent-2.0.14 |
| 23 |
nat-pmp? ( net-libs/libnatpmp ) |
| 24 |
upnp? ( <net-libs/miniupnpc-1.6 ) |
| 25 |
selinux? ( sec-policy/selinux-tor )" |
| 26 |
RDEPEND="${DEPEND}" |
| 27 |
|
| 28 |
pkg_setup() { |
| 29 |
enewgroup tor |
| 30 |
enewuser tor -1 -1 /var/lib/tor tor |
| 31 |
} |
| 32 |
|
| 33 |
src_prepare() { |
| 34 |
epatch "${FILESDIR}"/torrc.sample.patch |
| 35 |
epatch "${FILESDIR}"/${P}-fix-tor-fw-helper-natpmp.patch |
| 36 |
} |
| 37 |
|
| 38 |
src_configure() { |
| 39 |
# Upstream isn't sure of all the user provided CFLAGS that |
| 40 |
# will break tor, but does recommend against -fstrict-aliasing. |
| 41 |
# We'll filter-flags them here as we encounter them. |
| 42 |
filter-flags -fstrict-aliasing |
| 43 |
econf --docdir=/usr/share/doc/${PF} \ |
| 44 |
$(use_enable bufferevents) \ |
| 45 |
$(use_enable doc asciidoc) \ |
| 46 |
$(use_enable nat-pmp) \ |
| 47 |
$(use_enable tor-hardening gcc-hardening) \ |
| 48 |
$(use_enable tor-hardening linker-hardening) \ |
| 49 |
$(use_enable transparent-proxy transparent) \ |
| 50 |
$(use_enable threads) \ |
| 51 |
$(use_enable upnp) |
| 52 |
} |
| 53 |
|
| 54 |
src_install() { |
| 55 |
newconfd "${FILESDIR}"/tor.confd tor |
| 56 |
newinitd "${FILESDIR}"/tor.initd-r6 tor |
| 57 |
emake DESTDIR="${D}" install |
| 58 |
keepdir /var/lib/tor |
| 59 |
|
| 60 |
dodoc README ChangeLog ReleaseNotes \ |
| 61 |
doc/{HACKING,TODO} \ |
| 62 |
doc/spec/README |
| 63 |
|
| 64 |
fperms 750 /var/lib/tor |
| 65 |
fowners tor:tor /var/lib/tor |
| 66 |
|
| 67 |
insinto /etc/tor/ |
| 68 |
newins "${FILESDIR}"/torrc-r1 torrc |
| 69 |
} |
| 70 |
|
| 71 |
pkg_postinst() { |
| 72 |
elog |
| 73 |
elog "We created a configuration file for tor, /etc/tor/torrc, but you can" |
| 74 |
elog "change it according to your needs. Use the torrc.sample that is in" |
| 75 |
elog "that directory as a guide. Also, to have privoxy work with tor" |
| 76 |
elog "just add the following line" |
| 77 |
elog |
| 78 |
elog "forward-socks4a / localhost:9050 ." |
| 79 |
elog |
| 80 |
elog "to /etc/privoxy/config. Notice the . at the end!" |
| 81 |
elog |
| 82 |
} |