]>
Commit | Line | Data |
---|---|---|
968e651b PL |
1 | %if 0%{?rhel} < 6 |
2 | exit 1 | |
3 | %endif | |
4 | ||
5 | # Only works on EL7 | |
6 | %global _hardened_build 1 | |
7 | %global backends %{nil} | |
8 | ||
9 | Name: pdns | |
10 | Version: %{getenv:BUILDER_VERSION} | |
11 | Release: %{getenv:BUILDER_RELEASE}%{dist} | |
12 | Summary: A modern, advanced and high performance authoritative-only nameserver | |
13 | Group: System Environment/Daemons | |
14 | License: GPLv2 | |
15 | URL: https://powerdns.com | |
16 | Source0: %{name}-%{version}.tar.bz2 | |
17 | %if 0%{?rhel} < 7 | |
18 | Source1: pdns.init | |
19 | %endif | |
20 | ||
21 | %if 0%{?rhel} >= 7 | |
22 | Requires(post): systemd-sysv | |
23 | Requires(post): systemd-units | |
24 | Requires(preun): systemd-units | |
25 | Requires(postun): systemd-units | |
26 | BuildRequires: systemd-units | |
27 | BuildRequires: systemd-devel | |
28 | ||
29 | BuildRequires: protobuf-devel | |
30 | BuildRequires: protobuf-compiler | |
31 | BuildRequires: p11-kit-devel | |
32 | %endif | |
33 | ||
34 | Requires(pre): shadow-utils | |
35 | BuildRequires: luajit-devel | |
36 | BuildRequires: boost-devel | |
37 | BuildRequires: libsodium-devel | |
38 | BuildRequires: bison | |
39 | BuildRequires: openssl-devel | |
40 | ||
41 | Provides: powerdns = %{version}-%{release} | |
42 | %global backends %{backends} bind | |
43 | ||
44 | %description | |
45 | The PowerDNS Nameserver is a modern, advanced and high performance | |
46 | authoritative-only nameserver. It is written from scratch and conforms | |
47 | to all relevant DNS standards documents. | |
48 | Furthermore, PowerDNS interfaces with almost any database. | |
49 | ||
50 | %package tools | |
51 | Summary: Extra tools for %{name} | |
52 | Group: System Environment/Daemons | |
53 | ||
54 | %description tools | |
55 | This package contains the extra tools for %{name} | |
56 | ||
57 | %package backend-mysql | |
58 | Summary: MySQL backend for %{name} | |
59 | Group: System Environment/Daemons | |
60 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
61 | BuildRequires: mysql-devel | |
62 | %global backends %{backends} gmysql | |
63 | ||
64 | %description backend-mysql | |
65 | This package contains the gmysql backend for %{name} | |
66 | ||
67 | %package backend-postgresql | |
68 | Summary: PostgreSQL backend for %{name} | |
69 | Group: System Environment/Daemons | |
70 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
71 | BuildRequires: postgresql-devel | |
72 | %global backends %{backends} gpgsql | |
73 | ||
74 | %description backend-postgresql | |
75 | This package contains the gpgsql backend for %{name} | |
76 | ||
77 | %package backend-pipe | |
78 | Summary: Pipe backend for %{name} | |
79 | Group: System Environment/Daemons | |
80 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
81 | %global backends %{backends} pipe | |
82 | ||
83 | %description backend-pipe | |
84 | This package contains the pipe backend for %{name} | |
85 | ||
86 | %package backend-remote | |
87 | Summary: Remote backend for %{name} | |
88 | Group: System Environment/Daemons | |
89 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
90 | %global backends %{backends} remote | |
91 | ||
92 | %description backend-remote | |
93 | This package contains the remote backend for %{name} | |
94 | ||
95 | %package backend-ldap | |
96 | Summary: LDAP backend for %{name} | |
97 | Group: System Environment/Daemons | |
98 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
99 | BuildRequires: openldap-devel | |
100 | %global backends %{backends} ldap | |
101 | ||
102 | %description backend-ldap | |
103 | This package contains the LDAP backend for %{name} | |
104 | ||
105 | %package backend-lua | |
106 | Summary: Lua backend for %{name} | |
107 | Group: System Environment/Daemons | |
108 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
109 | %global backends %{backends} lua | |
110 | ||
111 | %description backend-lua | |
112 | This package contains the lua backend for %{name} | |
113 | ||
114 | %package backend-sqlite | |
115 | Summary: SQLite backend for %{name} | |
116 | Group: System Environment/Daemons | |
117 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
118 | BuildRequires: sqlite-devel | |
119 | %global backends %{backends} gsqlite3 | |
120 | ||
121 | %description backend-sqlite | |
122 | This package contains the SQLite backend for %{name} | |
123 | ||
124 | %package backend-mydns | |
125 | Summary: MyDNS backend for %{name} | |
126 | Group: System Environment/Daemons | |
127 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
128 | %global backends %{backends} mydns | |
129 | ||
130 | %description backend-mydns | |
131 | This package contains the MyDNS backend for %{name} | |
132 | ||
133 | %if 0%{?rhel} >= 7 | |
134 | %package backend-odbc | |
135 | Summary: UnixODBC backend for %{name} | |
136 | Group: System Environment/Daemons | |
137 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
138 | BuildRequires: unixODBC-devel | |
139 | %global backends %{backends} godbc | |
140 | ||
141 | %description backend-odbc | |
142 | This package contains the godbc backend for %{name} | |
143 | ||
144 | %package backend-geoip | |
145 | Summary: Geo backend for %{name} | |
146 | Group: System Environment/Daemons | |
147 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
148 | BuildRequires: yaml-cpp-devel | |
149 | BuildRequires: geoip-devel | |
150 | %global backends %{backends} geoip | |
151 | ||
152 | %description backend-geoip | |
153 | This package contains the geoip backend for %{name} | |
154 | It allows different answers to DNS queries coming from different | |
155 | IP address ranges or based on the geoipgraphic location | |
156 | ||
157 | %package backend-tinydns | |
158 | Summary: TinyDNS backend for %{name} | |
159 | Group: System Environment/Daemons | |
160 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
161 | BuildRequires: tinycdb-devel | |
162 | %global backends %{backends} tinydns | |
163 | ||
164 | %description backend-tinydns | |
165 | This package contains the TinyDNS backend for %{name} | |
166 | %endif | |
167 | ||
168 | %prep | |
169 | %setup -q -n %{name}-%{version} | |
170 | ||
171 | %build | |
172 | export CPPFLAGS="-DLDAP_DEPRECATED" | |
173 | ||
174 | %configure \ | |
175 | --sysconfdir=%{_sysconfdir}/%{name} \ | |
176 | --disable-static \ | |
177 | --disable-dependency-tracking \ | |
178 | --disable-silent-rules \ | |
179 | --with-modules='' \ | |
180 | --with-luajit \ | |
181 | --with-dynmodules='%{backends} random' \ | |
182 | --enable-tools \ | |
183 | --enable-libsodium \ | |
184 | --enable-unit-tests \ | |
185 | %if 0%{?rhel} >= 7 | |
186 | --enable-experimental-pkcs11 \ | |
187 | --enable-systemd | |
188 | %else | |
189 | --without-protobuf | |
190 | %endif | |
191 | ||
192 | ||
193 | make %{?_smp_mflags} | |
194 | ||
195 | %install | |
196 | make install DESTDIR=%{buildroot} | |
197 | ||
198 | %{__rm} -f %{buildroot}%{_libdir}/%{name}/*.la | |
199 | %{__rm} -rf %{buildroot}%{_docdir} | |
200 | ||
201 | %if 0%{?rhel} == 6 | |
202 | %{__install} -D -p %{SOURCE1} %{buildroot}%{_initrddir}/pdns | |
203 | %endif | |
204 | ||
205 | %{buildroot}/usr/sbin/pdns_server --no-config --config | sed \ | |
206 | -e 's!# daemon=.*!daemon=no!' \ | |
207 | -e 's!# guardian=.*!guardian=no!' \ | |
208 | -e 's!# launch=.*!&\\nlaunch=!' \ | |
209 | -e 's!# setgid=.*!setgid=pdns!' \ | |
210 | -e 's!# setuid=.*!setuid=pdns!' \ | |
211 | > %{buildroot}%{_sysconfdir}/%{name}/pdns.conf | |
212 | %{__rm} %{buildroot}%{_sysconfdir}/%{name}/pdns.conf-dist | |
213 | %{__rm} %{buildroot}/usr/bin/stubquery | |
214 | ||
215 | chmod 600 %{buildroot}%{_sysconfdir}/%{name}/pdns.conf | |
216 | ||
217 | %if 0%{?rhel} >= 7 | |
218 | # rename zone2ldap to pdns-zone2ldap (#1193116) | |
219 | %{__mv} %{buildroot}/%{_bindir}/zone2ldap %{buildroot}/%{_bindir}/pdns-zone2ldap | |
220 | %{__mv} %{buildroot}/%{_mandir}/man1/zone2ldap.1 %{buildroot}/%{_mandir}/man1/pdns-zone2ldap.1 | |
221 | %endif | |
222 | ||
223 | %check | |
224 | PDNS_TEST_NO_IPV6=1 make %{?_smp_mflags} -C pdns check || (cat pdns/test-suite.log && false) | |
225 | ||
226 | %pre | |
227 | getent group pdns >/dev/null || groupadd -r pdns | |
228 | getent passwd pdns >/dev/null || \ | |
229 | useradd -r -g pdns -d / -s /sbin/nologin \ | |
230 | -c "PowerDNS user" pdns | |
231 | exit 0 | |
232 | ||
233 | %post | |
234 | %if 0%{?rhel} >= 7 | |
235 | %systemd_post pdns.service | |
236 | %else | |
237 | /sbin/chkconfig --add pdns | |
238 | %endif | |
239 | ||
240 | %preun | |
241 | %if 0%{?rhel} >= 7 | |
242 | %systemd_preun pdns.service | |
243 | %else | |
244 | if [ \$1 -eq 0 ]; then | |
245 | /sbin/service pdns stop >/dev/null 2>&1 || : | |
246 | /sbin/chkconfig --del pdns | |
247 | fi | |
248 | %endif | |
249 | ||
250 | %postun | |
251 | %if 0%{?rhel} >= 7 | |
252 | %systemd_postun_with_restart pdns.service | |
253 | %else | |
254 | if [ \$1 -ge 1 ]; then | |
255 | /sbin/service pdns condrestart >/dev/null 2>&1 || : | |
256 | fi | |
257 | %endif | |
258 | ||
259 | %files | |
260 | %doc COPYING README | |
261 | %{_bindir}/pdns_control | |
262 | %{_bindir}/pdnsutil | |
263 | %{_bindir}/zone2sql | |
264 | %{_bindir}/zone2json | |
265 | %{_sbindir}/pdns_server | |
266 | %{_libdir}/%{name}/libbindbackend.so | |
267 | %{_mandir}/man1/pdns_control.1.gz | |
268 | %{_mandir}/man1/pdns_server.1.gz | |
269 | %{_mandir}/man1/zone2sql.1.gz | |
270 | %{_mandir}/man1/zone2json.1.gz | |
271 | %{_mandir}/man1/pdnsutil.1.gz | |
272 | %dir %{_libdir}/%{name}/ | |
273 | %{_libdir}/%{name}/librandombackend.so | |
274 | %dir %{_sysconfdir}/%{name}/ | |
275 | %config(noreplace) %{_sysconfdir}/%{name}/pdns.conf | |
276 | ||
277 | %if 0%{?rhel} >= 7 | |
278 | %{_bindir}/pdns-zone2ldap | |
279 | %{_mandir}/man1/pdns-zone2ldap.1.gz | |
280 | %{_unitdir}/pdns.service | |
281 | %{_unitdir}/pdns@.service | |
282 | %else | |
283 | %{_bindir}/zone2ldap | |
284 | %{_mandir}/man1/zone2ldap.1.gz | |
285 | %{_initrddir}/pdns | |
286 | %endif | |
287 | ||
288 | %files tools | |
289 | %{_bindir}/calidns | |
290 | %{_bindir}/dnsgram | |
291 | %{_bindir}/dnsreplay | |
292 | %{_bindir}/dnsscan | |
293 | %{_bindir}/dnsscope | |
294 | %{_bindir}/dnswasher | |
295 | %{_bindir}/dumresp | |
296 | %{_bindir}/ixplore | |
297 | %{_bindir}/pdns_notify | |
298 | %{_bindir}/nproxy | |
299 | %{_bindir}/nsec3dig | |
300 | %{_bindir}/saxfr | |
301 | %{_bindir}/sdig | |
302 | %{_mandir}/man1/calidns.1.gz | |
303 | %{_mandir}/man1/dnsgram.1.gz | |
304 | %{_mandir}/man1/dnsreplay.1.gz | |
305 | %{_mandir}/man1/dnsscan.1.gz | |
306 | %{_mandir}/man1/dnsscope.1.gz | |
307 | %{_mandir}/man1/dnswasher.1.gz | |
308 | %{_mandir}/man1/dumresp.1.gz | |
309 | %{_mandir}/man1/ixplore.1.gz | |
310 | %{_mandir}/man1/pdns_notify.1.gz | |
311 | %{_mandir}/man1/nproxy.1.gz | |
312 | %{_mandir}/man1/nsec3dig.1.gz | |
313 | %{_mandir}/man1/saxfr.1.gz | |
314 | %{_mandir}/man1/sdig.1.gz | |
315 | %if 0%{?rhel} >= 7 | |
316 | %{_bindir}/dnsbulktest | |
317 | %{_bindir}/dnspcap2protobuf | |
318 | %{_bindir}/dnstcpbench | |
319 | %{_mandir}/man1/dnsbulktest.1.gz | |
320 | %{_mandir}/man1/dnspcap2protobuf.1.gz | |
321 | %{_mandir}/man1/dnstcpbench.1.gz | |
322 | %endif | |
323 | ||
324 | %files backend-mysql | |
325 | %doc modules/gmysqlbackend/schema.mysql.sql | |
326 | %doc modules/gmysqlbackend/dnssec-3.x_to_3.4.0_schema.mysql.sql | |
327 | %doc modules/gmysqlbackend/nodnssec-3.x_to_3.4.0_schema.mysql.sql | |
328 | %{_libdir}/%{name}/libgmysqlbackend.so | |
329 | ||
330 | %files backend-postgresql | |
331 | %doc modules/gpgsqlbackend/schema.pgsql.sql | |
332 | %doc modules/gpgsqlbackend/dnssec-3.x_to_3.4.0_schema.pgsql.sql | |
333 | %doc modules/gpgsqlbackend/nodnssec-3.x_to_3.4.0_schema.pgsql.sql | |
334 | %{_libdir}/%{name}/libgpgsqlbackend.so | |
335 | ||
336 | %files backend-pipe | |
337 | %{_libdir}/%{name}/libpipebackend.so | |
338 | ||
339 | %files backend-remote | |
340 | %{_libdir}/%{name}/libremotebackend.so | |
341 | ||
342 | %files backend-ldap | |
343 | %{_libdir}/%{name}/libldapbackend.so | |
344 | ||
345 | %doc modules/ldapbackend/dnsdomain2.schema | |
346 | %doc modules/ldapbackend/pdns-domaininfo.schema | |
347 | ||
348 | %files backend-lua | |
349 | %{_libdir}/%{name}/libluabackend.so | |
350 | ||
351 | %files backend-sqlite | |
352 | %doc modules/gsqlite3backend/schema.sqlite3.sql | |
353 | %doc modules/gsqlite3backend/dnssec-3.x_to_3.4.0_schema.sqlite3.sql | |
354 | %doc modules/gsqlite3backend/nodnssec-3.x_to_3.4.0_schema.sqlite3.sql | |
355 | %{_libdir}/%{name}/libgsqlite3backend.so | |
356 | ||
357 | %files backend-mydns | |
358 | %doc modules/mydnsbackend/schema.mydns.sql | |
359 | %{_libdir}/%{name}/libmydnsbackend.so | |
360 | ||
361 | %if 0%{?rhel} >= 7 | |
362 | %files backend-odbc | |
363 | %doc modules/godbcbackend/schema.mssql.sql | |
364 | %{_libdir}/%{name}/libgodbcbackend.so | |
365 | ||
366 | %files backend-geoip | |
367 | %{_libdir}/%{name}/libgeoipbackend.so | |
368 | ||
369 | %files backend-tinydns | |
370 | %{_libdir}/%{name}/libtinydnsbackend.so | |
371 | %endif |