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

inherit eutils

DESCRIPTION="tiny 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="gcrypt? ( dev-libs/libgcrypt )
		!gcrypt? ( dev-libs/openssl )"
DEPEND="${RDEPEND}
	<app-text/asciidoc-8.5.0" # asciidoc a2x >= 8.5.0 requires an -L switch not	present in lower versions

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"
	./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc ${myconf} || die "configure failed"

	emake || die "make failed"

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

src_install() {
	#make target install-bin is buggy
	dosbin uanytun || die "failed to copy/install an executable"
	newinitd "${FILESDIR}/${PN}-0.3.1.init" uanytun || die "failed to copy/install initrd script"

	emake install-man DESTDIR="${D}" || die "failed to install manpages"

	cd ../
	dodoc AUTHORS ChangeLog README || die "failed to install docs"

	if use examples; then
		insinto /usr/share/doc/${PF}/examples/etc/
		doins -r etc/uanytun || die "failed to install examples"
	fi
}

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

pkg_postinst() {
	enewgroup uanytun
	enewuser uanytun -1 -1 /var/run/ uanytun
	einfo "Note that each VPN gets its own directory under /etc/uanytun/"
	einfo " (see examples provided with the package)"
	einfo "Use the following example to create gentoo-style"
	einfo " uanytun.{VPN} initrd scripts for each VPN"
	einfo "# ln -s /etc/init.d/uanytun /etc/init.d/uanytun.client1"
}