1 # Copyright 1999-2020 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="debug doc geoip ldap libressl luajit lua-records mydns mysql 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 !luajit? ( dev-lang/lua:= )
31 luajit? ( dev-lang/luajit:= )
32 lua-records? ( >=net-misc/curl-7.21.3 )
33 mysql? ( dev-db/mysql-connector-c:= )
34 postgres? ( dev-db/postgresql:= )
35 ldap? ( >=net-nds/openldap-2.0.27-r4 app-crypt/mit-krb5 )
36 sqlite? ( dev-db/sqlite:3 )
37 geoip? ( >=dev-cpp/yaml-cpp-0.5.1:= dev-libs/geoip )
38 sodium? ( dev-libs/libsodium:= )
39 tinydns? ( >=dev-db/tinycdb-0.77 )
40 protobuf? ( dev-libs/protobuf )"
46 BDEPEND="virtual/pkgconfig
47 doc? ( app-doc/doxygen )"
49 S="${WORKDIR}"/${P/_/-}
51 PATCHES=( "${FILESDIR}"/${P}-boost-1.73-compatibility.patch )
54 local dynmodules="pipe bind" # the default backends, always enabled
56 #use db2 && dynmodules+=" db2"
57 use ldap && dynmodules+=" ldap"
58 use mydns && dynmodules+=" mydns"
59 use mysql && dynmodules+=" gmysql"
60 #use oracle && dynmodules+=" goracle oracle"
61 use postgres && dynmodules+=" gpgsql"
62 use remote && dynmodules+=" remote"
63 use sqlite && dynmodules+=" gsqlite3"
64 use tinydns && dynmodules+=" tinydns"
65 use geoip && dynmodules+=" geoip"
66 #use xdb && dynmodules+=" xdb"
70 --sysconfdir=/etc/powerdns \
71 --libdir=/usr/$(get_libdir)/powerdns \
73 --with-dynmodules="${dynmodules}" \
74 --with-mysql-lib=/usr/$(get_libdir) \
75 --with-lua=$(usex luajit luajit lua) \
76 $(use_enable debug verbose-logging) \
77 $(use_enable lua-records) \
78 $(use_enable test unit-tests) \
80 $(use_enable systemd) \
81 $(use_with sodium libsodium) \
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
128 elog "PowerDNS provides multiple instances support. You can create more instances"
129 elog "by symlinking the pdns init script to another name."
131 elog "The name must be in the format pdns.<suffix> and PowerDNS will use the"
132 elog "/etc/powerdns/pdns-<suffix>.conf configuration file instead of the default."
136 ewarn "The official LDAP backend module is only compile-tested by upstream."
137 ewarn "Try net-dns/pdns-ldap-backend if you have problems with it."
141 for old in ${REPLACING_VERSIONS}; do
142 ver_test ${old} -lt 3.2 || continue
145 ewarn "To fix a security bug (bug #458018) had the following"
146 ewarn "files/directories the world-readable bit removed (if set):"
147 ewarn " ${EPREFIX}/etc/powerdns"
148 ewarn " ${EPREFIX}/etc/powerdns/pdns.conf"
149 ewarn "Check if this is correct for your setup"
150 ewarn "This is a one-time change and will not happen on subsequent updates."
151 chmod o-rwx "${EPREFIX}"/etc/powerdns/{,pdns.conf}
156 if use postgres; then
157 for old in ${REPLACING_VERSIONS}; do
158 ver_test ${old} -lt 4.1.11-r1 || continue
161 ewarn "PowerDNS 4.1.11 contains a security fix for the PostgreSQL backend."
162 ewarn "This security fix needs to be applied manually to the database schema."
163 ewarn "Please refer to the official security advisory for more information:"
165 ewarn " https://doc.powerdns.com/authoritative/security-advisories/powerdns-advisory-2019-06.html"