]> Pileus Git - ~andy/sunrise/blob - net-misc/anytun/anytun-0.3.4.ebuild
dev-db/dabo: Add ~amd64 keyword, EAPI bump
[~andy/sunrise] / net-misc / anytun / anytun-0.3.4.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 inherit user
6
7 DESCRIPTION="VPN daemon using Secure Anycast Tunneling"
8 HOMEPAGE="http://anytun.org/"
9 SRC_URI="http://anytun.org/download/${P}.tar.gz"
10
11 LICENSE="GPL-3"
12 SLOT="0"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="examples gcrypt"
15
16 RDEPEND=">=dev-libs/boost-1.35
17         gcrypt? ( dev-libs/libgcrypt )
18         !gcrypt? ( dev-libs/openssl )"
19 DEPEND="${RDEPEND}
20         app-text/asciidoc"
21
22 S=${S}/src
23
24 src_compile() {
25         local myconf
26         use gcrypt || myconf="--use-ssl-crypto"
27         use examples\
28                 && myconf="${myconf} --examplesdir=/usr/share/doc/${PF}/examples/etc" \
29                 || myconf="${myconf} --no-examples"
30         econf --ebuild-compat ${myconf}
31
32         einfo "Building executables"
33         emake || die "make failed"
34
35         einfo "Building manpages"
36         emake manpage || die "failed building manpages"
37 }
38
39 src_install() {
40         emake DESTDIR="${D}" install || die "make install failed"
41         rm -Rf "${D}"/etc/init.d
42         #as long as README just contains path to examples, only install it with examples
43         use examples || rm -f "${D}"/etc/${PN}/README
44         keepdir /var/run/anytun || die "failed to mkdir"
45         keepdir /var/run/anytun-controld || die "failed to mkdir"
46
47         newinitd "${FILESDIR}/${PN}-0.3.3.init" ${PN} || die "failed to copy/install initrd script"
48
49         cd ../
50         dodoc AUTHORS ChangeLog README || die "failed to install docs"
51
52         #forgotten in current upstream package
53         #insinto /usr/share/${P}/wireshark-lua/
54         #doins wireshark-lua/satp.lua || die "failed to install wireshark-lua contrib script"
55 }
56
57 pkg_config() {
58         [ ! -d "${ROOT}"/usr/share/doc/${PF}/examples/etc/${PN} ] && \
59                 die "can't copy example configs since examples were not installed (reemerge with USE='examples')"
60         for example in autostart server client1 client2 client3 p2p-a p2p-b; do
61                 [ -e "${ROOT}"/etc/${PN}/${example} ] && die "${ROOT}/etc/${PN}/${example} already present, rm -R it first"
62         done
63         cp -rv "${ROOT}"/usr/share/doc/${PF}/examples/etc/${PN} "${ROOT}"/etc/ || die "failed to copy examples"
64 }
65
66 pkg_postinst() {
67         enewgroup anytun
68         enewuser anytun -1 -1 /var/run/anytun anytun
69         elog "Please refer to the README file regarding the syntax of the /etc/${PN}/"
70         elog "configuration files or see examples provided with the package"
71         elog "You can use gentoo-style ${PN}.{VPN} initrd scripts to start "
72         elog "VPNs separately. Just symlink to the initscript, e.g.:"
73         elog "# ln -s /etc/init.d/${PN} /etc/init.d/${PN}.client1"
74         elog
75         elog "You can disect anytun traffic using wireshark by plugging the script"
76         elog "satp.lua into wireshark. Get it here:"
77         elog " http://svn.anytun.org/anytun-common/trunk/wireshark-lua/satp.lua"
78         #elog " /usr/share/${P}/wireshark-lua/satp.lua into wireshark"
79 }