dev-qt/qttest: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / net-dns / pdns / pdns-4.1.13.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit multilib user
7
8 DESCRIPTION="The PowerDNS Daemon"
9 HOMEPAGE="https://www.powerdns.com/"
10 SRC_URI="https://downloads.powerdns.com/releases/${P/_/-}.tar.bz2"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="amd64 x86"
15
16 # other possible flags:
17 # db2: we lack the dep
18 # oracle: dito (need Oracle Client Libraries)
19 # xdb: (almost) dead, surely not supported
20
21 IUSE="botan debug doc geoip ldap libressl lua luajit mydns mysql opendbx postgres protobuf remote sodium sqlite systemd tools tinydns test"
22 RESTRICT="!test? ( test )"
23
24 REQUIRED_USE="mydns? ( mysql )"
25
26 RDEPEND="
27         libressl? ( dev-libs/libressl:= )
28         !libressl? ( dev-libs/openssl:= )
29         >=dev-libs/boost-1.35:=
30         botan? ( dev-libs/botan:2= )
31         lua? (
32                 !luajit? ( dev-lang/lua:= )
33                 luajit? ( dev-lang/luajit:= )
34         )
35         mysql? ( dev-db/mysql-connector-c:= )
36         postgres? ( dev-db/postgresql:= )
37         ldap? ( >=net-nds/openldap-2.0.27-r4 app-crypt/mit-krb5 )
38         sqlite? ( dev-db/sqlite:3 )
39         opendbx? ( dev-db/opendbx )
40         geoip? ( >=dev-cpp/yaml-cpp-0.5.1:= dev-libs/geoip )
41         sodium? ( dev-libs/libsodium:= )
42         tinydns? ( >=dev-db/tinycdb-0.77 )
43         protobuf? ( dev-libs/protobuf )"
44 DEPEND="${RDEPEND}"
45 BDEPEND="virtual/pkgconfig
46         doc? ( app-doc/doxygen )"
47
48 S="${WORKDIR}"/${P/_/-}
49
50 src_configure() {
51         local dynmodules="pipe bind" # the default backends, always enabled
52
53         #use db2 && dynmodules+=" db2"
54         use ldap && dynmodules+=" ldap"
55         use lua && dynmodules+=" lua"
56         use mydns && dynmodules+=" mydns"
57         use mysql && dynmodules+=" gmysql"
58         use opendbx && dynmodules+=" opendbx"
59         #use oracle && dynmodules+=" goracle oracle"
60         use postgres && dynmodules+=" gpgsql"
61         use remote && dynmodules+=" remote"
62         use sqlite && dynmodules+=" gsqlite3"
63         use tinydns && dynmodules+=" tinydns"
64         use geoip && dynmodules+=" geoip"
65         #use xdb && dynmodules+=" xdb"
66
67         econf \
68                 --disable-static \
69                 --sysconfdir=/etc/powerdns \
70                 --libdir=/usr/$(get_libdir)/powerdns \
71                 --with-modules= \
72                 --with-dynmodules="${dynmodules}" \
73                 --with-mysql-lib=/usr/$(get_libdir) \
74                 $(use_enable botan) \
75                 $(use_enable debug verbose-logging) \
76                 $(use_enable test unit-tests) \
77                 $(use_enable tools) \
78                 $(use_enable systemd) \
79                 $(use_enable sodium libsodium) \
80                 $(usex lua "$(use_with !luajit lua) $(use_with luajit)" \
81                         '--without-lua --without-luajit') \
82                 $(use_with protobuf) \
83                 ${myconf}
84 }
85
86 src_compile() {
87         default
88         use doc && emake -C codedocs codedocs
89 }
90
91 src_install() {
92         default
93
94         mv "${D}"/etc/powerdns/pdns.conf{-dist,}
95
96         fperms 0700 /etc/powerdns
97         fperms 0600 /etc/powerdns/pdns.conf
98
99         # set defaults: setuid=pdns, setgid=pdns
100         sed -i \
101                 -e 's/^# set\([ug]\)id=$/set\1id=pdns/g' \
102                 "${D}"/etc/powerdns/pdns.conf
103
104         newinitd "${FILESDIR}"/pdns-r1 pdns
105
106         keepdir /var/empty
107
108         if use doc; then
109                 docinto html
110                 dodoc -r codedocs/html/.
111         fi
112
113         # Install development headers
114         insinto /usr/include/pdns
115         doins pdns/*.hh
116         insinto /usr/include/pdns/backends/gsql
117         doins pdns/backends/gsql/*.hh
118
119         if use ldap ; then
120                 insinto /etc/openldap/schema
121                 doins "${FILESDIR}"/dnsdomain2.schema
122         fi
123
124         find "${D}" -name '*.la' -delete || die
125 }
126
127 pkg_preinst() {
128         enewgroup pdns
129         enewuser pdns -1 -1 /var/empty pdns
130 }
131
132 pkg_postinst() {
133         elog "PowerDNS provides multiple instances support. You can create more instances"
134         elog "by symlinking the pdns init script to another name."
135         elog
136         elog "The name must be in the format pdns.<suffix> and PowerDNS will use the"
137         elog "/etc/powerdns/pdns-<suffix>.conf configuration file instead of the default."
138
139         if use ldap ; then
140                 echo
141                 ewarn "The official LDAP backend module is only compile-tested by upstream."
142                 ewarn "Try net-dns/pdns-ldap-backend if you have problems with it."
143         fi
144
145         local old
146         for old in ${REPLACING_VERSIONS}; do
147                 ver_test ${old} -lt 3.2 || continue
148
149                 echo
150                 ewarn "To fix a security bug (bug #458018) had the following"
151                 ewarn "files/directories the world-readable bit removed (if set):"
152                 ewarn "  ${EPREFIX}/etc/powerdns"
153                 ewarn "  ${EPREFIX}/etc/powerdns/pdns.conf"
154                 ewarn "Check if this is correct for your setup"
155                 ewarn "This is a one-time change and will not happen on subsequent updates."
156                 chmod o-rwx "${EPREFIX}"/etc/powerdns/{,pdns.conf}
157
158                 break
159         done
160
161         if use postgres; then
162                 for old in ${REPLACING_VERSIONS}; do
163                         ver_test ${old} -lt 4.1.11-r1 || continue
164
165                         echo
166                         ewarn "PowerDNS 4.1.11 contains a security fix for the PostgreSQL backend."
167                         ewarn "This security fix needs to be applied manually to the database schema."
168                         ewarn "Please refer to the official security advisory for more information:"
169                         ewarn
170                         ewarn "  https://doc.powerdns.com/authoritative/security-advisories/powerdns-advisory-2019-06.html"
171
172                         break
173                 done
174         fi
175 }