summaryrefslogtreecommitdiff
blob: 32377a5ee6242d06cebf6b361f7e41e7e2532022 (plain)
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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/badvpn/badvpn-1.999.123-r3.ebuild,v 1.2 2012/10/17 03:31:55 phajdan.jr Exp $

EAPI=4
inherit eutils cmake-utils user

MY_P=${PN}-${PV/_rc/rc}
DESCRIPTION="Peer-to-peer VPN, NCD scripting language, tun2socks proxifier"
HOMEPAGE="http://code.google.com/p/badvpn/"
SRC_URI="http://badvpn.googlecode.com/files/${MY_P}.tar.bz2"

LICENSE="BSD"
KEYWORDS="~amd64 x86"
SLOT="0"
TARGETS="+client +ncd +server +tun2socks +udpgw"
IUSE="${TARGETS} debug"

COMMON_DEPEND="
	client? (
		dev-libs/nspr
		dev-libs/nss
		dev-libs/openssl
	)
	server? (
		dev-libs/nspr
		dev-libs/nss
		dev-libs/openssl
	)
	ncd? (
		dev-libs/openssl
	)"
RDEPEND="${COMMON_DEPEND}
	ncd? (
		net-firewall/iptables
		net-wireless/wpa_supplicant
		sys-apps/iproute2
		>=sys-fs/udev-171
	)"
DEPEND="${COMMON_DEPEND}
	virtual/pkgconfig"
# we need at least one target
REQUIRED_USE="|| ( ${TARGETS//+/} )"

S=${WORKDIR}/${MY_P}

pkg_setup() {
	enewuser ${PN}
}

src_prepare() {
	# allow user to easily apply patches
	epatch_user
}

src_configure() {
	local mycmakeargs=(
		-DBUILD_NOTHING_BY_DEFAULT=1
		$(cmake-utils_use_build client CLIENT)
		$(cmake-utils_use_build server SERVER)
		$(cmake-utils_use_build ncd NCD)
		$(cmake-utils_use_build tun2socks TUN2SOCKS)
		$(cmake-utils_use_build udpgw UDPGW)
	)

	cmake-utils_src_configure
}

src_install() {
	cmake-utils_src_install
	dodoc ChangeLog

	if use server; then
		newinitd "${FILESDIR}"/${PN}-server.init ${PN}-server
		newconfd "${FILESDIR}"/${PN}-server.conf ${PN}-server
	fi

	if use ncd; then
		newinitd "${FILESDIR}"/${PN}-ncd.init ${PN}-ncd
		newconfd "${FILESDIR}"/${PN}-ncd.conf ${PN}-ncd
	fi
}