]> git.ipfire.org Git - thirdparty/pdns.git/blame - builder-support/specs/pdns.spec
Merge pull request #13772 from mortenstevens/patch-1
[thirdparty/pdns.git] / builder-support / specs / pdns.spec
CommitLineData
968e651b
PL
1%global _hardened_build 1
2%global backends %{nil}
3
4Name: pdns
8ceb365e
PL
5Version: %{getenv:BUILDER_RPM_VERSION}
6Release: %{getenv:BUILDER_RPM_RELEASE}%{dist}
968e651b
PL
7Summary: A modern, advanced and high performance authoritative-only nameserver
8Group: System Environment/Daemons
9License: GPLv2
4ccb0f78 10Vendor: PowerDNS.COM BV
968e651b 11URL: https://powerdns.com
8ceb365e 12Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
968e651b 13
4a3fe2fc
GP
14Requires(post): systemd
15Requires(preun): systemd
16Requires(postun): systemd
b4d8324b 17BuildRequires: systemd
968e651b
PL
18BuildRequires: systemd-units
19BuildRequires: systemd-devel
20
4728ab89 21BuildRequires: krb5-devel
968e651b 22BuildRequires: p11-kit-devel
17477d10 23BuildRequires: libcurl-devel
6dac9c74 24%if 0%{?rhel} < 8 && 0%{?amzn} != 2023
6f7f89d9
PD
25BuildRequires: boost169-devel
26%else
38affa7f 27BuildRequires: boost-devel
6f7f89d9 28%endif
bce81446
PL
29BuildRequires: bison
30BuildRequires: openssl-devel
968e651b 31
6dac9c74
PD
32%if 0%{?amzn} != 2023
33BuildRequires: libsodium-devel
34%endif
35
968e651b 36Requires(pre): shadow-utils
bce81446 37
60ebc45e
PD
38%ifarch aarch64
39BuildRequires: lua-devel
92aa72d1 40%define lua_implementation lua
60ebc45e 41%else
968e651b 42BuildRequires: luajit-devel
92aa72d1 43%define lua_implementation luajit
60ebc45e 44%endif
968e651b
PL
45
46Provides: powerdns = %{version}-%{release}
47%global backends %{backends} bind
48
49%description
50The PowerDNS Nameserver is a modern, advanced and high performance
51authoritative-only nameserver. It is written from scratch and conforms
52to all relevant DNS standards documents.
53Furthermore, PowerDNS interfaces with almost any database.
54
55%package tools
56Summary: Extra tools for %{name}
57Group: System Environment/Daemons
58
59%description tools
60This package contains the extra tools for %{name}
61
62%package backend-mysql
63Summary: MySQL backend for %{name}
64Group: System Environment/Daemons
65Requires: %{name}%{?_isa} = %{version}-%{release}
6dac9c74 66%if 0%{?rhel} < 8 && 0%{?amzn} != 2023
968e651b 67BuildRequires: mysql-devel
fd0a94e9
PL
68%else
69BuildRequires: mariadb-connector-c-devel
70%endif
968e651b
PL
71%global backends %{backends} gmysql
72
73%description backend-mysql
74This package contains the gmysql backend for %{name}
75
76%package backend-postgresql
77Summary: PostgreSQL backend for %{name}
78Group: System Environment/Daemons
79Requires: %{name}%{?_isa} = %{version}-%{release}
80BuildRequires: postgresql-devel
81%global backends %{backends} gpgsql
82
83%description backend-postgresql
84This package contains the gpgsql backend for %{name}
85
86%package backend-pipe
87Summary: Pipe backend for %{name}
88Group: System Environment/Daemons
89Requires: %{name}%{?_isa} = %{version}-%{release}
90%global backends %{backends} pipe
91
92%description backend-pipe
93This package contains the pipe backend for %{name}
94
95%package backend-remote
96Summary: Remote backend for %{name}
97Group: System Environment/Daemons
98Requires: %{name}%{?_isa} = %{version}-%{release}
99%global backends %{backends} remote
100
101%description backend-remote
102This package contains the remote backend for %{name}
103
104%package backend-ldap
105Summary: LDAP backend for %{name}
106Group: System Environment/Daemons
107Requires: %{name}%{?_isa} = %{version}-%{release}
108BuildRequires: openldap-devel
109%global backends %{backends} ldap
110
111%description backend-ldap
112This package contains the LDAP backend for %{name}
113
578ed45d
PL
114%package backend-lua2
115Summary: Lua backend for %{name}
116Group: System Environment/Daemons
117Requires: %{name}%{?_isa} = %{version}-%{release}
118%global backends %{backends} lua2
119
120%description backend-lua2
121This package contains the lua2 backend for %{name}
122
968e651b
PL
123%package backend-sqlite
124Summary: SQLite backend for %{name}
125Group: System Environment/Daemons
126Requires: %{name}%{?_isa} = %{version}-%{release}
127BuildRequires: sqlite-devel
128%global backends %{backends} gsqlite3
129
130%description backend-sqlite
131This package contains the SQLite backend for %{name}
132
968e651b
PL
133%package backend-odbc
134Summary: UnixODBC backend for %{name}
135Group: System Environment/Daemons
136Requires: %{name}%{?_isa} = %{version}-%{release}
137BuildRequires: unixODBC-devel
138%global backends %{backends} godbc
139
140%description backend-odbc
141This package contains the godbc backend for %{name}
142
143%package backend-geoip
144Summary: Geo backend for %{name}
145Group: System Environment/Daemons
146Requires: %{name}%{?_isa} = %{version}-%{release}
147BuildRequires: yaml-cpp-devel
6dac9c74 148%if 0%{?rhel} < 9 && 0%{?amzn} != 2023
968e651b 149BuildRequires: geoip-devel
4728ab89 150%endif
c7e6c74d 151BuildRequires: libmaxminddb-devel
968e651b
PL
152%global backends %{backends} geoip
153
154%description backend-geoip
155This package contains the geoip backend for %{name}
156It allows different answers to DNS queries coming from different
157IP address ranges or based on the geoipgraphic location
158
d0d9195b
PL
159%package backend-lmdb
160Summary: LMDB backend for %{name}
161Group: System Environment/Daemons
162Requires: %{name}%{?_isa} = %{version}-%{release}
163BuildRequires: lmdb-devel
164%global backends %{backends} lmdb
165
166%description backend-lmdb
167This package contains the lmdb backend for %{name}
168
968e651b
PL
169%package backend-tinydns
170Summary: TinyDNS backend for %{name}
171Group: System Environment/Daemons
172Requires: %{name}%{?_isa} = %{version}-%{release}
173BuildRequires: tinycdb-devel
174%global backends %{backends} tinydns
175
176%description backend-tinydns
177This package contains the TinyDNS backend for %{name}
17477d10 178
d72871c6 179%if 0%{?amzn} != 2
17477d10
PL
180%package ixfrdist
181BuildRequires: yaml-cpp-devel
a71347a9 182Summary: A program to redistribute zones over AXFR and IXFR
17477d10
PL
183Group: System Environment/Daemons
184
185%description ixfrdist
186This package contains the ixfrdist program.
d72871c6 187%endif
968e651b
PL
188
189%prep
c7e6c74d 190%autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
968e651b
PL
191
192%build
193export CPPFLAGS="-DLDAP_DEPRECATED"
194
6f7f89d9
PD
195%if 0%{?rhel} < 8
196export CPPFLAGS=-I/usr/include/boost169
197export LDFLAGS=-L/usr/lib64/boost169
198%endif
199
968e651b 200%configure \
e5d38a0f 201 --enable-option-checking=fatal \
968e651b
PL
202 --sysconfdir=%{_sysconfdir}/%{name} \
203 --disable-static \
204 --disable-dependency-tracking \
205 --disable-silent-rules \
206 --with-modules='' \
92aa72d1 207 --with-lua=%{lua_implementation} \
9a205757 208 --with-dynmodules='%{backends}' \
968e651b 209 --enable-tools \
6dac9c74 210%if 0%{?amzn} != 2023
cb264691 211 --with-libsodium \
6dac9c74 212%endif
d72871c6
PD
213%if 0%{?amzn} != 2
214 --enable-ixfrdist \
215%endif
968e651b 216 --enable-unit-tests \
17477d10 217 --enable-lua-records \
968e651b 218 --enable-experimental-pkcs11 \
c70977c9 219 --enable-dns-over-tls \
d72871c6 220 --enable-systemd
968e651b 221
968e651b
PL
222make %{?_smp_mflags}
223
224%install
225make install DESTDIR=%{buildroot}
226
227%{__rm} -f %{buildroot}%{_libdir}/%{name}/*.la
228%{__rm} -rf %{buildroot}%{_docdir}
229
c3892519 230%{buildroot}/usr/sbin/pdns_server --config=default | sed \
968e651b
PL
231 -e 's!# daemon=.*!daemon=no!' \
232 -e 's!# guardian=.*!guardian=no!' \
233 -e 's!# launch=.*!&\\nlaunch=!' \
234 -e 's!# setgid=.*!setgid=pdns!' \
235 -e 's!# setuid=.*!setuid=pdns!' \
236 > %{buildroot}%{_sysconfdir}/%{name}/pdns.conf
237%{__rm} %{buildroot}%{_sysconfdir}/%{name}/pdns.conf-dist
238%{__rm} %{buildroot}/usr/bin/stubquery
239
240chmod 600 %{buildroot}%{_sysconfdir}/%{name}/pdns.conf
241
968e651b
PL
242# rename zone2ldap to pdns-zone2ldap (#1193116)
243%{__mv} %{buildroot}/%{_bindir}/zone2ldap %{buildroot}/%{_bindir}/pdns-zone2ldap
244%{__mv} %{buildroot}/%{_mandir}/man1/zone2ldap.1 %{buildroot}/%{_mandir}/man1/pdns-zone2ldap.1
968e651b 245
fac31e76
MS
246%{__install } -d %{buildroot}/%{_sharedstatedir}/%{name}
247
42bc9fae
O
248# The EL7 and 8 systemd actually supports %t, but its version number is older than that, so we do use seperate runtime dirs, but don't rely on RUNTIME_DIRECTORY
249%if 0%{?rhel} < 9
250sed -e 's!/pdns_server!& --socket-dir=%t/pdns!' -i %{buildroot}/%{_unitdir}/pdns.service
251%if 0%{?rhel} < 8
252sed -e 's!/pdns_server!& --socket-dir=%t/pdns-%i!' -e 's!RuntimeDirectory=pdns!&-%i!' -i %{buildroot}/%{_unitdir}/pdns@.service
253%endif
254%endif
255
968e651b
PL
256%check
257PDNS_TEST_NO_IPV6=1 make %{?_smp_mflags} -C pdns check || (cat pdns/test-suite.log && false)
258
259%pre
260getent group pdns >/dev/null || groupadd -r pdns
261getent passwd pdns >/dev/null || \
fac31e76
MS
262 useradd -r -g pdns -d /var/lib/pdns -s /sbin/nologin \
263 -c "PowerDNS Authoritative Server" pdns
264# Change home directory to /var/lib/pdns
265if [[ $(getent passwd pdns | cut -d: -f6) == "/" ]]; then
266 usermod -d /var/lib/pdns pdns
267fi
968e651b
PL
268exit 0
269
593eb1e6
PL
270%if 0%{?rhel} >= 7
271if [ "`stat -c '%U:%G' %{_sysconfdir}/%{name}`" = "root:root" ]; then
272 chown -R root:pdns /etc/powerdns
273 # Make sure that pdns can read it; the default used to be 0600
274 chmod g+r /etc/powerdns/pdns.conf
275fi
276chown -R pdns:pdns /var/lib/powerdns || :
277%endif
278
968e651b 279%post
b5179dca 280systemctl daemon-reload ||:
968e651b 281%systemd_post pdns.service
968e651b
PL
282
283%preun
968e651b 284%systemd_preun pdns.service
968e651b
PL
285
286%postun
968e651b 287%systemd_postun_with_restart pdns.service
968e651b
PL
288
289%files
bce81446 290%doc COPYING README
41d10782 291%doc pdns/bind-dnssec.4.2.0_to_4.3.0_schema.sqlite3.sql pdns/bind-dnssec.schema.sqlite3.sql
bce81446
PL
292%config(noreplace) %{_sysconfdir}/%{name}/pdns.conf
293%dir %{_libdir}/%{name}/
fac31e76 294%dir %attr(-,pdns,pdns) %{_sharedstatedir}/%{name}
bce81446 295%{_bindir}/pdns-zone2ldap
968e651b
PL
296%{_bindir}/pdns_control
297%{_bindir}/pdnsutil
968e651b 298%{_bindir}/zone2json
bce81446 299%{_bindir}/zone2sql
968e651b 300%{_libdir}/%{name}/libbindbackend.so
bce81446 301%{_mandir}/man1/pdns-zone2ldap.1.gz
968e651b
PL
302%{_mandir}/man1/pdns_control.1.gz
303%{_mandir}/man1/pdns_server.1.gz
968e651b 304%{_mandir}/man1/pdnsutil.1.gz
bce81446
PL
305%{_mandir}/man1/zone2json.1.gz
306%{_mandir}/man1/zone2sql.1.gz
307%{_sbindir}/pdns_server
968e651b
PL
308%{_unitdir}/pdns.service
309%{_unitdir}/pdns@.service
968e651b
PL
310
311%files tools
312%{_bindir}/calidns
bce81446 313%{_bindir}/dnsbulktest
968e651b 314%{_bindir}/dnsgram
bce81446
PL
315%{_bindir}/dnspcap2calidns
316%{_bindir}/dnspcap2protobuf
968e651b
PL
317%{_bindir}/dnsreplay
318%{_bindir}/dnsscan
319%{_bindir}/dnsscope
bce81446 320%{_bindir}/dnstcpbench
968e651b
PL
321%{_bindir}/dnswasher
322%{_bindir}/dumresp
323%{_bindir}/ixplore
968e651b
PL
324%{_bindir}/nproxy
325%{_bindir}/nsec3dig
bce81446 326%{_bindir}/pdns_notify
968e651b
PL
327%{_bindir}/saxfr
328%{_bindir}/sdig
329%{_mandir}/man1/calidns.1.gz
bce81446 330%{_mandir}/man1/dnsbulktest.1.gz
968e651b 331%{_mandir}/man1/dnsgram.1.gz
bce81446
PL
332%{_mandir}/man1/dnspcap2calidns.1.gz
333%{_mandir}/man1/dnspcap2protobuf.1.gz
968e651b
PL
334%{_mandir}/man1/dnsreplay.1.gz
335%{_mandir}/man1/dnsscan.1.gz
336%{_mandir}/man1/dnsscope.1.gz
bce81446 337%{_mandir}/man1/dnstcpbench.1.gz
968e651b
PL
338%{_mandir}/man1/dnswasher.1.gz
339%{_mandir}/man1/dumresp.1.gz
340%{_mandir}/man1/ixplore.1.gz
968e651b
PL
341%{_mandir}/man1/nproxy.1.gz
342%{_mandir}/man1/nsec3dig.1.gz
bce81446 343%{_mandir}/man1/pdns_notify.1.gz
968e651b
PL
344%{_mandir}/man1/saxfr.1.gz
345%{_mandir}/man1/sdig.1.gz
3e862940 346
968e651b
PL
347%files backend-mysql
348%doc modules/gmysqlbackend/schema.mysql.sql
349%doc modules/gmysqlbackend/dnssec-3.x_to_3.4.0_schema.mysql.sql
350%doc modules/gmysqlbackend/nodnssec-3.x_to_3.4.0_schema.mysql.sql
ce5b05d9
MN
351%doc modules/gmysqlbackend/3.4.0_to_4.1.0_schema.mysql.sql
352%doc modules/gmysqlbackend/4.1.0_to_4.2.0_schema.mysql.sql
353%doc modules/gmysqlbackend/4.2.0_to_4.3.0_schema.mysql.sql
20ad6428 354%doc modules/gmysqlbackend/4.3.0_to_4.7.0_schema.mysql.sql
96d5d109 355%doc modules/gmysqlbackend/enable-foreign-keys.mysql.sql
968e651b
PL
356%{_libdir}/%{name}/libgmysqlbackend.so
357
358%files backend-postgresql
359%doc modules/gpgsqlbackend/schema.pgsql.sql
360%doc modules/gpgsqlbackend/dnssec-3.x_to_3.4.0_schema.pgsql.sql
361%doc modules/gpgsqlbackend/nodnssec-3.x_to_3.4.0_schema.pgsql.sql
ce5b05d9
MN
362%doc modules/gpgsqlbackend/3.4.0_to_4.1.0_schema.pgsql.sql
363%doc modules/gpgsqlbackend/4.1.0_to_4.2.0_schema.pgsql.sql
364%doc modules/gpgsqlbackend/4.2.0_to_4.3.0_schema.pgsql.sql
20ad6428 365%doc modules/gpgsqlbackend/4.3.0_to_4.7.0_schema.pgsql.sql
968e651b
PL
366%{_libdir}/%{name}/libgpgsqlbackend.so
367
368%files backend-pipe
369%{_libdir}/%{name}/libpipebackend.so
370
371%files backend-remote
372%{_libdir}/%{name}/libremotebackend.so
373
374%files backend-ldap
375%{_libdir}/%{name}/libldapbackend.so
376
377%doc modules/ldapbackend/dnsdomain2.schema
378%doc modules/ldapbackend/pdns-domaininfo.schema
379
578ed45d
PL
380%files backend-lua2
381%{_libdir}/%{name}/liblua2backend.so
382
968e651b
PL
383%files backend-sqlite
384%doc modules/gsqlite3backend/schema.sqlite3.sql
385%doc modules/gsqlite3backend/dnssec-3.x_to_3.4.0_schema.sqlite3.sql
386%doc modules/gsqlite3backend/nodnssec-3.x_to_3.4.0_schema.sqlite3.sql
ce5b05d9
MN
387%doc modules/gsqlite3backend/3.4.0_to_4.0.0_schema.sqlite3.sql
388%doc modules/gsqlite3backend/4.0.0_to_4.2.0_schema.sqlite3.sql
389%doc modules/gsqlite3backend/4.2.0_to_4.3.0_schema.sqlite3.sql
7c9d0206 390%doc modules/gsqlite3backend/4.3.0_to_4.3.1_schema.sqlite3.sql
20ad6428 391%doc modules/gsqlite3backend/4.3.1_to_4.7.0_schema.sqlite3.sql
968e651b
PL
392%{_libdir}/%{name}/libgsqlite3backend.so
393
968e651b
PL
394%files backend-odbc
395%doc modules/godbcbackend/schema.mssql.sql
ce5b05d9
MN
396%doc modules/godbcbackend/4.0.0_to_4.2.0_schema.mssql.sql
397%doc modules/godbcbackend/4.2.0_to_4.3.0_schema.mssql.sql
20ad6428 398%doc modules/godbcbackend/4.3.0_to_4.7.0_schema.mssql.sql
968e651b
PL
399%{_libdir}/%{name}/libgodbcbackend.so
400
401%files backend-geoip
402%{_libdir}/%{name}/libgeoipbackend.so
403
d0d9195b
PL
404%files backend-lmdb
405%{_libdir}/%{name}/liblmdbbackend.so
406
968e651b
PL
407%files backend-tinydns
408%{_libdir}/%{name}/libtinydnsbackend.so
17477d10 409
d72871c6 410%if 0%{?amzn} != 2
17477d10
PL
411%files ixfrdist
412%{_bindir}/ixfrdist
413%{_mandir}/man1/ixfrdist.1.gz
414%{_mandir}/man5/ixfrdist.yml.5.gz
415%{_sysconfdir}/%{name}/ixfrdist.example.yml
416%{_unitdir}/ixfrdist.service
417%{_unitdir}/ixfrdist@.service
42bc9fae 418%endif