]> gitweb.michael.orlitzky.com - mjo-overlay.git/blob - net-dns/djbdns/djbdns-1.05-r26.ebuild
0f6229e06ba3c989d58fad6fa629ef7a42a4bcd2
[mjo-overlay.git] / net-dns / djbdns / djbdns-1.05-r26.ebuild
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/djbdns/djbdns-1.05-r26.ebuild,v 1.5 2012/07/25 01:53:14 jer Exp $
4
5 EAPI="2"
6 inherit eutils flag-o-matic toolchain-funcs user
7
8 DESCRIPTION="Excellent high-performance DNS services"
9 HOMEPAGE="http://cr.yp.to/djbdns.html"
10 IPV6_PATCH="test23"
11
12 SRC_URI="http://cr.yp.to/djbdns/${P}.tar.gz
13 ipv6? ( http://www.fefe.de/dns/${P}-${IPV6_PATCH}.diff.bz2 )"
14
15 SLOT="0"
16 LICENSE="public-domain"
17 KEYWORDS="~alpha ~amd64 hppa ~mips ppc ppc64 ~sparc x86"
18 IUSE="doc ipv6 selinux static"
19
20 DEPEND=""
21 RDEPEND="${DEPEND}
22 virtual/daemontools
23 sys-apps/ucspi-tcp
24 doc? ( app-doc/djbdns-man )
25 selinux? ( sec-policy/selinux-djbdns )
26 "
27
28 src_prepare() {
29 echo
30 elog 'Several patches have been dropped from this djbdns ebuild revision.'
31 elog 'Please use the DJBDNS_PATCH_DIR variable to specify a directory'
32 elog 'of custom patches.'
33 elog
34 elog 'Some of them can be found at http://tinydns.org/ or'
35 elog 'http://homepages.tesco.net/J.deBoynePollard/Softwares/djbdns/'
36 elog
37
38 epatch \
39 "${FILESDIR}/headtail.patch" \
40 "${FILESDIR}/dnsroots.patch" \
41 "${FILESDIR}/dnstracesort.patch" \
42 "${FILESDIR}/string_length_255.patch"
43
44 # Fix CVE2009-0858
45 epatch "${FILESDIR}/CVE2009-0858_0001-check-response-domain-name-length.patch"
46
47 if use ipv6; then
48 elog "At present dnstrace does NOT support IPv6. It will"\
49 "be compiled without IPv6 support."
50 cp -pR "${S}" "${S}-noipv6"
51 # Careful -- >=test21 of the IPv6 patch includes the errno patch
52 epatch "${DISTDIR}/${P}-${IPV6_PATCH}.diff.bz2"
53
54 # Fix CVE2008-4392
55 epatch \
56 "${FILESDIR}/CVE2008-4392_0001-dnscache-merge-similar-outgoing-queries-ipv6.patch" \
57 "${FILESDIR}/CVE2008-4392_0002-dnscache-cache-soa-records-ipv6.patch" \
58 "${FILESDIR}/makefile-parallel.patch"
59
60 cd "${S}-noipv6"
61 fi
62
63 # Fix CVE2008-4392
64 epatch \
65 "${FILESDIR}/CVE2008-4392_0001-dnscache-merge-similar-outgoing-queries.patch" \
66 "${FILESDIR}/CVE2008-4392_0002-dnscache-cache-soa-records.patch"
67
68 epatch "${FILESDIR}/${PV}-errno.patch"
69
70 if [[ -n "${DJBDNS_PATCH_DIR}" && -d "${DJBDNS_PATCH_DIR}" ]]
71 then
72 echo
73 ewarn "You enabled custom patches from ${DJBDNS_PATCH_DIR}."
74 ewarn "Be warned that you won't get any support when using "
75 ewarn "this feature. You're on your own from now!"
76 echo
77 ebeep
78 cd "${S}" && epatch "${DJBDNS_PATCH_DIR}/"*
79 fi
80 }
81
82 src_compile() {
83 use static && append-ldflags -static
84 echo "$(tc-getCC) ${CFLAGS}" > conf-cc
85 echo "$(tc-getCC) ${LDFLAGS}" > conf-ld
86 echo "/usr" > conf-home
87 #emake -j1 || die "emake failed"
88 emake || die "emake failed"
89
90 # If djbdns is compiled with IPv6 support, it breaks dnstrace.
91 # Therefore we must compile dnstrace separately without IPv6
92 # support.
93 if use ipv6; then
94 elog "Compiling dnstrace without ipv6 support"
95 cd "${S}-noipv6"
96 echo "$(tc-getCC) ${CFLAGS}" > conf-cc
97 echo "$(tc-getCC) ${LDFLAGS}" > conf-ld
98 echo "/usr" > conf-home
99 #emake -j1 dnstrace || die "emake failed"
100 emake dnstrace || die "emake failed"
101 fi
102 }
103
104 src_install() {
105 insinto /etc
106 doins dnsroots.global || die
107
108 into /usr
109 dobin *-conf dnscache tinydns walldns rbldns pickdns axfrdns \
110 *-get *-data *-edit dnsip dnsipq dnsname dnstxt dnsmx \
111 dnsfilter random-ip dnsqr dnsq dnstrace dnstracesort || die
112
113 if use ipv6; then
114 dobin dnsip6 dnsip6q "${S}-noipv6/dnstrace" || die
115 fi
116
117 dodoc CHANGES FILES README SYSDEPS TARGETS TODO VERSION || die
118 }
119
120 pkg_preinst() {
121 # The nofiles group is no longer provided by baselayout.
122 # Share it with qmail if possible.
123 enewgroup nofiles 200
124
125 enewuser dnscache -1 -1 -1 nofiles
126 enewuser dnslog -1 -1 -1 nofiles
127 enewuser tinydns -1 -1 -1 nofiles
128 }
129
130 pkg_postinst() {
131 elog ''
132 elog 'The dnscache-setup, tinydns-setup, and djbdns-setup programs have'
133 elog 'been removed to follow upstream more closely. To configure djbdns,'
134 elog 'please follow the instructions at,'
135 elog ''
136 elog ' http://cr.yp.to/djbdns.html'
137 elog ''
138 elog 'Of particular interest are,'
139 elog ''
140 elog ' axfrdns : http://cr.yp.to/djbdns/axfrdns-conf.html'
141 elog ' dnscache: http://cr.yp.to/djbdns/run-cache-x-home.html'
142 elog ' tinydns : http://cr.yp.to/djbdns/run-server.html'
143 elog ''
144 elog 'Portage has created users for axfrdns, dnscache, and tinydns; the'
145 elog 'commands to configure these programs are,'
146 elog ''
147 elog ' 1. axfrdns-conf tinydns dnslog /var/axfrdns /var/tinydns $ip'
148 elog ' 2. dnscache-conf dnscache dnslog /var/dnscache $ip'
149 elog ' 3. tinydns-conf tinydns dnslog /var/tinydns $ip'
150 elog ''
151 elog '(replace $ip with the ip address on which the server will run).'
152 elog ''
153 elog 'If you wish to configure rbldns or walldns, you will need to create'
154 elog 'those users yourself (although you should still use the "dnslog"'
155 elog 'user for the logs):'
156 elog ''
157 elog ' 4. rbldns-conf $username dnslog /var/rbldns $ip $base'
158 elog ' 5. walldns-conf $username dnslog /var/walldns $ip'
159 elog ''
160 }