1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils multilib user toolchain-funcs versionator
8 DESCRIPTION="The PowerDNS Daemon"
9 HOMEPAGE="https://www.powerdns.com/"
10 SRC_URI="https://downloads.powerdns.com/releases/${P/_/-}.tar.bz2"
14 KEYWORDS="~amd64 ~x86"
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 lua luajit mydns mysql opendbx postgres protobuf remote sqlite systemd tools tinydns test"
23 REQUIRED_USE="mydns? ( mysql ) ?? ( lua luajit )"
27 >=dev-libs/boost-1.35:=
28 botan? ( =dev-libs/botan-1.10*[threads] )
29 lua? ( dev-lang/lua:= )
30 luajit? ( dev-lang/luajit:= )
31 mysql? ( virtual/mysql )
32 postgres? ( dev-db/postgresql:= )
33 ldap? ( >=net-nds/openldap-2.0.27-r4 )
34 sqlite? ( dev-db/sqlite:3 )
35 opendbx? ( dev-db/opendbx )
36 geoip? ( >=dev-cpp/yaml-cpp-0.5.1 dev-libs/geoip )
37 tinydns? ( >=dev-db/tinycdb-0.77 )
38 protobuf? ( dev-libs/protobuf )"
41 doc? ( app-doc/doxygen )"
43 S="${WORKDIR}"/${P/_/-}
46 local dynmodules="pipe bind" # the default backends, always enabled
48 #use db2 && dynmodules+=" db2"
49 use ldap && dynmodules+=" ldap"
50 use lua && dynmodules+=" lua"
51 use mydns && dynmodules+=" mydns"
52 use mysql && dynmodules+=" gmysql"
53 use opendbx && dynmodules+=" opendbx"
54 #use oracle && dynmodules+=" goracle oracle"
55 use postgres && dynmodules+=" gpgsql"
56 use remote && dynmodules+=" remote"
57 use sqlite && dynmodules+=" gsqlite3"
58 use tinydns && dynmodules+=" tinydns"
59 use geoip && dynmodules+=" geoip"
60 #use xdb && dynmodules+=" xdb"
64 --sysconfdir=/etc/powerdns \
65 --libdir=/usr/$(get_libdir)/powerdns \
67 --with-dynmodules="${dynmodules}" \
68 --with-pgsql-includes=/usr/include \
69 --with-pgsql-lib=/usr/$(get_libdir) \
70 --with-mysql-lib=/usr/$(get_libdir) \
71 $(use_enable botan botan1.10) \
72 $(use_enable debug verbose-logging) \
73 $(use_enable test unit-tests) \
75 $(use_enable systemd) \
78 $(use_with protobuf) \
84 use doc && emake -C codedocs codedocs
90 mv "${D}"/etc/powerdns/pdns.conf{-dist,}
92 fperms 0700 /etc/powerdns
93 fperms 0600 /etc/powerdns/pdns.conf
95 # set defaults: setuid=pdns, setgid=pdns
97 -e 's/^# set\([ug]\)id=$/set\1id=pdns/g' \
98 "${D}"/etc/powerdns/pdns.conf
100 newinitd "${FILESDIR}"/pdns-r1 pdns
104 use doc && dohtml -r codedocs/html/.
106 # Install development headers
107 insinto /usr/include/pdns
109 insinto /usr/include/pdns/backends/gsql
110 doins pdns/backends/gsql/*.hh
113 insinto /etc/openldap/schema
114 doins "${FILESDIR}"/dnsdomain2.schema
117 prune_libtool_files --all
122 enewuser pdns -1 -1 /var/empty pdns
126 elog "PowerDNS provides multiple instances support. You can create more instances"
127 elog "by symlinking the pdns init script to another name."
129 elog "The name must be in the format pdns.<suffix> and PowerDNS will use the"
130 elog "/etc/powerdns/pdns-<suffix>.conf configuration file instead of the default."
133 ewarn "The official LDAP backend module is only compile-tested by upstream."
134 ewarn "Try net-dns/pdns-ldap-backend if you have problems with it."
138 for old in ${REPLACING_VERSIONS}; do
139 version_compare ${old} 3.2
140 [[ $? -eq 1 ]] || continue
142 ewarn "To fix a security bug (bug #458018) had the following"
143 ewarn "files/directories the world-readable bit removed (if set):"
144 ewarn " ${EPREFIX}/etc/powerdns"
145 ewarn " ${EPREFIX}/etc/powerdns/pdns.conf"
146 ewarn "Check if this is correct for your setup"
147 ewarn "This is a one-time change and will not happen on subsequent updates."
148 chmod o-rwx "${EPREFIX}"/etc/powerdns/{,pdns.conf}