summaryrefslogtreecommitdiff
path: root/gentoo-linux/net-misc/anytun/anytun-0.3.2.ebuild
blob: 2b14c5c0908c7968c5e1f5aaada38b92c55ba759 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils

DESCRIPTION="VPN daemon using Secure Anycast Tunneling"
HOMEPAGE="http://anytun.org/"
SRC_URI="http://anytun.org/download/${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples gcrypt"

RDEPEND=">=dev-libs/boost-1.35
	gcrypt? ( dev-libs/libgcrypt )
	!gcrypt? ( dev-libs/openssl )"
DEPEND="${RDEPEND}
	app-text/asciidoc" 

S=${S}/src

src_compile() {
	local myconf
	use gcrypt || myconf=" --use-ssl-crypto"
	use examples && myconf="${myconf} --examplesdir=/usr/share/doc/${PF}/examples/etc/"
	use examples || myconf="${myconf} --no-examples"
	#econf --ebuild-compat ${myconf} || die "configure failed"
	econf ${myconf} || die "configure failed"

	einfo "Building executables"
	emake || die "make failed"

	einfo "Building manpages"
	emake manpage || die "failed building manpages"
}

src_install() {
	emake install DESTDIR=${D}
	rm -Rf ${D}/etc/init.d
	keepdir /var/run/anytun || die "failed to mkdir"
	keepdir /var/run/anytun-controld || die "failed to mkdir"
	prepallman

	newinitd "${FILESDIR}/${PN}-0.3.1.init" anytun || die "failed to copy/install initrd script"

	cd ../../
	insinto /usr/share/${P}/wireshark-lua/
	doins wireshark-lua/* || die "failed to install wireshark-lua contrib script"

	dodoc AUTHORS ChangeLog README || die "failed to install docs"
}

pkg_config() {
	[ -e "${ROOT}"/etc/anytun ] && die "${ROOT}/etc/anytun/ already present, rm -R it first"
	[ ! -d "${ROOT}"/usr/share/doc/${PF}/examples/etc/anytun ] && \
		die "can't copy example configs since examples were not installed (reemerge with USE=\"examples\")"
	cp -rv "${ROOT}"/usr/share/doc/${PF}/examples/etc/anytun "${ROOT}"/etc/ || die "failed to copy examples"
}

pkg_postinst() {
	enewgroup anytun
	enewuser anytun -1 -1 /var/run/anytun anytun
	einfo "Please refer to the README file regarding the syntax of the /etc/anytun/"
	einfo "configuration files or see examples provided with the package"
	einfo "You can use gentoo-style anytun.{VPN} initrd scripts to start "
	einfo "VPNs separately. Just symlink to the initscript, e.g.:"
	einfo "# ln -s /etc/init.d/anytun /etc/init.d/anytun.client1"
	einfo
	einfo "You can disect anytun traffic using wireshark by plugging the script"
	einfo " /usr/share/${P}/wireshark-lua/satp.lua into wireshark"
}