1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
8 DESCRIPTION="The PowerDNS Daemon"
9 HOMEPAGE="https://www.powerdns.com/"
10 SRC_URI="https://downloads.powerdns.com/releases/${P/_/-}.tar.bz2"
16 # other possible flags:
17 # db2: we lack the dep
18 # oracle: dito (need Oracle Client Libraries)
19 # xdb: (almost) dead, surely not supported
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 )"
24 REQUIRED_USE="mydns? ( mysql )"
27 libressl? ( dev-libs/libressl:= )
28 !libressl? ( dev-libs/openssl:= )
29 >=dev-libs/boost-1.35:=
30 botan? ( dev-libs/botan:2= )
32 !luajit? ( dev-lang/lua:= )
33 luajit? ( dev-lang/luajit:= )
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 )"
45 BDEPEND="virtual/pkgconfig
46 doc? ( app-doc/doxygen )"
48 S="${WORKDIR}"/${P/_/-}
51 local dynmodules="pipe bind" # the default backends, always enabled
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"
69 --sysconfdir=/etc/powerdns \
70 --libdir=/usr/$(get_libdir)/powerdns \
72 --with-dynmodules="${dynmodules}" \
73 --with-mysql-lib=/usr/$(get_libdir) \
75 $(use_enable debug verbose-logging) \
76 $(use_enable test unit-tests) \
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) \
88 use doc && emake -C codedocs codedocs
94 mv "${D}"/etc/powerdns/pdns.conf{-dist,}
96 fperms 0700 /etc/powerdns
97 fperms 0600 /etc/powerdns/pdns.conf
99 # set defaults: setuid=pdns, setgid=pdns
101 -e 's/^# set\([ug]\)id=$/set\1id=pdns/g' \
102 "${D}"/etc/powerdns/pdns.conf
104 newinitd "${FILESDIR}"/pdns-r1 pdns
110 dodoc -r codedocs/html/.
113 # Install development headers
114 insinto /usr/include/pdns
116 insinto /usr/include/pdns/backends/gsql
117 doins pdns/backends/gsql/*.hh
120 insinto /etc/openldap/schema
121 doins "${FILESDIR}"/dnsdomain2.schema
124 find "${D}" -name '*.la' -delete || die
129 enewuser pdns -1 -1 /var/empty pdns
133 elog "PowerDNS provides multiple instances support. You can create more instances"
134 elog "by symlinking the pdns init script to another name."
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."
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."
146 for old in ${REPLACING_VERSIONS}; do
147 ver_test ${old} -lt 3.2 || continue
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}
161 if use postgres; then
162 for old in ${REPLACING_VERSIONS}; do
163 ver_test ${old} -lt 4.1.11-r1 || continue
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:"
170 ewarn " https://doc.powerdns.com/authoritative/security-advisories/powerdns-advisory-2019-06.html"