]> Pileus Git - ~andy/sunrise/blob - net-dns/unbound/unbound-1.3.4.ebuild
net-dns/unbound: version bump for security issue, see http://cve.mitre.org/cgi-bin...
[~andy/sunrise] / net-dns / unbound / unbound-1.3.4.ebuild
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="1"
6
7 inherit eutils
8
9 DESCRIPTION="A validating, recursive and caching DNS resolver"
10 HOMEPAGE="http://unbound.net"
11 SRC_URI="http://unbound.net/downloads/${P}.tar.gz"
12
13 LICENSE="BSD"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="+chroot debug libevent python static threads"
17
18 RDEPEND="dev-libs/openssl
19         >=net-libs/ldns-1.5.1
20         libevent? ( dev-libs/libevent )"
21 DEPEND="${RDEPEND}
22         python? ( dev-lang/swig )"
23
24 pkg_setup() {
25         enewgroup unbound
26         enewuser unbound -1 -1 -1 unbound
27 }
28
29 src_compile() {
30         econf \
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 \
35                 $(use_enable debug) \
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)
43
44         emake || die "emake failed"
45 }
46
47 src_install() {
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"
51
52         dodoc doc/{README,CREDITS,TODO,Changelog,FEATURES} || die "dodoc failed"
53
54         insinto /usr/share/${PN}
55         insopts -m755
56         doins contrib/{update-anchor.sh,update-itar.sh} || die "doins failed"
57
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"
60
61         # disable chroot when requested
62         if ! use chroot; then
63                 sed -i 's:^\t# chroot\: "/etc/unbound":\tchroot\: "":g' "${D}/etc/unbound/unbound.conf" || die "sed failed"
64         fi
65 }
66
67 pkg_postinst() {
68         local key_dir="${ROOT}etc/unbound"
69
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}"
76         fi
77 }
78
79 pkg_config() {
80         local key_dir="${ROOT}etc/unbound"
81
82         ebegin "Generating SSL keys for unbound-control"
83         /usr/sbin/unbound-control-setup -d ${key_dir}
84         eend $?
85 }