]> Pileus Git - ~andy/sunrise/blob - net-misc/gvpe/gvpe-2.21.ebuild
dev-util/qshaderedit: Fix qt deps, EAPI bump
[~andy/sunrise] / net-misc / gvpe / gvpe-2.21.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="1"
6
7 inherit eutils linux-info
8
9 DESCRIPTION="GNU Virtual Private Ethernet"
10 HOMEPAGE="http://savannah.gnu.org/projects/gvpe"
11 SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="nls tcp +compression dns icmp http-proxy
17         cipher-aes-128 cipher-aes-192 +cipher-aes-256 cipher-blowfish
18         digset-sha512 digset-sha256 digset-sha1 +digset-ripemd160 digset-md5 digset-md4-insecure"
19
20 DEPEND="dev-libs/libev
21         >=dev-libs/openssl-0.9.7c
22         nls? ( sys-devel/gettext )
23         virtual/linux-sources"
24 RDEPEND=">=dev-libs/openssl-0.9.7c"
25
26 src_compile() {
27         #Since gvpe does not support more than 1 cipher and more then 1 digset
28         #here we do some not so clever checks to ensure that only one is selected
29         local myEnc
30         local encCnt=0
31         use cipher-aes-256 && myEnc="aes-256" && encCnt=$((encCnt+1))
32         use cipher-aes-192 && myEnc="aes-192" && encCnt=$((encCnt+1))
33         use cipher-aes-128 && myEnc="aes-128" && encCnt=$((encCnt+1))
34         use cipher-blowfish && myEnc="bf" && encCnt=$((encCnt+1))
35
36         if [[ $encCnt<1 ]]; then
37             eerror "An encryption alogotithm have to be selected.\nAdd one of cipher-aes-256, cipher-aes-192, cipher-aes-128 or cipher-blowfish to your USE variable."
38             die;
39         elif [[ $encCnt>1 ]]; then
40             eerror "More then one ecryption alogorithm selected.\nRemove all but one of cipher-aes-256, cipher-aes-192, cipher-aes-128 or cipher-blowfish flags from your USE variable."
41             die;
42         fi
43
44         encCnt=0
45         local myDigset
46         use digset-sha512 && myDigset="sha512" && encCnt=$((encCnt+1))
47         use digset-sha256 && myDigset="sha256" && encCnt=$((encCnt+1))
48         use digset-sha1 && myDigset="sha1" && encCnt=$((encCnt+1))
49         use digset-ripemd160 && myDigset="ripemd160" && encCnt=$((encCnt+1))
50         use digset-md5 && myDigset="md5" && encCnt=$((encCnt+1))
51         use digset-md4-insecure && myDigset="md4" && encCnt=$((encCnt+1))
52         if [[ $encCnt<1 ]]; then
53             eerror "A digset algorithm have to be selected.\nAdd one of digset-sha512, digset-sha256, digset-sha1, digset-ripemd160, digset-md5 or digset-md4-insecure to your USE variable."
54             die;
55         elif [[ $encCnt>1 ]]; then
56             eerror "More then one digset alogorithm selected.\nRemove all but one of digset-sha512, digset-sha256, digset-sha1, digset-ripemd160, digset-md5 or digset-md4-insecure flags from your USE variable."
57             die;
58         fi
59
60         #add proper support for --disable in the configure scrip
61         epatch "${FILESDIR}/configure.${P}.patch"
62
63         #the hmac and rand flags are hardcoded this is not so good because
64         #it leaves the system more predictable. But I don't think that adding
65         #24 more use flags is a good idea too.
66         econf $(use_enable nls) \
67                 $(use_enable compression) \
68                 $(use_enable dns) \
69                 $(use_enable icmp) \
70                 $(use_enable http-proxy) \
71                 $(use_enable tcp) \
72             --enable-hmac-length=16 --enable-rand-length=8 --enable-cipher=$myEnc \
73             --enable-digest=$myDigset
74         emake || die
75 }
76
77 src_install() {
78         emake DESTDIR="${D}" install || die
79         dodoc AUTHORS NEWS README TODO || die
80         newinitd "${FILESDIR}/gvpe.rc" gvpe || die
81         newconfd "${FILESDIR}/gvpe.confd" gvpe || die
82         insinto /etc/gvpe
83         doins "${FILESDIR}/gvpe.conf.example" || die
84         exeinto /etc/gvpe
85         doexe "${FILESDIR}/if-up" || die
86 }
87
88 pkg_postinst() {
89         linux_chkconfig_present TUN || ewarn "This package requires the tun/tap kernel device."
90         einfo "Edit /etc/conf.d/gvpe and /etc/gvpe/gvpe.conf"
91         ewarn "All nodes in your VPN have to use the same combination of digset and cipher!"
92 }