1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI="8"
|
5 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
|
4 |
EAPI=8
|
6 |
5 |
|
|
6 |
PYTHON_COMPAT=( python3_{10..11} )
|
|
7 |
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/unbound.net.asc
|
7 |
8 |
inherit autotools flag-o-matic multilib-minimal python-single-r1 systemd verify-sig
|
8 |
9 |
|
9 |
10 |
MY_P=${PN}-${PV/_/}
|
10 |
11 |
DESCRIPTION="A validating, recursive and caching DNS resolver"
|
11 |
12 |
HOMEPAGE="https://unbound.net/ https://nlnetlabs.nl/projects/unbound/about/"
|
12 |
|
SRC_URI="https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz
|
13 |
|
verify-sig? ( https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz.asc )"
|
14 |
|
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/unbound.net.asc
|
|
13 |
SRC_URI="
|
|
14 |
https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz
|
|
15 |
verify-sig? ( https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz.asc )
|
|
16 |
"
|
|
17 |
S="${WORKDIR}"/${MY_P}
|
15 |
18 |
|
16 |
19 |
LICENSE="BSD GPL-2"
|
17 |
20 |
SLOT="0/8" # ABI version of libunbound.so
|
18 |
|
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~x86"
|
|
21 |
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~mips ~ppc ppc64 ~riscv x86"
|
19 |
22 |
IUSE="debug dnscrypt dnstap +ecdsa ecs gost +http2 python redis selinux static-libs systemd test +tfo threads"
|
20 |
23 |
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
|
21 |
24 |
RESTRICT="!test? ( test )"
|
... | ... | |
24 |
27 |
# and doesn't make it possible to easily install the library without
|
25 |
28 |
# the executables. MULTILIB_USEDEP may be dropped once build system
|
26 |
29 |
# is fixed.
|
27 |
|
|
28 |
|
CDEPEND="acct-group/unbound
|
|
30 |
DEPEND="
|
|
31 |
acct-group/unbound
|
29 |
32 |
acct-user/unbound
|
30 |
33 |
>=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}]
|
31 |
34 |
>=dev-libs/libevent-2.0.21:0=[${MULTILIB_USEDEP}]
|
... | ... | |
43 |
46 |
redis? ( dev-libs/hiredis:= )
|
44 |
47 |
systemd? ( sys-apps/systemd )
|
45 |
48 |
"
|
46 |
|
|
47 |
|
BDEPEND="virtual/pkgconfig
|
|
49 |
BDEPEND="
|
|
50 |
virtual/pkgconfig
|
48 |
51 |
python? ( dev-lang/swig )
|
49 |
52 |
test? (
|
50 |
53 |
net-libs/ldns[examples(-)]
|
... | ... | |
53 |
56 |
)
|
54 |
57 |
verify-sig? ( sec-keys/openpgp-keys-unbound )
|
55 |
58 |
"
|
56 |
|
|
57 |
|
DEPEND="${CDEPEND}"
|
58 |
|
|
59 |
|
RDEPEND="${CDEPEND}
|
|
59 |
RDEPEND="
|
|
60 |
${DEPEND}
|
60 |
61 |
net-dns/dnssec-root
|
61 |
|
selinux? ( sec-policy/selinux-bind )"
|
62 |
|
|
63 |
|
# bug #347415
|
64 |
|
RDEPEND="${RDEPEND}
|
65 |
|
net-dns/dnssec-root"
|
|
62 |
selinux? ( sec-policy/selinux-bind )
|
|
63 |
"
|
66 |
64 |
|
67 |
65 |
PATCHES=(
|
68 |
66 |
"${FILESDIR}"/${PN}-1.5.7-trust-anchor-file.patch
|
... | ... | |
70 |
68 |
"${FILESDIR}"/${PN}-1.10.1-find-ar.patch
|
71 |
69 |
)
|
72 |
70 |
|
73 |
|
S=${WORKDIR}/${MY_P}
|
74 |
|
|
75 |
71 |
pkg_setup() {
|
76 |
72 |
use python && python-single-r1_pkg_setup
|
77 |
73 |
}
|
... | ... | |
81 |
77 |
|
82 |
78 |
eautoreconf
|
83 |
79 |
|
84 |
|
# required for the python part
|
|
80 |
# Required for the python part
|
85 |
81 |
multilib_copy_sources
|
86 |
82 |
}
|
87 |
83 |
|
... | ... | |
91 |
87 |
}
|
92 |
88 |
|
93 |
89 |
multilib_src_configure() {
|
94 |
|
econf \
|
95 |
|
$(multilib_native_use_enable debug) \
|
96 |
|
$(multilib_native_use_enable gost) \
|
97 |
|
$(multilib_native_use_enable dnscrypt) \
|
98 |
|
$(multilib_native_use_enable dnstap) \
|
99 |
|
$(multilib_native_use_enable ecdsa) \
|
100 |
|
$(multilib_native_use_enable ecs subnet) \
|
101 |
|
$(multilib_native_use_enable redis cachedb) \
|
102 |
|
$(multilib_native_use_enable static-libs static) \
|
103 |
|
$(multilib_native_use_enable systemd) \
|
104 |
|
$(multilib_native_use_with python pythonmodule) \
|
105 |
|
$(multilib_native_use_with python pyunbound) \
|
106 |
|
$(multilib_native_use_with threads pthreads) \
|
107 |
|
$(multilib_native_use_with http2 libnghttp2) \
|
108 |
|
$(multilib_native_use_enable tfo tfo-client) \
|
109 |
|
$(multilib_native_use_enable tfo tfo-server) \
|
110 |
|
--disable-flto \
|
111 |
|
--disable-rpath \
|
112 |
|
--enable-event-api \
|
113 |
|
--enable-ipsecmod \
|
114 |
|
--with-libevent="${ESYSROOT}"/usr \
|
115 |
|
$(multilib_native_usex redis --with-libhiredis="${ESYSROOT}/usr" --without-libhiredis) \
|
116 |
|
--with-pidfile="${EPREFIX}"/run/unbound.pid \
|
117 |
|
--with-rootkey-file="${EPREFIX}"/etc/dnssec/root-anchors.txt \
|
118 |
|
--with-ssl="${ESYSROOT}"/usr \
|
|
90 |
local myeconfargs=(
|
|
91 |
$(multilib_native_use_enable debug)
|
|
92 |
$(multilib_native_use_enable gost)
|
|
93 |
$(multilib_native_use_enable dnscrypt)
|
|
94 |
$(multilib_native_use_enable dnstap)
|
|
95 |
$(multilib_native_use_enable ecdsa)
|
|
96 |
$(multilib_native_use_enable ecs subnet)
|
|
97 |
$(multilib_native_use_enable redis cachedb)
|
|
98 |
$(multilib_native_use_enable static-libs static)
|
|
99 |
$(multilib_native_use_enable systemd)
|
|
100 |
$(multilib_native_use_with python pythonmodule)
|
|
101 |
$(multilib_native_use_with python pyunbound)
|
|
102 |
$(multilib_native_use_with threads pthreads)
|
|
103 |
$(multilib_native_use_with http2 libnghttp2)
|
|
104 |
$(multilib_native_use_enable tfo tfo-client)
|
|
105 |
$(multilib_native_use_enable tfo tfo-server)
|
|
106 |
|
|
107 |
--disable-flto
|
|
108 |
--disable-rpath
|
|
109 |
--enable-event-api
|
|
110 |
--enable-ipsecmod
|
|
111 |
|
|
112 |
--with-libevent="${ESYSROOT}"/usr
|
|
113 |
$(multilib_native_usex redis --with-libhiredis="${ESYSROOT}/usr" --without-libhiredis)
|
|
114 |
|
|
115 |
--with-pidfile="${EPREFIX}"/run/unbound.pid
|
|
116 |
--with-rootkey-file="${EPREFIX}"/etc/dnssec/root-anchors.txt
|
|
117 |
--with-ssl="${ESYSROOT}"/usr
|
119 |
118 |
--with-libexpat="${ESYSROOT}"/usr
|
120 |
119 |
|
121 |
120 |
# http://unbound.nlnetlabs.nl/pipermail/unbound-users/2011-April/001801.html
|
122 |
|
# $(use_enable debug lock-checks) \
|
123 |
|
# $(use_enable debug alloc-checks) \
|
124 |
|
# $(use_enable debug alloc-lite) \
|
125 |
|
# $(use_enable debug alloc-nonregional) \
|
|
121 |
# $(use_enable debug lock-checks)
|
|
122 |
# $(use_enable debug alloc-checks)
|
|
123 |
# $(use_enable debug alloc-lite)
|
|
124 |
# $(use_enable debug alloc-nonregional)
|
|
125 |
)
|
|
126 |
|
|
127 |
econf "${myeconfargs[@]}"
|
126 |
128 |
}
|
127 |
129 |
|
128 |
130 |
multilib_src_install() {
|
... | ... | |
151 |
153 |
exeinto /usr/share/${PN}
|
152 |
154 |
doexe contrib/update-anchor.sh
|
153 |
155 |
|
154 |
|
# create space for auto-trust-anchor-file...
|
|
156 |
# Create space for auto-trust-anchor-file...
|
155 |
157 |
keepdir /etc/unbound/var
|
156 |
158 |
fowners root:unbound /etc/unbound/var
|
157 |
159 |
fperms 0770 /etc/unbound/var
|
... | ... | |
173 |
175 |
}
|
174 |
176 |
|
175 |
177 |
pkg_postinst() {
|
176 |
|
if [[ ! -f "${EROOT}/etc/unbound/unbound_control.key" ]] ; then
|
|
178 |
if [[ ! -f "${EROOT}/etc/unbound/unbound_control.key" ]]; then
|
177 |
179 |
einfo "Trying to create unbound control key ..."
|
178 |
180 |
if ! unbound-control-setup &>/dev/null ; then
|
179 |
181 |
ewarn "Failed to create unbound control key!"
|
180 |
182 |
fi
|
181 |
183 |
fi
|
182 |
184 |
|
183 |
|
if [[ ! -f "${EROOT}/etc/unbound/var/root-anchors.txt" ]] ; then
|
|
185 |
if [[ ! -f "${EROOT}/etc/unbound/var/root-anchors.txt" ]]; then
|
184 |
186 |
einfo ""
|
185 |
187 |
einfo "If you want unbound to automatically update the root-anchor file for DNSSEC validation"
|
186 |
188 |
einfo "set 'auto-trust-anchor-file: ${EROOT}/etc/unbound/var/root-anchors.txt' in ${EROOT}/etc/unbound/unbound.conf"
|
... | ... | |
197 |
199 |
|
198 |
200 |
local _perm_check_testfile=$(mktemp --dry-run "${EPREFIX}"/etc/unbound/var/.pkg_postinst-perm-check.XXXXXXXXX)
|
199 |
201 |
su -s /bin/sh -c "touch ${_perm_check_testfile}" unbound &>/dev/null
|
200 |
|
if [ $? -ne 0 ] ; then
|
|
202 |
if [[ $? -ne 0 ]]; then
|
201 |
203 |
ewarn "WARNING: unbound user cannot write to \"${EPREFIX}/etc/unbound/var\"!"
|
202 |
204 |
ewarn "Run the following commands to restore default permission:"
|
203 |
205 |
ewarn ""
|