app-admin/sysstat: fix from Chromium OS for unaligned memory errors
[gentoo.git] / net-dns / pdns / pdns-4.0.3-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit eutils multilib user toolchain-funcs versionator
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 lua luajit mydns mysql opendbx postgres protobuf remote sqlite systemd tools tinydns test"
22
23 REQUIRED_USE="mydns? ( mysql ) ?? ( lua luajit )"
24
25 RDEPEND="
26         dev-libs/openssl:=
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 )"
39 DEPEND="${RDEPEND}
40         virtual/pkgconfig
41         doc? ( app-doc/doxygen )"
42
43 S="${WORKDIR}"/${P/_/-}
44
45 src_configure() {
46         local dynmodules="pipe bind" # the default backends, always enabled
47
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"
61
62         econf \
63                 --disable-static \
64                 --sysconfdir=/etc/powerdns \
65                 --libdir=/usr/$(get_libdir)/powerdns \
66                 --with-modules= \
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) \
74                 $(use_enable tools) \
75                 $(use_enable systemd) \
76                 $(use_with lua) \
77                 $(use_with luajit) \
78                 $(use_with protobuf) \
79                 ${myconf}
80 }
81
82 src_compile() {
83         default
84         use doc && emake -C codedocs codedocs
85 }
86
87 src_install() {
88         default
89
90         mv "${D}"/etc/powerdns/pdns.conf{-dist,}
91
92         fperms 0700 /etc/powerdns
93         fperms 0600 /etc/powerdns/pdns.conf
94
95         # set defaults: setuid=pdns, setgid=pdns
96         sed -i \
97                 -e 's/^# set\([ug]\)id=$/set\1id=pdns/g' \
98                 "${D}"/etc/powerdns/pdns.conf
99
100         newinitd "${FILESDIR}"/pdns-r1 pdns
101
102         keepdir /var/empty
103
104         use doc && dohtml -r codedocs/html/.
105
106         # Install development headers
107         insinto /usr/include/pdns
108         doins pdns/*.hh
109         insinto /usr/include/pdns/backends/gsql
110         doins pdns/backends/gsql/*.hh
111
112         if use ldap ; then
113                 insinto /etc/openldap/schema
114                 doins "${FILESDIR}"/dnsdomain2.schema
115         fi
116
117         prune_libtool_files --all
118 }
119
120 pkg_preinst() {
121         enewgroup pdns
122         enewuser pdns -1 -1 /var/empty pdns
123 }
124
125 pkg_postinst() {
126         elog "PowerDNS provides multiple instances support. You can create more instances"
127         elog "by symlinking the pdns init script to another name."
128         elog
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."
131
132         if use ldap ; then
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."
135         fi
136
137         local old
138         for old in ${REPLACING_VERSIONS}; do
139                 version_compare ${old} 3.2
140                 [[ $? -eq 1 ]] || continue
141
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}
149
150                 break
151         done
152 }