/[gentoo-x86]/net-dns/bind/bind-9.8.3_p1.ebuild
Gentoo

Contents of /net-dns/bind/bind-9.8.3_p1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Tue Sep 11 18:19:31 2012 UTC (8 months, 1 week ago) by idl0r
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
Remove old versions. Add DNS Response Rate Limit (RRL) patch, bug 434650.

(Portage version: 2.2.0_alpha125/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.8.3_p1.ebuild,v 1.9 2012/07/28 21:29:03 idl0r Exp $
4
5 # Re dlz/mysql and threads, needs to be verified..
6 # MySQL uses thread local storage in its C api. Thus MySQL
7 # requires that each thread of an application execute a MySQL
8 # thread initialization to setup the thread local storage.
9 # This is impossible to do safely while staying within the DLZ
10 # driver API. This is a limitation caused by MySQL, and not the DLZ API.
11 # Because of this BIND MUST only run with a single thread when
12 # using the MySQL driver.
13
14 EAPI="4"
15
16 inherit eutils autotools toolchain-funcs flag-o-matic multilib db-use user
17
18 MY_PV="${PV/_p/-P}"
19 MY_PV="${MY_PV/_rc/rc}"
20 MY_P="${PN}-${MY_PV}"
21
22 SDB_LDAP_VER="1.1.0-fc14"
23
24 # bind-9.8.0-P1-geoip-1.3.patch
25 GEOIP_PV=1.3
26 #GEOIP_PV_AGAINST="${MY_PV}"
27 GEOIP_PV_AGAINST="9.8.3"
28 GEOIP_P="bind-${GEOIP_PV_AGAINST}-geoip-${GEOIP_PV}"
29 GEOIP_PATCH_A="${GEOIP_P}.patch"
30 GEOIP_DOC_A="bind-geoip-1.3-readme.txt"
31 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
32
33 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
34 HOMEPAGE="http://www.isc.org/software/bind"
35 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
36 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
37 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
38 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )
39 sdb-ldap? ( http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2 )"
40
41 LICENSE="as-is"
42 SLOT="0"
43 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ~ppc64 s390 sh sparc x86 ~x86-fbsd"
44 IUSE="berkdb caps dlz doc geoip gost gssapi idn ipv6 ldap mysql odbc postgres rpz sdb-ldap
45 selinux ssl static-libs threads urandom xml"
46 # no PKCS11 currently as it requires OpenSSL to be patched, also see bug 409687
47
48 REQUIRED_USE="postgres? ( dlz )
49 berkdb? ( dlz )
50 mysql? ( dlz !threads )
51 odbc? ( dlz )
52 ldap? ( dlz )
53 sdb-ldap? ( dlz )
54 gost? ( ssl )
55 threads? ( caps )"
56
57 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
58 mysql? ( >=virtual/mysql-4.0 )
59 odbc? ( >=dev-db/unixODBC-2.2.6 )
60 ldap? ( net-nds/openldap )
61 idn? ( net-dns/idnkit )
62 postgres? ( dev-db/postgresql-base )
63 caps? ( >=sys-libs/libcap-2.1.0 )
64 xml? ( dev-libs/libxml2 )
65 geoip? ( >=dev-libs/geoip-1.4.6 )
66 gssapi? ( virtual/krb5 )
67 sdb-ldap? ( net-nds/openldap )
68 gost? ( >=dev-libs/openssl-1.0.0[-bindist] )"
69
70 RDEPEND="${DEPEND}
71 selinux? ( sec-policy/selinux-bind )
72 || ( sys-process/psmisc >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd )"
73
74 S="${WORKDIR}/${MY_P}"
75
76 pkg_setup() {
77 ebegin "Creating named group and user"
78 enewgroup named 40
79 enewuser named 40 -1 /etc/bind named
80 eend ${?}
81 }
82
83 src_prepare() {
84 # Adjusting PATHs in manpages
85 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
86 sed -i \
87 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
88 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
89 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
90 "${i}" || die "sed failed, ${i} doesn't exist"
91 done
92
93 if use dlz; then
94 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
95 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
96 if use mysql && has_version ">=dev-db/mysql-5"; then
97 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
98 fi
99
100 if use odbc; then
101 epatch "${FILESDIR}/${PN}-9.7.3-odbc-dlz-detect.patch"
102 fi
103
104 # sdb-ldap patch as per bug #160567
105 # Upstream URL: http://bind9-ldap.bayour.com/
106 # New patch take from bug 302735
107 if use sdb-ldap; then
108 epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
109 cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named/
110 cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools/
111 cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools/
112 fi
113 fi
114
115 # should be installed by bind-tools
116 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
117
118 if use geoip; then
119 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
120 sed -i -e 's:^ RELEASETYPE=: RELEASETYPE=-P:' \
121 -e 's:RELEASEVER=:RELEASEVER=1:' \
122 ${GEOIP_PATCH_A} || die
123 epatch ${GEOIP_PATCH_A}
124 fi
125
126 # Disable tests for now, bug 406399
127 sed -i '/^SUBDIRS/s:tests::' bin/Makefile.in lib/Makefile.in || die
128
129 # bug #220361
130 rm {aclocal,libtool}.m4
131 eautoreconf
132 }
133
134 src_configure() {
135 local myconf=""
136
137 if use urandom; then
138 myconf="${myconf} --with-randomdev=/dev/urandom"
139 else
140 myconf="${myconf} --with-randomdev=/dev/random"
141 fi
142
143 use geoip && myconf="${myconf} --with-geoip"
144
145 # bug #158664
146 # gcc-specs-ssp && replace-flags -O[23s] -O
147
148 # To include db.h from proper path
149 use berkdb && append-flags "-I$(db_includedir)"
150
151 export BUILD_CC=$(tc-getBUILD_CC)
152 econf \
153 --sysconfdir=/etc/bind \
154 --localstatedir=/var \
155 --with-libtool \
156 $(use_enable threads) \
157 $(use_with dlz dlopen) \
158 $(use_with dlz dlz-filesystem) \
159 $(use_with dlz dlz-stub) \
160 $(use_with postgres dlz-postgres) \
161 $(use_with mysql dlz-mysql) \
162 $(use_with berkdb dlz-bdb) \
163 $(use_with ldap dlz-ldap) \
164 $(use_with odbc dlz-odbc) \
165 $(use_with ssl openssl) \
166 $(use_with idn) \
167 $(use_enable ipv6) \
168 $(use_with xml libxml2) \
169 $(use_with gssapi) \
170 $(use_enable rpz rpz-nsip) \
171 $(use_enable rpz rpz-nsdname) \
172 $(use_enable caps linux-caps) \
173 $(use_with gost) \
174 ${myconf}
175
176 # bug #151839
177 echo '#undef SO_BSDCOMPAT' >> config.h
178 }
179
180 src_install() {
181 emake DESTDIR="${D}" install
182
183 dodoc CHANGES FAQ README
184
185 if use idn; then
186 dodoc contrib/idn/README.idnkit
187 fi
188
189 if use doc; then
190 dodoc doc/arm/Bv9ARM.pdf
191
192 docinto misc
193 dodoc doc/misc/*
194
195 # might a 'html' useflag make sense?
196 docinto html
197 dohtml -r doc/arm/*
198
199 docinto contrib
200 dodoc contrib/named-bootconf/named-bootconf.sh \
201 contrib/nanny/nanny.pl
202
203 # some handy-dandy dynamic dns examples
204 cd "${D}"/usr/share/doc/${PF}
205 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
206 fi
207
208 use geoip && dodoc "${DISTDIR}"/${GEOIP_DOC_A}
209
210 insinto /etc/bind
211 newins "${FILESDIR}"/named.conf-r5 named.conf
212
213 # ftp://ftp.rs.internic.net/domain/named.cache:
214 insinto /var/bind
215 doins "${FILESDIR}"/named.cache
216
217 insinto /var/bind/pri
218 newins "${FILESDIR}"/127.zone-r1 127.zone
219 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone
220
221 newinitd "${FILESDIR}"/named.init-r11 named
222 newconfd "${FILESDIR}"/named.confd-r6 named
223
224 if use gost; then
225 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}/' "${D}/etc/init.d/named" || die
226 else
227 sed -i -e 's/^OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-1}$/OPENSSL_LIBGOST=${OPENSSL_LIBGOST:-0}/' "${D}/etc/init.d/named" || die
228 fi
229
230 newenvd "${FILESDIR}"/10bind.env 10bind
231
232 # Let's get rid of those tools and their manpages since they're provided by bind-tools
233 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
234 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
235 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
236 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
237
238 # bug 405251, library archives aren't properly handled by --enable/disable-static
239 if ! use static-libs; then
240 find "${D}" -type f -name '*.la' -delete || die
241 fi
242
243 dosym /var/bind/named.cache /var/bind/root.cache
244 dosym /var/bind/pri /etc/bind/pri
245 dosym /var/bind/sec /etc/bind/sec
246 dosym /var/bind/dyn /etc/bind/dyn
247 keepdir /var/bind/{pri,sec,dyn}
248
249 dodir /var/{run,log}/named
250
251 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
252 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
253 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
254 fperms 0750 /etc/bind /var/bind/pri
255 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
256 }
257
258 pkg_postinst() {
259 if [ ! -f '/etc/bind/rndc.key' ]; then
260 if use urandom; then
261 einfo "Using /dev/urandom for generating rndc.key"
262 /usr/sbin/rndc-confgen -r /dev/urandom -a
263 echo
264 else
265 einfo "Using /dev/random for generating rndc.key"
266 /usr/sbin/rndc-confgen -a
267 echo
268 fi
269 chown root:named /etc/bind/rndc.key
270 chmod 0640 /etc/bind/rndc.key
271 fi
272
273 einfo
274 einfo "You can edit /etc/conf.d/named to customize named settings"
275 einfo
276 use mysql || use postgres || use ldap && {
277 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
278 elog "uncomment the specified rc_named_* lines in your"
279 elog "/etc/conf.d/named config to ensure they'll start before bind"
280 einfo
281 }
282 einfo "If you'd like to run bind in a chroot AND this is a new"
283 einfo "install OR your bind doesn't already run in a chroot:"
284 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
285 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
286 einfo
287
288 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
289 if [[ -n ${CHROOT} ]]; then
290 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
291 elog "To enable the old behaviour (without using mount) uncomment the"
292 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
293 elog "If you decide to use the new/default method, ensure to make backup"
294 elog "first and merge your existing configs/zones to /etc/bind and"
295 elog "/var/bind because bind will now mount the needed directories into"
296 elog "the chroot dir."
297 fi
298
299 ewarn
300 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
301 ewarn "you may need to fix your named.conf!"
302 ewarn
303 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
304 ewarn "To fix the permissions do:"
305 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
306 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
307 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
308 ewarn "chmod 0750 /etc/bind /var/bind/pri"
309 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
310 ewarn
311 }
312
313 pkg_config() {
314 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
315 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
316 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
317
318 if [[ -z "${CHROOT}" ]]; then
319 eerror "This config script is designed to automate setting up"
320 eerror "a chrooted bind/named. To do so, please first uncomment"
321 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
322 die "Unset CHROOT"
323 fi
324 if [[ -d "${CHROOT}" ]]; then
325 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
326 ewarn "To enable the old behaviour (without using mount) uncomment the"
327 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
328 ewarn
329 ewarn "${CHROOT} already exists... some things might become overridden"
330 ewarn "press CTRL+C if you don't want to continue"
331 sleep 10
332 fi
333
334 echo; einfo "Setting up the chroot directory..."
335
336 mkdir -m 0750 -p ${CHROOT}
337 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
338 mkdir -m 0750 -p ${CHROOT}/etc/bind
339 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
340 # As of bind 9.8.0
341 if has_version net-dns/bind[gost]; then
342 if [ "$(get_libdir)" = "lib64" ]; then
343 mkdir -m 0755 -p ${CHROOT}/usr/lib64/engines
344 ln -s lib64 ${CHROOT}/usr/lib
345 else
346 mkdir -m 0755 -p ${CHROOT}/usr/lib/engines
347 fi
348 fi
349 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
350
351 mknod ${CHROOT}/dev/null c 1 3
352 chmod 0666 ${CHROOT}/dev/null
353
354 mknod ${CHROOT}/dev/zero c 1 5
355 chmod 0666 ${CHROOT}/dev/zero
356
357 if use urandom; then
358 mknod ${CHROOT}/dev/urandom c 1 9
359 chmod 0666 ${CHROOT}/dev/urandom
360 else
361 mknod ${CHROOT}/dev/random c 1 8
362 chmod 0666 ${CHROOT}/dev/random
363 fi
364
365 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
366 cp -a /etc/bind ${CHROOT}/etc/
367 cp -a /var/bind ${CHROOT}/var/
368 fi
369
370 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
371 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
372 fi
373
374 elog "You may need to add the following line to your syslog-ng.conf:"
375 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
376 }

  ViewVC Help
Powered by ViewVC 1.1.13