dev-qt/qttest: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / net-dns / pdns / pdns-4.3.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit multilib
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="debug doc geoip ldap libressl luajit lua-records mydns mysql 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         !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 )"
41 DEPEND="${RDEPEND}"
42 RDEPEND="${RDEPEND}
43         acct-user/pdns
44         acct-group/pdns"
45
46 BDEPEND="virtual/pkgconfig
47         doc? ( app-doc/doxygen )"
48
49 S="${WORKDIR}"/${P/_/-}
50
51 PATCHES=( "${FILESDIR}"/${P}-boost-1.73-compatibility.patch )
52
53 src_configure() {
54         local dynmodules="pipe bind" # the default backends, always enabled
55
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"
67
68         econf \
69                 --disable-static \
70                 --sysconfdir=/etc/powerdns \
71                 --libdir=/usr/$(get_libdir)/powerdns \
72                 --with-modules= \
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) \
79                 $(use_enable tools) \
80                 $(use_enable systemd) \
81                 $(use_with sodium libsodium) \
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_postinst() {
128         elog "PowerDNS provides multiple instances support. You can create more instances"
129         elog "by symlinking the pdns init script to another name."
130         elog
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."
133
134         if use ldap ; then
135                 echo
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."
138         fi
139
140         local old
141         for old in ${REPLACING_VERSIONS}; do
142                 ver_test ${old} -lt 3.2 || continue
143
144                 echo
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}
152
153                 break
154         done
155
156         if use postgres; then
157                 for old in ${REPLACING_VERSIONS}; do
158                         ver_test ${old} -lt 4.1.11-r1 || continue
159
160                         echo
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:"
164                         ewarn
165                         ewarn "  https://doc.powerdns.com/authoritative/security-advisories/powerdns-advisory-2019-06.html"
166
167                         break
168                 done
169         fi
170 }