1 |
|
# Copyright 1999-2020 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
# Re dlz/mysql and threads, needs to be verified..
|
... | ... | |
10 |
10 |
# Because of this BIND MUST only run with a single thread when
|
11 |
11 |
# using the MySQL driver.
|
12 |
12 |
|
13 |
|
EAPI=7
|
|
13 |
EAPI=8
|
14 |
14 |
|
15 |
|
PYTHON_COMPAT=( python3_{6..9} )
|
|
15 |
PYTHON_COMPAT=( python3_{9..11} )
|
16 |
16 |
|
17 |
|
inherit python-r1 eutils autotools toolchain-funcs flag-o-matic multilib db-use systemd
|
|
17 |
inherit python-r1 autotools multiprocessing toolchain-funcs flag-o-matic db-use systemd tmpfiles
|
18 |
18 |
|
19 |
19 |
MY_PV="${PV/_p/-P}"
|
20 |
20 |
MY_PV="${MY_PV/_rc/rc}"
|
... | ... | |
27 |
27 |
# SDB-LDAP: http://bind9-ldap.bayour.com/
|
28 |
28 |
|
29 |
29 |
DESCRIPTION="Berkeley Internet Name Domain - Name Server"
|
30 |
|
HOMEPAGE="https://www.isc.org/software/bind"
|
|
30 |
HOMEPAGE="https://www.isc.org/software/bind https://gitlab.isc.org/isc-projects/bind9"
|
31 |
31 |
SRC_URI="https://downloads.isc.org/isc/bind9/${PV}/${P}.tar.xz
|
32 |
32 |
doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
|
33 |
33 |
|
34 |
34 |
LICENSE="Apache-2.0 BSD BSD-2 GPL-2 HPND ISC MPL-2.0"
|
35 |
35 |
SLOT="0"
|
36 |
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux"
|
37 |
|
# -berkdb by default re bug 602682
|
38 |
|
IUSE="-berkdb +caps dlz dnstap doc dnsrps fixed-rrset geoip geoip2 gssapi
|
39 |
|
json ldap libressl lmdb mysql odbc postgres python selinux static-libs
|
40 |
|
urandom xml +zlib sdb-ldap"
|
|
36 |
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
|
|
37 |
# -berkdb by default re bug #602682
|
|
38 |
IUSE="berkdb +caps +dlz dnstap doc dnsrps fixed-rrset geoip geoip2 gssapi
|
|
39 |
json ldap lmdb mysql odbc postgres python selinux static-libs test xml +zlib"
|
41 |
40 |
# sdb-ldap - patch broken
|
42 |
41 |
# no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
|
|
42 |
RESTRICT="!test? ( test )"
|
43 |
43 |
|
|
44 |
# Upstream dropped the old geoip library, but the BIND configuration for using
|
|
45 |
# GeoIP remained the same.
|
44 |
46 |
REQUIRED_USE="
|
45 |
|
?? ( geoip geoip2 )
|
46 |
47 |
postgres? ( dlz )
|
47 |
48 |
berkdb? ( dlz )
|
48 |
49 |
mysql? ( dlz )
|
... | ... | |
50 |
51 |
ldap? ( dlz )
|
51 |
52 |
dnsrps? ( dlz )
|
52 |
53 |
python? ( ${PYTHON_REQUIRED_USE} )
|
53 |
|
sdb-ldap? ( dlz )
|
54 |
54 |
"
|
55 |
55 |
|
56 |
56 |
DEPEND="
|
57 |
57 |
acct-group/named
|
58 |
58 |
acct-user/named
|
59 |
|
!libressl? ( dev-libs/openssl:=[-bindist] )
|
60 |
|
libressl? ( dev-libs/libressl:= )
|
|
59 |
berkdb? ( sys-libs/db:= )
|
|
60 |
dev-libs/openssl:=[-bindist(-)]
|
61 |
61 |
mysql? ( dev-db/mysql-connector-c:0= )
|
62 |
62 |
odbc? ( >=dev-db/unixODBC-2.2.6 )
|
63 |
|
ldap? ( net-nds/openldap )
|
|
63 |
ldap? ( net-nds/openldap:= )
|
64 |
64 |
postgres? ( dev-db/postgresql:= )
|
65 |
65 |
caps? ( >=sys-libs/libcap-2.1.0 )
|
66 |
66 |
xml? ( dev-libs/libxml2 )
|
67 |
|
geoip? ( >=dev-libs/geoip-1.4.6 )
|
68 |
|
geoip2? ( dev-libs/libmaxminddb )
|
|
67 |
geoip? ( dev-libs/libmaxminddb:= )
|
|
68 |
geoip2? ( dev-libs/libmaxminddb:= )
|
69 |
69 |
gssapi? ( virtual/krb5 )
|
70 |
70 |
json? ( dev-libs/json-c:= )
|
71 |
|
lmdb? ( dev-db/lmdb )
|
|
71 |
lmdb? ( dev-db/lmdb:= )
|
72 |
72 |
zlib? ( sys-libs/zlib )
|
73 |
|
dnstap? ( dev-libs/fstrm dev-libs/protobuf-c )
|
|
73 |
dnstap? ( dev-libs/fstrm dev-libs/protobuf-c:= )
|
74 |
74 |
python? (
|
75 |
75 |
${PYTHON_DEPS}
|
76 |
76 |
dev-python/ply[${PYTHON_USEDEP}]
|
77 |
77 |
)
|
78 |
78 |
dev-libs/libuv:=
|
79 |
|
sdb-ldap? ( net-nds/openldap )
|
80 |
79 |
"
|
81 |
80 |
|
82 |
81 |
RDEPEND="${DEPEND}
|
83 |
82 |
selinux? ( sec-policy/selinux-bind )
|
84 |
83 |
sys-process/psmisc"
|
85 |
84 |
|
|
85 |
BDEPEND="
|
|
86 |
test? (
|
|
87 |
dev-util/cmocka
|
|
88 |
dev-util/kyua
|
|
89 |
)
|
|
90 |
"
|
|
91 |
|
86 |
92 |
S="${WORKDIR}/${MY_P}"
|
87 |
93 |
|
88 |
|
# bug 479092, requires networking
|
89 |
|
# bug 710840, cmocka fails LDFLAGS='-Wl,-O1'
|
90 |
|
#RESTRICT="test"
|
|
94 |
PATCHES=(
|
|
95 |
"${FILESDIR}/ldap-library-path-on-multilib-machines.patch"
|
|
96 |
)
|
91 |
97 |
|
92 |
98 |
src_prepare() {
|
93 |
99 |
default
|
94 |
|
export LDFLAGS="${LDFLAGS} -L${EPREFIX}/usr/$(get_libdir)"
|
95 |
100 |
|
96 |
|
if use dlz; then
|
97 |
|
# sdb-ldap patch as per bug #160567
|
98 |
|
# Upstream URL: http://bind9-ldap.bayour.com/
|
99 |
|
# New patch take from bug 302735
|
100 |
|
if use sdb-ldap; then
|
101 |
|
eapply "${FILESDIR}"/bind-9.16.6-sdb-ldap.patch
|
102 |
|
cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
|
103 |
|
cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
|
104 |
|
cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
|
105 |
|
fi
|
106 |
|
fi
|
107 |
|
|
108 |
|
# should be installed by bind-tools
|
|
101 |
# Should be installed by bind-tools
|
109 |
102 |
sed -i -r -e "s:(nsupdate|dig|delv) ::g" bin/Makefile.in || die
|
110 |
103 |
|
111 |
|
# Disable tests for now, bug 406399
|
112 |
|
sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
|
113 |
|
|
114 |
104 |
# bug #220361
|
115 |
105 |
rm aclocal.m4 || die
|
116 |
106 |
rm -rf libtool.m4/ || die
|
... | ... | |
133 |
123 |
--with-libtool
|
134 |
124 |
--enable-full-report
|
135 |
125 |
--without-readline
|
136 |
|
--with-openssl="${EPREFIX}"/usr
|
137 |
|
--without-cmocka
|
|
126 |
--with-openssl="${ESYSROOT}"/usr
|
|
127 |
$(use_with test cmocka)
|
|
128 |
# Removed in 9.17, drags in libunwind dependency too
|
|
129 |
--disable-backtrace
|
138 |
130 |
$(use_enable caps linux-caps)
|
139 |
131 |
$(use_enable dnsrps)
|
140 |
132 |
$(use_enable dnstap)
|
141 |
133 |
$(use_enable fixed-rrset)
|
142 |
|
# $(use_enable static-libs static)
|
143 |
|
$(use_with berkdb dlz-bdb)
|
|
134 |
$(use_with berkdb dlz-bdb "${ESYSROOT}"/usr)
|
144 |
135 |
$(use_with dlz dlopen)
|
145 |
136 |
$(use_with dlz dlz-filesystem)
|
146 |
137 |
$(use_with dlz dlz-stub)
|
... | ... | |
156 |
147 |
"${@}"
|
157 |
148 |
)
|
158 |
149 |
|
159 |
|
use geoip && myeconfargs+=( --enable-geoip )
|
160 |
|
use geoip2 && myeconfargs+=( --with-maxminddb )
|
|
150 |
# This is for users to start to migrate back to USE=geoip, rather than
|
|
151 |
# USE=geoip2
|
|
152 |
if use geoip ; then
|
|
153 |
myeconfargs+=( $(use_with geoip maxminddb) --enable-geoip )
|
|
154 |
elif use geoip2 ; then
|
|
155 |
# Added 2020/09/30
|
|
156 |
# Remove USE=geoip2 support after 2020/03/01
|
|
157 |
ewarn "USE=geoip2 is deprecated; update your USE flags!"
|
|
158 |
myeconfargs+=( $(use_with geoip2 maxminddb) --enable-geoip )
|
|
159 |
else
|
|
160 |
myeconfargs+=( --without-maxminddb --disable-geoip )
|
|
161 |
fi
|
161 |
162 |
|
162 |
163 |
# bug #158664
|
163 |
|
# gcc-specs-ssp && replace-flags -O[23s] -O
|
|
164 |
#gcc-specs-ssp && replace-flags -O[23s] -O
|
164 |
165 |
|
165 |
166 |
# To include db.h from proper path
|
166 |
167 |
use berkdb && append-flags "-I$(db_includedir)"
|
... | ... | |
169 |
170 |
econf "${myeconfargs[@]}"
|
170 |
171 |
|
171 |
172 |
# bug #151839
|
172 |
|
echo '#undef SO_BSDCOMPAT' >> config.h
|
|
173 |
echo '#undef SO_BSDCOMPAT' >> config.h || die
|
173 |
174 |
}
|
174 |
175 |
|
175 |
176 |
python_configure() {
|
... | ... | |
189 |
190 |
popd >/dev/null || die
|
190 |
191 |
}
|
191 |
192 |
|
|
193 |
src_test() {
|
|
194 |
# system tests ('emake test') require network configuration for IPs etc
|
|
195 |
# so we run the unit tests instead.
|
|
196 |
TEST_PARALLEL_JOBS="$(makeopts_jobs)" emake unit
|
|
197 |
}
|
|
198 |
|
192 |
199 |
src_install() {
|
193 |
200 |
default
|
194 |
201 |
|
195 |
|
# don't create /var/run
|
196 |
|
rmdir "${ED}"/var/run || die
|
197 |
|
|
198 |
202 |
dodoc CHANGES README
|
199 |
203 |
|
200 |
204 |
if use doc; then
|
... | ... | |
224 |
228 |
insinto /var/bind/pri
|
225 |
229 |
newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
|
226 |
230 |
|
227 |
|
newinitd "${FILESDIR}"/named.init-r13 named
|
|
231 |
newinitd "${FILESDIR}"/named.init-r14 named
|
228 |
232 |
newconfd "${FILESDIR}"/named.confd-r7 named
|
229 |
233 |
|
230 |
234 |
newenvd "${FILESDIR}"/10bind.env 10bind
|
... | ... | |
265 |
269 |
fperms 0770 /var/log/named /var/bind/{,sec,dyn}
|
266 |
270 |
|
267 |
271 |
systemd_newunit "${FILESDIR}/named.service-r1" named.service
|
268 |
|
systemd_dotmpfilesd "${FILESDIR}"/named.conf
|
|
272 |
dotmpfiles "${FILESDIR}"/named.conf
|
269 |
273 |
exeinto /usr/libexec
|
270 |
274 |
doexe "${FILESDIR}/generate-rndc-key.sh"
|
271 |
275 |
}
|
... | ... | |
280 |
284 |
}
|
281 |
285 |
|
282 |
286 |
pkg_postinst() {
|
283 |
|
if [ ! -f '/etc/bind/rndc.key' ]; then
|
284 |
|
if use urandom; then
|
285 |
|
einfo "Using /dev/urandom for generating rndc.key"
|
286 |
|
/usr/sbin/rndc-confgen -r /dev/urandom -a
|
287 |
|
echo
|
288 |
|
else
|
289 |
|
einfo "Using /dev/random for generating rndc.key"
|
290 |
|
/usr/sbin/rndc-confgen -a
|
291 |
|
echo
|
292 |
|
fi
|
|
287 |
tmpfiles_process named.conf
|
|
288 |
|
|
289 |
if [[ ! -f '/etc/bind/rndc.key' && ! -f '/etc/bind/rndc.conf' ]]; then
|
|
290 |
einfo "Using /dev/urandom for generating rndc.key"
|
|
291 |
/usr/sbin/rndc-confgen -a
|
293 |
292 |
chown root:named /etc/bind/rndc.key || die
|
294 |
293 |
chmod 0640 /etc/bind/rndc.key || die
|
295 |
294 |
fi
|
... | ... | |
362 |
361 |
mknod ${CHROOT}/dev/zero c 1 5 || die
|
363 |
362 |
chmod 0666 ${CHROOT}/dev/zero || die
|
364 |
363 |
|
365 |
|
if use urandom; then
|
366 |
|
mknod ${CHROOT}/dev/urandom c 1 9 || die
|
367 |
|
chmod 0666 ${CHROOT}/dev/urandom || die
|
368 |
|
else
|
369 |
|
mknod ${CHROOT}/dev/random c 1 8 || die
|
370 |
|
chmod 0666 ${CHROOT}/dev/random || die
|
371 |
|
fi
|
|
364 |
mknod ${CHROOT}/dev/urandom c 1 9 || die
|
|
365 |
chmod 0666 ${CHROOT}/dev/urandom || die
|
372 |
366 |
|
373 |
367 |
if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
|
374 |
368 |
cp -a /etc/bind ${CHROOT}/etc/ || die
|