Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/unbound/
Date: Thu, 30 May 2019 14:05:05
Message-Id: 1559225077.a392042fb5e0faa4bcbbe297e0b59e4de3aa0359.whissi@gentoo
1 commit: a392042fb5e0faa4bcbbe297e0b59e4de3aa0359
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 30 14:03:55 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu May 30 14:04:37 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a392042f
7
8 net-dns/unbound: install unbound-event.h
9
10 Closes: https://bugs.gentoo.org/687010
11 Package-Manager: Portage-2.3.67, Repoman-2.3.13
12 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
13
14 net-dns/unbound/unbound-1.9.1-r1.ebuild | 182 ++++++++++++++++++++++++++++++++
15 1 file changed, 182 insertions(+)
16
17 diff --git a/net-dns/unbound/unbound-1.9.1-r1.ebuild b/net-dns/unbound/unbound-1.9.1-r1.ebuild
18 new file mode 100644
19 index 00000000000..e4d1ceae7af
20 --- /dev/null
21 +++ b/net-dns/unbound/unbound-1.9.1-r1.ebuild
22 @@ -0,0 +1,182 @@
23 +# Copyright 1999-2019 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI="7"
27 +PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
28 +
29 +inherit autotools flag-o-matic multilib-minimal python-single-r1 systemd user
30 +
31 +MY_P=${PN}-${PV/_/}
32 +DESCRIPTION="A validating, recursive and caching DNS resolver"
33 +HOMEPAGE="https://unbound.net/ https://nlnetlabs.nl/projects/unbound/about/"
34 +SRC_URI="https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz"
35 +
36 +LICENSE="BSD GPL-2"
37 +SLOT="0/8" # ABI version of libunbound.so
38 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~x86"
39 +IUSE="debug dnscrypt dnstap +ecdsa ecs gost libressl python redis selinux static-libs systemd test threads"
40 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
41 +
42 +# Note: expat is needed by executable only but the Makefile is custom
43 +# and doesn't make it possible to easily install the library without
44 +# the executables. MULTILIB_USEDEP may be dropped once build system
45 +# is fixed.
46 +
47 +CDEPEND=">=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}]
48 + >=dev-libs/libevent-2.0.21:0=[${MULTILIB_USEDEP}]
49 + libressl? ( >=dev-libs/libressl-2.2.4:0[${MULTILIB_USEDEP}] )
50 + !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
51 + dnscrypt? ( dev-libs/libsodium[${MULTILIB_USEDEP}] )
52 + dnstap? (
53 + dev-libs/fstrm[${MULTILIB_USEDEP}]
54 + >=dev-libs/protobuf-c-1.0.2-r1[${MULTILIB_USEDEP}]
55 + )
56 + ecdsa? (
57 + !libressl? ( dev-libs/openssl:0[-bindist] )
58 + )
59 + python? ( ${PYTHON_DEPS} )
60 + redis? ( dev-libs/hiredis:= )"
61 +
62 +BDEPEND="virtual/pkgconfig"
63 +
64 +DEPEND="${CDEPEND}
65 + python? ( dev-lang/swig )
66 + test? (
67 + net-dns/ldns-utils[examples]
68 + dev-util/splint
69 + app-text/wdiff
70 + )
71 + systemd? ( sys-apps/systemd )"
72 +
73 +RDEPEND="${CDEPEND}
74 + net-dns/dnssec-root
75 + selinux? ( sec-policy/selinux-bind )"
76 +
77 +# bug #347415
78 +RDEPEND="${RDEPEND}
79 + net-dns/dnssec-root"
80 +
81 +PATCHES=(
82 + "${FILESDIR}"/${PN}-1.5.7-trust-anchor-file.patch
83 + "${FILESDIR}"/${PN}-1.6.3-pkg-config.patch
84 +)
85 +
86 +S=${WORKDIR}/${MY_P}
87 +
88 +pkg_setup() {
89 + enewgroup unbound
90 + enewuser unbound -1 -1 /etc/unbound unbound
91 + # improve security on existing installs (bug #641042)
92 + # as well as new installs where unbound homedir has just been created
93 + if [[ -d "${ROOT}/etc/unbound" ]]; then
94 + chown --no-dereference --from=unbound root "${ROOT}/etc/unbound"
95 + fi
96 +
97 + use python && python-single-r1_pkg_setup
98 +}
99 +
100 +src_prepare() {
101 + default
102 +
103 + eautoreconf
104 +
105 + # required for the python part
106 + multilib_copy_sources
107 +}
108 +
109 +src_configure() {
110 + [[ ${CHOST} == *-darwin* ]] || append-ldflags -Wl,-z,noexecstack
111 + multilib-minimal_src_configure
112 +}
113 +
114 +multilib_src_configure() {
115 + econf \
116 + $(use_enable debug) \
117 + $(use_enable gost) \
118 + $(use_enable dnscrypt) \
119 + $(use_enable dnstap) \
120 + $(use_enable ecdsa) \
121 + $(use_enable ecs subnet) \
122 + $(multilib_native_use_enable redis cachedb) \
123 + $(use_enable static-libs static) \
124 + $(use_enable systemd) \
125 + $(multilib_native_use_with python pythonmodule) \
126 + $(multilib_native_use_with python pyunbound) \
127 + $(use_with threads pthreads) \
128 + --disable-flto \
129 + --disable-rpath \
130 + --enable-event-api \
131 + --enable-ipsecmod \
132 + --enable-tfo-client \
133 + --enable-tfo-server \
134 + --with-libevent="${EPREFIX%/}"/usr \
135 + $(multilib_native_usex redis --with-libhiredis="${EPREFIX%/}/usr" --without-libhiredis) \
136 + --with-pidfile="${EPREFIX%/}"/run/unbound.pid \
137 + --with-rootkey-file="${EPREFIX%/}"/etc/dnssec/root-anchors.txt \
138 + --with-ssl="${EPREFIX%/}"/usr \
139 + --with-libexpat="${EPREFIX%/}"/usr
140 +
141 + # http://unbound.nlnetlabs.nl/pipermail/unbound-users/2011-April/001801.html
142 + # $(use_enable debug lock-checks) \
143 + # $(use_enable debug alloc-checks) \
144 + # $(use_enable debug alloc-lite) \
145 + # $(use_enable debug alloc-nonregional) \
146 +}
147 +
148 +multilib_src_install_all() {
149 + use python && python_optimize
150 +
151 + newinitd "${FILESDIR}"/unbound-r1.initd unbound
152 + newconfd "${FILESDIR}"/unbound-r1.confd unbound
153 +
154 + systemd_dounit "${FILESDIR}"/unbound.service
155 + systemd_dounit "${FILESDIR}"/unbound.socket
156 + systemd_newunit "${FILESDIR}"/unbound_at.service "unbound@.service"
157 + systemd_dounit "${FILESDIR}"/unbound-anchor.service
158 +
159 + dodoc doc/{README,CREDITS,TODO,Changelog,FEATURES}
160 +
161 + # bug #315519
162 + dodoc contrib/unbound_munin_
163 +
164 + docinto selinux
165 + dodoc contrib/selinux/*
166 +
167 + exeinto /usr/share/${PN}
168 + doexe contrib/update-anchor.sh
169 +
170 + # create space for auto-trust-anchor-file...
171 + keepdir /etc/unbound/var
172 + # ... and point example config to it
173 + sed -i \
174 + -e '/# auto-trust-anchor-file:/s,/etc/dnssec/root-anchors.txt,/etc/unbound/var/root-anchors.txt,' \
175 + "${ED%/}/etc/unbound/unbound.conf" || \
176 + die
177 +
178 + # Used to store cache data
179 + keepdir /var/lib/${PN}
180 + fowners root:unbound /var/lib/${PN}
181 + fperms 0750 /var/lib/${PN}
182 +
183 + find "${ED}" -name '*.la' -delete || die
184 + if ! use static-libs ; then
185 + find "${ED}" -name "*.a" -delete || die
186 + fi
187 +}
188 +
189 +pkg_postinst() {
190 + # make var/ writable by unbound
191 + if [[ -d "${EROOT%/}/etc/unbound/var" ]]; then
192 + chown --no-dereference --from=root unbound: "${EROOT%/}/etc/unbound/var"
193 + fi
194 +
195 + einfo ""
196 + einfo "If you want unbound to automatically update the root-anchor file for DNSSEC validation"
197 + einfo "set 'auto-trust-anchor-file: ${EROOT%/}/etc/unbound/var/root-anchors.txt' in ${EROOT%/}/etc/unbound/unbound.conf"
198 + einfo "and run"
199 + einfo ""
200 + einfo " su -s /bin/sh -c '${EROOT%/}/usr/sbin/unbound-anchor -a ${EROOT%/}/etc/unbound/var/root-anchors.txt' unbound"
201 + einfo ""
202 + einfo "as root to create it initially before starting unbound for the first time after enabling this."
203 + einfo ""
204 +}