summaryrefslogtreecommitdiff
blob: a59f72e99d8f55c255d30023d924d5783b6875f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils

DESCRIPTION="Unbound is a validating, recursive and caching DNS resolver."
HOMEPAGE="http://unbound.net"
SRC_URI="http://unbound.net/downloads/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug libevent static threads"

RDEPEND="dev-libs/openssl
		net-libs/ldns
		libevent? ( dev-libs/libevent )"
DEPEND="${RDEPEND}"

pkg_setup() {
	enewgroup unbound
	enewuser unbound -1 -1 -1 unbound
}

src_compile() {
	econf \
		--with-conf-file=/etc/unbound/unbound.conf \
		--with-pidfile=/var/run/unbound.pid \
		--with-run-dir=/etc/unbound \
		--with-username=unbound \
		$(use_enable debug) \
		$(use_enable debug lock-checks) \
		$(use_enable debug alloc-checks) \
		$(use_enable static static-exe) \
		$(use_with libevent) \
		$(use_with threads pthreads)

	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	newinitd "${FILESDIR}/unbound.initd" unbound || die "newinitd failed"
	newconfd "${FILESDIR}/unbound.confd" unbound || die "newconfd failed"

	dodoc doc/README doc/CREDITS doc/TODO doc/Changelog doc/FEATURES || die "dodoc failed"
	dodoc "${FILESDIR}/chroot_howto.txt" || die "dodoc failed"

	# adapt config file to disable the chroot
	sed -i '/^\t# chroot:/a\\tchroot: ""' "$D/etc/unbound/unbound.conf" || die "sed failed"
}

pkg_postinst() {
	elog "The gentoo configuration does not enable a chroot environment,"
	elog "this differs from the default upstream configuration."
	elog "To use a chroot enviroment, please read:"
	elog "/usr/share/doc/${PF}/chroot_howto.txt.bz2"
}