summaryrefslogtreecommitdiff
path: root/gentoo-linux/net-misc/anytun/anytun-0.3.1.ebuild
blob: 7f03a48234279ef3f81485766d13c9dab79e757f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: (C) Bernhard Tittelbach$

inherit eutils toolchain-funcs autotools

DESCRIPTION="Anytun is an implementation of the Secure Anycast Tunneling
Protocol, intended to provide flexible and fault tolerant VPNs"
SRC_URI="http://anytun.org/~equinox/${P}.tar.gz"
HOMEPAGE="http://anytun.org/"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~x86-fbsd"
IUSE="gcrypt doc examples"

DEPEND=">=dev-libs/boost-1.35
	gcrypt? ( dev-libs/libgcrypt )
	!gcrypt? ( >=dev-libs/openssl-0.9.6 )
	doc? ( <app-text/asciidoc-8.5.0 )" # asciidoc a2x <= 8.5.0 requires the -L switch
RDEPEND="${DEPEND}"

#pkg_setup() {
#}

src_unpack() {
	unpack ${A}
	cd "${S}/src"
	if has_version ">=dev-libs/boost-1.37"; then
		epatch "${FILESDIR}/${PN}-0.3.1-boost-mt.patch"
	fi
	#eautoreconf
}

src_compile() {
	cd "${S}/src"
	
	local myconf=""
	if use gcrypt ; then
		myconf="${myconf}"
	else
		myconf="${myconf} --use-ssl-crypto"
	fi
	#econf ${myconf} || die "configure failed"
	./configure ${myconf} || die "configure failed"

	emake || die "make failed"

	if use doc ; then
		einfo "Building manpages"
		emake manpage
	fi
}

src_install() {
	cd "${S}/src"
	dosbin anytun 
	dobin anytun-config anytun-controld anytun-showtables anytun-nosync
	
	newinitd "${FILESDIR}/${PN}-0.3.1.init" anytun

	#insinto /etc/default/
	#doins ${S}/etc/default/*

	insinto /usr/share/${P}/wireshark-lua/
	doins ${S}/wireshark-lua/*

	dodir /var/run/anytun
	keepdir /var/run/anytun
	dodir /var/run/anytun-controld
	keepdir /var/run/anytun-controld
	
	if use examples; then
		insinto /usr/share/doc/${PF}/etc-anytun-examples/
		doins -r ${S}/etc/anytun/*
	fi
	if use doc; then
		cd ${S}
		dodoc AUTHORS ChangeLog LICENSE README
		cd ${S}/src/man/
		doman anyrtpproxy.8 anytun-config.8 anytun-controld.8 anytun-showtables.8 anytun.8
		prepalldocs
	fi

}

pkg_config() {
	mkdir -p ${ROOT}/etc/anytun/
	tar xv --strip-components 3 -f ${DISTDIR}/${P}.tar.gz -C ${ROOT}/etc/anytun/ ${P}/etc/anytun
}

pkg_postinst() {
	enewgroup anytun
	enewuser anytun -1 -1 /var/run/anytun anytun

	if use examples; then	
		einfo "Example configuration files have been installed in"
		einfo " /usr/share/doc/${PF}/etc-anytun-examples/"
		einfo ""
	fi
	einfo "To install inital config files for anytun use"
	einfo "> emerge --config anytun"
	einfo ""
	einfo "Note that each VPN gets it's own directory under /etc/anytun/"
	einfo "You can either add tunnels to /etc/anytun/autostart and"
	einfo "start them using /etc/init.d/anytun"
	einfo "Or you can forget the autostart file and create"
	einfo "gentoo-style anytun.{VPN} initrd scripts for each VPN"
	einfo "e.g.> ln -s /etc/init.d/anytun /etc/init.d/anytun.client1"
	einfo ""
	einfo "Don't forget to "
	einfo "> rc-update add anytun default"
	einfo "or"
	einfo "> rc-update add anytun.client1 default"
	einfo ""
	einfo "You can disect anytun traffic using wireshark by plugging the script"
	einfo "/usr/share/${P}/wireshark-lua/satp.lua into wireshark"
}