1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 DESCRIPTION="A validating, recursive and caching DNS resolver"
10 HOMEPAGE="http://unbound.net"
11 SRC_URI="http://unbound.net/downloads/${P}.tar.gz"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="+chroot debug libevent python static threads"
18 RDEPEND="dev-libs/openssl
20 libevent? ( dev-libs/libevent )"
22 python? ( dev-lang/swig )"
26 enewuser unbound -1 -1 -1 unbound
31 --with-conf-file=/etc/unbound/unbound.conf \
32 --with-pidfile=/var/run/unbound.pid \
33 --with-run-dir=/etc/unbound \
34 --with-username=unbound \
36 $(use_enable debug lock-checks) \
37 $(use_enable debug alloc-checks) \
38 $(use_enable static static-exe) \
39 $(use_with libevent) \
40 $(use_with threads pthreads) \
41 $(use_with python pyunbound) \
42 $(use_with python pythonmodule)
44 emake || die "emake failed"
48 emake DESTDIR="${D}" install || die "emake install failed"
49 newinitd "${FILESDIR}/unbound.initd" unbound || die "newinitd failed"
50 newconfd "${FILESDIR}/unbound.confd" unbound || die "newconfd failed"
52 dodoc doc/{README,CREDITS,TODO,Changelog,FEATURES} || die "dodoc failed"
54 insinto /usr/share/${PN}
56 doins contrib/{update-anchor.sh,update-itar.sh} || die "doins failed"
58 # enable remote control for our rc script
59 sed -i 's:^\t# control-enable\: no:\tcontrol-enable\: yes:g' "${D}/etc/unbound/unbound.conf" || die "sed failed"
61 # disable chroot when requested
63 sed -i 's:^\t# chroot\: "/etc/unbound":\tchroot\: "":g' "${D}/etc/unbound/unbound.conf" || die "sed failed"
68 local key_dir="${ROOT}etc/unbound"
70 # unbound-control-setup tests for *.key existance, so copy that behaviour
71 if ! test -f ${key_dir}/unbound_server.key && ! test -f ${key_dir}/unbound_control.key; then
72 ewarn "Since unbound-1.3.0, we use a new initd script based on unbound-contol."
73 ewarn "The initd script needs SSL keys. To generate these, please run the"
74 ewarn "following command before (re)starting Unbound:"
75 ewarn "emerge --config =${PF}"
80 local key_dir="${ROOT}etc/unbound"
82 ebegin "Generating SSL keys for unbound-control"
83 /usr/sbin/unbound-control-setup -d ${key_dir}