1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 DESCRIPTION="Tiny VPN daemon using Secure Anycast Tunneling"
8 HOMEPAGE="http://anytun.org/"
9 SRC_URI="http://anytun.org/download/${P}.tar.gz"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="examples gcrypt"
16 RDEPEND="gcrypt? ( dev-libs/libgcrypt )
17 !gcrypt? ( dev-libs/openssl )"
25 use gcrypt || myconf="--use-ssl-crypto"
27 && myconf="${myconf} --examplesdir=/usr/share/doc/${PF}/examples/etc" \
28 || myconf="${myconf} --no-examples"
29 econf --ebuild-compat ${myconf}
31 einfo "Building executables"
32 emake || die "make failed"
34 einfo "Building manpages"
35 emake manpage || die "failed building manpages"
39 emake DESTDIR="${D}" install || die "make install failed"
40 rm -Rf "${D}"/etc/init.d
41 #as long as README just contains path to examples, only install it with examples
42 use examples || rm -f "${D}"/etc/${PN}/README
44 newinitd "${FILESDIR}/${PN}-0.3.3.init" ${PN} || die "failed to copy/install initrd script"
47 dodoc AUTHORS ChangeLog README || die "failed to install docs"
49 #patch any examples to use user "antun" instad of "uanytun"
50 find "${D}"/usr/share/doc/${PF}/examples/etc/ -name "config" \
51 -exec sed -i 's/\(username\|groupname\) uanytun$/\1 anytun/' {} \;
55 [ ! -d "${ROOT}"/usr/share/doc/${PF}/examples/etc/${PN} ] && \
56 die "can't copy example configs since examples were not installed (reemerge with USE='examples')"
57 for example in autostart client1 client2 client3 p2p-a p2p-b; do
58 [ -e "${ROOT}"/etc/${PN}/${example} ] && die "${ROOT}/etc/${PN}/${example} already present, rm -R it first"
60 cp -rv "${ROOT}"/usr/share/doc/${PF}/examples/etc/${PN} "${ROOT}"/etc/ || die "failed to copy examples"
65 enewuser anytun -1 -1 /var/run/ anytun
66 elog "Note that each VPN gets its own directory under /etc/${PN}/"
67 elog "(see examples provided with the package)"
68 elog "Use the following command to create gentoo-style"
69 elog "uanytun.{VPN} initrd scripts for each VPN"
70 elog "# ln -s /etc/init.d/${PN} /etc/init.d/${PN}.client1"