Gentoo Archives: gentoo-commits

From: "Christian Ruppert (idl0r)" <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-dns/bind: ChangeLog bind-9.9.2_p1-r1.ebuild bind-9.8.4_p1.ebuild
Date: Thu, 28 Feb 2013 22:45:59
Message-Id: 20130228224555.540852171E@flycatcher.gentoo.org
1 idl0r 13/02/28 22:45:55
2
3 Modified: ChangeLog
4 Added: bind-9.9.2_p1-r1.ebuild bind-9.8.4_p1.ebuild
5 Log:
6 Add bind-9.8.4_p1, bug 459518. Update named.cache, bug 456396. Fix named.cache/root.cache symlink and include the real file instead of the symlink, bug 450406.
7
8 (Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key B427ABC8)
9
10 Revision Changes Path
11 1.441 net-dns/bind/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?rev=1.441&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?rev=1.441&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?r1=1.440&r2=1.441
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v
20 retrieving revision 1.440
21 retrieving revision 1.441
22 diff -u -r1.440 -r1.441
23 --- ChangeLog 21 Feb 2013 20:15:29 -0000 1.440
24 +++ ChangeLog 28 Feb 2013 22:45:55 -0000 1.441
25 @@ -1,6 +1,15 @@
26 # ChangeLog for net-dns/bind
27 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.440 2013/02/21 20:15:29 idl0r Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.441 2013/02/28 22:45:55 idl0r Exp $
30 +
31 +*bind-9.9.2_p1-r1 (28 Feb 2013)
32 +*bind-9.8.4_p1 (28 Feb 2013)
33 +
34 + 28 Feb 2013; Christian Ruppert <idl0r@g.o> +bind-9.8.4_p1.ebuild,
35 + +bind-9.9.2_p1-r1.ebuild, files/named.cache, +files/named.conf-r6:
36 + Add bind-9.8.4_p1, bug 459518. Update named.cache, bug 456396. Fix
37 + named.cache/root.cache symlink and include the real file instead of the
38 + symlink, bug 450406.
39
40 21 Feb 2013; Christian Ruppert <idl0r@g.o> -bind-9.9.1_p4.ebuild,
41 -files/bind-libxml2-2.8.x.patch:
42
43
44
45 1.1 net-dns/bind/bind-9.9.2_p1-r1.ebuild
46
47 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.9.2_p1-r1.ebuild?rev=1.1&view=markup
48 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.9.2_p1-r1.ebuild?rev=1.1&content-type=text/plain
49
50 Index: bind-9.9.2_p1-r1.ebuild
51 ===================================================================
52 # Copyright 1999-2013 Gentoo Foundation
53 # Distributed under the terms of the GNU General Public License v2
54 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.9.2_p1-r1.ebuild,v 1.1 2013/02/28 22:45:55 idl0r Exp $
55
56 # Re dlz/mysql and threads, needs to be verified..
57 # MySQL uses thread local storage in its C api. Thus MySQL
58 # requires that each thread of an application execute a MySQL
59 # thread initialization to setup the thread local storage.
60 # This is impossible to do safely while staying within the DLZ
61 # driver API. This is a limitation caused by MySQL, and not the DLZ API.
62 # Because of this BIND MUST only run with a single thread when
63 # using the MySQL driver.
64
65 EAPI="4"
66
67 PYTHON_DEPEND="python? 2:2.7 3"
68 SUPPORT_PYTHON_ABIS="1"
69
70 inherit python eutils autotools toolchain-funcs flag-o-matic multilib db-use user
71
72 MY_PV="${PV/_p/-P}"
73 MY_PV="${MY_PV/_rc/rc}"
74 MY_P="${PN}-${MY_PV}"
75
76 SDB_LDAP_VER="1.1.0-fc14"
77
78 # bind-9.8.0-P1-geoip-1.3.patch
79 GEOIP_PV=1.3
80 #GEOIP_PV_AGAINST="${MY_PV}"
81 GEOIP_PV_AGAINST="9.9.2"
82 GEOIP_P="bind-${GEOIP_PV_AGAINST}-geoip-${GEOIP_PV}"
83 GEOIP_PATCH_A="${GEOIP_P}.patch"
84 GEOIP_DOC_A="bind-geoip-1.3-readme.txt"
85 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
86
87 RRL_PV="${MY_PV}"
88
89 # GeoIP: http://bind-geoip.googlecode.com/
90 # DNS RRL: http://www.redbarn.org/dns/ratelimits/
91 # SDB-LDAP: http://bind9-ldap.bayour.com/
92
93 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
94 HOMEPAGE="http://www.isc.org/software/bind"
95 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
96 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
97 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
98 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )
99 sdb-ldap? (
100 http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2
101 )
102 rrl? ( http://ss.vix.com/~vixie/rl-${RRL_PV}.patch )"
103
104 LICENSE="ISC BSD BSD-2 HPND JNIC RSA openssl"
105 SLOT="0"
106 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
107 IUSE="berkdb caps dlz doc filter-aaaa geoip gost gssapi idn ipv6 ldap mysql odbc
108 postgres python rpz rrl sdb-ldap selinux ssl static-libs threads urandom xml"
109 # no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
110
111 REQUIRED_USE="postgres? ( dlz )
112 berkdb? ( dlz )
113 mysql? ( dlz !threads )
114 odbc? ( dlz )
115 ldap? ( dlz )
116 sdb-ldap? ( dlz )
117 gost? ( ssl )
118 threads? ( caps )"
119
120 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
121 mysql? ( >=virtual/mysql-4.0 )
122 odbc? ( >=dev-db/unixODBC-2.2.6 )
123 ldap? ( net-nds/openldap )
124 idn? ( net-dns/idnkit )
125 postgres? ( dev-db/postgresql-base )
126 caps? ( >=sys-libs/libcap-2.1.0 )
127 xml? ( dev-libs/libxml2 )
128 geoip? ( >=dev-libs/geoip-1.4.6 )
129 gssapi? ( virtual/krb5 )
130 sdb-ldap? ( net-nds/openldap )
131 gost? ( >=dev-libs/openssl-1.0.0[-bindist] )
132 python? ( virtual/python-argparse )"
133
134 RDEPEND="${DEPEND}
135 selinux? ( sec-policy/selinux-bind )
136 || ( sys-process/psmisc >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd )"
137
138 S="${WORKDIR}/${MY_P}"
139
140 pkg_setup() {
141 ebegin "Creating named group and user"
142 enewgroup named 40
143 enewuser named 40 -1 /etc/bind named
144 eend ${?}
145
146 if use python; then
147 python_pkg_setup
148 fi
149 }
150
151 src_prepare() {
152 # Adjusting PATHs in manpages
153 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
154 sed -i \
155 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
156 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
157 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
158 "${i}" || die "sed failed, ${i} doesn't exist"
159 done
160
161 if use dlz; then
162 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
163 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
164 if use mysql && has_version ">=dev-db/mysql-5"; then
165 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
166 fi
167
168 if use odbc; then
169 epatch "${FILESDIR}/${PN}-9.7.3-odbc-dlz-detect.patch"
170 fi
171
172 # sdb-ldap patch as per bug #160567
173 # Upstream URL: http://bind9-ldap.bayour.com/
174 # New patch take from bug 302735
175 if use sdb-ldap; then
176 epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
177 cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
178 cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
179 cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
180 fi
181 fi
182
183 # should be installed by bind-tools
184 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
185
186 if use geoip; then
187 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
188 sed -i -e 's:^ RELEASETYPE=: RELEASETYPE=-P:' \
189 -e 's:RELEASEVER=:RELEASEVER=1:' \
190 ${GEOIP_PATCH_A} || die
191 # sed -i -e 's:RELEASEVER=2:RELEASEVER=3:' ${GEOIP_PATCH_A} || die
192 epatch ${GEOIP_PATCH_A}
193 fi
194
195 if use rrl; then
196 cp "${DISTDIR}"/rl-${RRL_PV}.patch "${S}" || die
197 # sed -i -e 's:^ RELEASETYPE=: RELEASETYPE=-P:' \
198 # -e 's:^ RELEASEVER=: RELEASEVER=1:' \
199 # rl-${RRL_PV}.patch || die
200
201 # Response Rate Limiting (DNS RRL) - bug 434650
202 epatch rl-${RRL_PV}.patch
203 fi
204
205 # Disable tests for now, bug 406399
206 sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
207
208 # bug #220361
209 rm {aclocal,libtool}.m4
210 eautoreconf
211 }
212
213 src_configure() {
214 local myconf=""
215
216 if use urandom; then
217 myconf="${myconf} --with-randomdev=/dev/urandom"
218 else
219 myconf="${myconf} --with-randomdev=/dev/random"
220 fi
221
222 use geoip && myconf="${myconf} --with-geoip"
223
224 # bug #158664
225 # gcc-specs-ssp && replace-flags -O[23s] -O
226
227 # To include db.h from proper path
228 use berkdb && append-flags "-I$(db_includedir)"
229
230 export BUILD_CC=$(tc-getBUILD_CC)
231 econf \
232 --sysconfdir=/etc/bind \
233 --localstatedir=/var \
234 --with-libtool \
235 $(use_enable threads) \
236 $(use_with dlz dlopen) \
237 $(use_with dlz dlz-filesystem) \
238 $(use_with dlz dlz-stub) \
239 $(use_with postgres dlz-postgres) \
240 $(use_with mysql dlz-mysql) \
241 $(use_with berkdb dlz-bdb) \
242 $(use_with ldap dlz-ldap) \
243 $(use_with odbc dlz-odbc) \
244 $(use_with ssl openssl "${EPREFIX}"/usr) \
245 $(use_with idn) \
246 $(use_enable ipv6) \
247 $(use_with xml libxml2) \
248 $(use_with gssapi) \
249 $(use_enable rpz rpz-nsip) \
250 $(use_enable rpz rpz-nsdname) \
251 $(use_enable caps linux-caps) \
252 $(use_with gost) \
253 $(use_enable filter-aaaa) \
254 $(use_with python) \
255 --without-readline \
256 ${myconf}
257
258 # $(use_enable static-libs static) \
259
260 # bug #151839
261 echo '#undef SO_BSDCOMPAT' >> config.h
262 }
263
264 src_install() {
265 emake DESTDIR="${D}" install
266
267 dodoc CHANGES FAQ README
268
269 if use idn; then
270 dodoc contrib/idn/README.idnkit
271 fi
272
273 if use doc; then
274 dodoc doc/arm/Bv9ARM.pdf
275
276 docinto misc
277 dodoc doc/misc/*
278
279 # might a 'html' useflag make sense?
280 docinto html
281 dohtml -r doc/arm/*
282
283 docinto contrib
284 dodoc contrib/named-bootconf/named-bootconf.sh \
285 contrib/nanny/nanny.pl
286
287 # some handy-dandy dynamic dns examples
288 pushd "${D}"/usr/share/doc/${PF} 1>/dev/null
289 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
290 popd 1>/dev/null
291 fi
292
293 use geoip && dodoc "${DISTDIR}"/${GEOIP_DOC_A}
294
295 insinto /etc/bind
296 newins "${FILESDIR}"/named.conf-r6 named.conf
297
298 # ftp://ftp.rs.internic.net/domain/named.cache:
299 insinto /var/bind
300 doins "${FILESDIR}"/named.cache
301
302 insinto /var/bind/pri
303 newins "${FILESDIR}"/127.zone-r1 127.zone
304 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
305
306 newinitd "${FILESDIR}"/named.init-r12 named
307 newconfd "${FILESDIR}"/named.confd-r6 named
308
309 if use gost; then
310 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
311 else
312 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
313 fi
314
315 newenvd "${FILESDIR}"/10bind.env 10bind
316
317 # Let's get rid of those tools and their manpages since they're provided by bind-tools
318 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
319 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
320 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
321 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
322
323 # bug 405251, library archives aren't properly handled by --enable/disable-static
324 if ! use static-libs; then
325 find "${D}" -type f -name '*.la' -delete || die
326 fi
327
328 if use python; then
329 install_python_tools() {
330 python_convert_shebangs $PYTHON_ABI bin/python/dnssec-checkds
331 exeinto /usr/sbin
332 newexe bin/python/dnssec-checkds dnssec-checkds-${PYTHON_ABI}
333 }
334 python_execute_function install_python_tools
335
336 rm -f "${D}/usr/sbin/dnssec-checkds"
337 python_generate_wrapper_scripts "${D}usr/sbin/dnssec-checkds"
338 fi
339
340 # bug 450406
341 dosym named.cache /var/bind/root.cache
342
343 dosym /var/bind/pri /etc/bind/pri
344 dosym /var/bind/sec /etc/bind/sec
345 dosym /var/bind/dyn /etc/bind/dyn
346 keepdir /var/bind/{pri,sec,dyn}
347
348 dodir /var/{run,log}/named
349
350 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
351 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
352 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
353 fperms 0750 /etc/bind /var/bind/pri
354 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
355 }
356
357 pkg_postinst() {
358 if [ ! -f '/etc/bind/rndc.key' ]; then
359 if use urandom; then
360 einfo "Using /dev/urandom for generating rndc.key"
361 /usr/sbin/rndc-confgen -r /dev/urandom -a
362 echo
363 else
364 einfo "Using /dev/random for generating rndc.key"
365 /usr/sbin/rndc-confgen -a
366 echo
367 fi
368 chown root:named /etc/bind/rndc.key
369 chmod 0640 /etc/bind/rndc.key
370 fi
371
372 einfo
373 einfo "You can edit /etc/conf.d/named to customize named settings"
374 einfo
375 use mysql || use postgres || use ldap && {
376 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
377 elog "uncomment the specified rc_named_* lines in your"
378 elog "/etc/conf.d/named config to ensure they'll start before bind"
379 einfo
380 }
381 einfo "If you'd like to run bind in a chroot AND this is a new"
382 einfo "install OR your bind doesn't already run in a chroot:"
383 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
384 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
385 einfo
386
387 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
388 if [[ -n ${CHROOT} ]]; then
389 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
390 elog "To enable the old behaviour (without using mount) uncomment the"
391 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
392 elog "If you decide to use the new/default method, ensure to make backup"
393 elog "first and merge your existing configs/zones to /etc/bind and"
394 elog "/var/bind because bind will now mount the needed directories into"
395 elog "the chroot dir."
396 fi
397
398 ewarn
399 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
400 ewarn "you may need to fix your named.conf!"
401 ewarn
402 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
403 ewarn "To fix the permissions do:"
404 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
405 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
406 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
407 ewarn "chmod 0750 /etc/bind /var/bind/pri"
408 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
409 ewarn
410 }
411
412 pkg_config() {
413 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
414 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
415 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
416
417 if [[ -z "${CHROOT}" ]]; then
418 eerror "This config script is designed to automate setting up"
419 eerror "a chrooted bind/named. To do so, please first uncomment"
420 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
421 die "Unset CHROOT"
422 fi
423 if [[ -d "${CHROOT}" ]]; then
424 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
425 ewarn "To enable the old behaviour (without using mount) uncomment the"
426 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
427 ewarn
428 ewarn "${CHROOT} already exists... some things might become overridden"
429 ewarn "press CTRL+C if you don't want to continue"
430 sleep 10
431 fi
432
433 echo; einfo "Setting up the chroot directory..."
434
435 mkdir -m 0750 -p ${CHROOT}
436 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
437 mkdir -m 0750 -p ${CHROOT}/etc/bind
438 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
439 # As of bind 9.8.0
440 if has_version net-dns/bind[gost]; then
441 if [ "$(get_libdir)" = "lib64" ]; then
442 mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
443 ln -s lib64 ${CHROOT}/usr/lib
444 else
445 mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
446 fi
447 fi
448 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
449
450 mknod ${CHROOT}/dev/null c 1 3
451 chmod 0666 ${CHROOT}/dev/null
452
453 mknod ${CHROOT}/dev/zero c 1 5
454 chmod 0666 ${CHROOT}/dev/zero
455
456 if use urandom; then
457 mknod ${CHROOT}/dev/urandom c 1 9
458 chmod 0666 ${CHROOT}/dev/urandom
459 else
460 mknod ${CHROOT}/dev/random c 1 8
461 chmod 0666 ${CHROOT}/dev/random
462 fi
463
464 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
465 cp -a /etc/bind ${CHROOT}/etc/
466 cp -a /var/bind ${CHROOT}/var/
467 fi
468
469 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
470 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
471 fi
472
473 elog "You may need to add the following line to your syslog-ng.conf:"
474 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
475 }
476
477
478
479 1.1 net-dns/bind/bind-9.8.4_p1.ebuild
480
481 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.8.4_p1.ebuild?rev=1.1&view=markup
482 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.8.4_p1.ebuild?rev=1.1&content-type=text/plain
483
484 Index: bind-9.8.4_p1.ebuild
485 ===================================================================
486 # Copyright 1999-2013 Gentoo Foundation
487 # Distributed under the terms of the GNU General Public License v2
488 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.8.4_p1.ebuild,v 1.1 2013/02/28 22:45:55 idl0r Exp $
489
490 # Re dlz/mysql and threads, needs to be verified..
491 # MySQL uses thread local storage in its C api. Thus MySQL
492 # requires that each thread of an application execute a MySQL
493 # thread initialization to setup the thread local storage.
494 # This is impossible to do safely while staying within the DLZ
495 # driver API. This is a limitation caused by MySQL, and not the DLZ API.
496 # Because of this BIND MUST only run with a single thread when
497 # using the MySQL driver.
498
499 EAPI="4"
500
501 inherit eutils autotools toolchain-funcs flag-o-matic multilib db-use user
502
503 MY_PV="${PV/_p/-P}"
504 MY_PV="${MY_PV/_rc/rc}"
505 MY_P="${PN}-${MY_PV}"
506
507 SDB_LDAP_VER="1.1.0-fc14"
508
509 # bind-9.8.0-P1-geoip-1.3.patch
510 GEOIP_PV=1.3
511 #GEOIP_PV_AGAINST="${MY_PV}"
512 GEOIP_PV_AGAINST="9.8.3-P1"
513 GEOIP_P="bind-${GEOIP_PV_AGAINST}-geoip-${GEOIP_PV}"
514 GEOIP_PATCH_A="${GEOIP_P}.patch"
515 GEOIP_DOC_A="bind-geoip-1.3-readme.txt"
516 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
517
518 RRL_PV="${MY_PV}"
519
520 # GeoIP: http://bind-geoip.googlecode.com/
521 # DNS RRL: http://www.redbarn.org/dns/ratelimits/
522 # SDB-LDAP: http://bind9-ldap.bayour.com/
523
524 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
525 HOMEPAGE="http://www.isc.org/software/bind"
526 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
527 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
528 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
529 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )
530 sdb-ldap? (
531 http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2
532 )
533 rrl? ( http://ss.vix.com/~vixie/rl-${RRL_PV}.patch )"
534
535 LICENSE="ISC BSD BSD-2 HPND JNIC RSA openssl"
536 SLOT="0"
537 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
538 IUSE="berkdb caps dlz doc filter-aaaa geoip gost gssapi idn ipv6 ldap mysql odbc
539 postgres rpz rrl sdb-ldap selinux ssl static-libs threads urandom xml"
540 # no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
541
542 REQUIRED_USE="postgres? ( dlz )
543 berkdb? ( dlz )
544 mysql? ( dlz !threads )
545 odbc? ( dlz )
546 ldap? ( dlz )
547 sdb-ldap? ( dlz )
548 gost? ( ssl )
549 threads? ( caps )"
550
551 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
552 mysql? ( >=virtual/mysql-4.0 )
553 odbc? ( >=dev-db/unixODBC-2.2.6 )
554 ldap? ( net-nds/openldap )
555 idn? ( net-dns/idnkit )
556 postgres? ( dev-db/postgresql-base )
557 caps? ( >=sys-libs/libcap-2.1.0 )
558 xml? ( dev-libs/libxml2 )
559 geoip? ( >=dev-libs/geoip-1.4.6 )
560 gssapi? ( virtual/krb5 )
561 sdb-ldap? ( net-nds/openldap )
562 gost? ( >=dev-libs/openssl-1.0.0[-bindist] )"
563
564 RDEPEND="${DEPEND}
565 selinux? ( sec-policy/selinux-bind )
566 || ( sys-process/psmisc >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd )"
567
568 S="${WORKDIR}/${MY_P}"
569
570 pkg_setup() {
571 ebegin "Creating named group and user"
572 enewgroup named 40
573 enewuser named 40 -1 /etc/bind named
574 eend ${?}
575 }
576
577 src_prepare() {
578 # Adjusting PATHs in manpages
579 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
580 sed -i \
581 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
582 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
583 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
584 "${i}" || die "sed failed, ${i} doesn't exist"
585 done
586
587 if use dlz; then
588 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
589 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
590 if use mysql && has_version ">=dev-db/mysql-5"; then
591 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
592 fi
593
594 if use odbc; then
595 epatch "${FILESDIR}/${PN}-9.7.3-odbc-dlz-detect.patch"
596 fi
597
598 # sdb-ldap patch as per bug #160567
599 # Upstream URL: http://bind9-ldap.bayour.com/
600 # New patch take from bug 302735
601 if use sdb-ldap; then
602 epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
603 cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
604 cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
605 cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
606 fi
607 fi
608
609 # should be installed by bind-tools
610 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
611
612 if use geoip; then
613 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
614 # sed -i -e 's:^ RELEASETYPE=: RELEASETYPE=-P:' \
615 # -e 's:RELEASEVER=:RELEASEVER=1:' \
616 # ${GEOIP_PATCH_A} || die
617 epatch ${GEOIP_PATCH_A}
618 fi
619
620 if use rrl; then
621 cp "${DISTDIR}"/rl-${RRL_PV}.patch "${S}" || die
622 # sed -i -e 's:^ RELEASETYPE=: RELEASETYPE=-P:' \
623 # -e 's:^ RELEASEVER=: RELEASEVER=1:' \
624 # rl-${RRL_PV}.patch || die
625
626 # Response Rate Limiting (DNS RRL) - bug 434650
627 epatch rl-${RRL_PV}.patch
628 fi
629
630 # Disable tests for now, bug 406399
631 sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
632
633 # bug #220361
634 rm {aclocal,libtool}.m4
635 eautoreconf
636 }
637
638 src_configure() {
639 local myconf=""
640
641 if use urandom; then
642 myconf="${myconf} --with-randomdev=/dev/urandom"
643 else
644 myconf="${myconf} --with-randomdev=/dev/random"
645 fi
646
647 use geoip && myconf="${myconf} --with-geoip"
648
649 # bug #158664
650 # gcc-specs-ssp && replace-flags -O[23s] -O
651
652 # To include db.h from proper path
653 use berkdb && append-flags "-I$(db_includedir)"
654
655 export BUILD_CC=$(tc-getBUILD_CC)
656 econf \
657 --sysconfdir=/etc/bind \
658 --localstatedir=/var \
659 --with-libtool \
660 $(use_enable threads) \
661 $(use_with dlz dlopen) \
662 $(use_with dlz dlz-filesystem) \
663 $(use_with dlz dlz-stub) \
664 $(use_with postgres dlz-postgres) \
665 $(use_with mysql dlz-mysql) \
666 $(use_with berkdb dlz-bdb) \
667 $(use_with ldap dlz-ldap) \
668 $(use_with odbc dlz-odbc) \
669 $(use_with ssl openssl "${EPREFIX}"/usr) \
670 $(use_with idn) \
671 $(use_enable ipv6) \
672 $(use_with xml libxml2) \
673 $(use_with gssapi) \
674 $(use_enable rpz rpz-nsip) \
675 $(use_enable rpz rpz-nsdname) \
676 $(use_enable caps linux-caps) \
677 $(use_with gost) \
678 $(use_enable filter-aaaa) \
679 ${myconf}
680
681 # bug #151839
682 echo '#undef SO_BSDCOMPAT' >> config.h
683 }
684
685 src_install() {
686 emake DESTDIR="${D}" install
687
688 dodoc CHANGES FAQ README
689
690 if use idn; then
691 dodoc contrib/idn/README.idnkit
692 fi
693
694 if use doc; then
695 dodoc doc/arm/Bv9ARM.pdf
696
697 docinto misc
698 dodoc doc/misc/*
699
700 # might a 'html' useflag make sense?
701 docinto html
702 dohtml -r doc/arm/*
703
704 docinto contrib
705 dodoc contrib/named-bootconf/named-bootconf.sh \
706 contrib/nanny/nanny.pl
707
708 # some handy-dandy dynamic dns examples
709 pushd "${D}"/usr/share/doc/${PF} 1>/dev/null
710 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
711 popd 1>/dev/null
712 fi
713
714 use geoip && dodoc "${DISTDIR}"/${GEOIP_DOC_A}
715
716 insinto /etc/bind
717 newins "${FILESDIR}"/named.conf-r6 named.conf
718
719 # ftp://ftp.rs.internic.net/domain/named.cache:
720 insinto /var/bind
721 doins "${FILESDIR}"/named.cache
722
723 insinto /var/bind/pri
724 newins "${FILESDIR}"/127.zone-r1 127.zone
725 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
726
727 newinitd "${FILESDIR}"/named.init-r12 named
728 newconfd "${FILESDIR}"/named.confd-r6 named
729
730 if use gost; then
731 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
732 else
733 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
734 fi
735
736 newenvd "${FILESDIR}"/10bind.env 10bind
737
738 # Let's get rid of those tools and their manpages since they're provided by bind-tools
739 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
740 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
741 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
742 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
743
744 # bug 405251, library archives aren't properly handled by --enable/disable-static
745 if ! use static-libs; then
746 find "${D}" -type f -name '*.la' -delete || die
747 fi
748
749 # bug 450406
750 dosym named.cache /var/bind/root.cache
751
752 dosym /var/bind/pri /etc/bind/pri
753 dosym /var/bind/sec /etc/bind/sec
754 dosym /var/bind/dyn /etc/bind/dyn
755 keepdir /var/bind/{pri,sec,dyn}
756
757 dodir /var/{run,log}/named
758
759 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
760 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
761 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
762 fperms 0750 /etc/bind /var/bind/pri
763 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
764 }
765
766 pkg_postinst() {
767 if [ ! -f '/etc/bind/rndc.key' ]; then
768 if use urandom; then
769 einfo "Using /dev/urandom for generating rndc.key"
770 /usr/sbin/rndc-confgen -r /dev/urandom -a
771 echo
772 else
773 einfo "Using /dev/random for generating rndc.key"
774 /usr/sbin/rndc-confgen -a
775 echo
776 fi
777 chown root:named /etc/bind/rndc.key
778 chmod 0640 /etc/bind/rndc.key
779 fi
780
781 einfo
782 einfo "You can edit /etc/conf.d/named to customize named settings"
783 einfo
784 use mysql || use postgres || use ldap && {
785 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
786 elog "uncomment the specified rc_named_* lines in your"
787 elog "/etc/conf.d/named config to ensure they'll start before bind"
788 einfo
789 }
790 einfo "If you'd like to run bind in a chroot AND this is a new"
791 einfo "install OR your bind doesn't already run in a chroot:"
792 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
793 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
794 einfo
795
796 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
797 if [[ -n ${CHROOT} ]]; then
798 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
799 elog "To enable the old behaviour (without using mount) uncomment the"
800 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
801 elog "If you decide to use the new/default method, ensure to make backup"
802 elog "first and merge your existing configs/zones to /etc/bind and"
803 elog "/var/bind because bind will now mount the needed directories into"
804 elog "the chroot dir."
805 fi
806
807 ewarn
808 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
809 ewarn "you may need to fix your named.conf!"
810 ewarn
811 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
812 ewarn "To fix the permissions do:"
813 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
814 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
815 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
816 ewarn "chmod 0750 /etc/bind /var/bind/pri"
817 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
818 ewarn
819 }
820
821 pkg_config() {
822 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
823 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
824 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
825
826 if [[ -z "${CHROOT}" ]]; then
827 eerror "This config script is designed to automate setting up"
828 eerror "a chrooted bind/named. To do so, please first uncomment"
829 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
830 die "Unset CHROOT"
831 fi
832 if [[ -d "${CHROOT}" ]]; then
833 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
834 ewarn "To enable the old behaviour (without using mount) uncomment the"
835 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
836 ewarn
837 ewarn "${CHROOT} already exists... some things might become overridden"
838 ewarn "press CTRL+C if you don't want to continue"
839 sleep 10
840 fi
841
842 echo; einfo "Setting up the chroot directory..."
843
844 mkdir -m 0750 -p ${CHROOT}
845 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
846 mkdir -m 0750 -p ${CHROOT}/etc/bind
847 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
848 # As of bind 9.8.0
849 if has_version net-dns/bind[gost]; then
850 if [ "$(get_libdir)" = "lib64" ]; then
851 mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
852 ln -s lib64 ${CHROOT}/usr/lib
853 else
854 mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
855 fi
856 fi
857 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
858
859 mknod ${CHROOT}/dev/null c 1 3
860 chmod 0666 ${CHROOT}/dev/null
861
862 mknod ${CHROOT}/dev/zero c 1 5
863 chmod 0666 ${CHROOT}/dev/zero
864
865 if use urandom; then
866 mknod ${CHROOT}/dev/urandom c 1 9
867 chmod 0666 ${CHROOT}/dev/urandom
868 else
869 mknod ${CHROOT}/dev/random c 1 8
870 chmod 0666 ${CHROOT}/dev/random
871 fi
872
873 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
874 cp -a /etc/bind ${CHROOT}/etc/
875 cp -a /var/bind ${CHROOT}/var/
876 fi
877
878 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
879 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
880 fi
881
882 elog "You may need to add the following line to your syslog-ng.conf:"
883 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
884 }