]> git.ipfire.org Git - thirdparty/pdns.git/blob - builder-support/specs/pdns-recursor.spec
Merge pull request #11309 from Habbie/lmdb-random-id
[thirdparty/pdns.git] / builder-support / specs / pdns-recursor.spec
1 Name: pdns-recursor
2 Version: %{getenv:BUILDER_RPM_VERSION}
3 Release: %{getenv:BUILDER_RPM_RELEASE}%{?dist}
4 Summary: Modern, advanced and high performance recursing/non authoritative name server
5 Group: System Environment/Daemons
6 License: GPLv2
7 URL: https://powerdns.com
8 Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
9
10 Provides: powerdns-recursor = %{version}-%{release}
11
12 %if 0%{?rhel} < 8
13 BuildRequires: boost169-devel
14 %else
15 BuildRequires: boost-devel
16 %endif
17 BuildRequires: libcap-devel
18 BuildRequires: systemd
19 BuildRequires: systemd-devel
20 BuildRequires: openssl-devel
21 BuildRequires: net-snmp-devel
22 BuildRequires: libsodium-devel
23 BuildRequires: fstrm-devel
24 BuildRequires: libcurl-devel
25
26 %ifarch aarch64
27 BuildRequires: lua-devel
28 %define lua_implementation lua
29 %else
30 BuildRequires: luajit-devel
31 %define lua_implementation luajit
32 %endif
33
34 %ifarch ppc64 ppc64le
35 BuildRequires: libatomic
36 %endif
37
38 Requires(pre): shadow-utils
39 %systemd_requires
40
41 %description
42 PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
43 package if you need a dns cache for your network.
44
45
46 %prep
47 %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
48
49 %build
50 %if 0%{?rhel} < 8
51 export CPPFLAGS=-I/usr/include/boost169
52 export LDFLAGS=-L/usr/lib64/boost169
53 %endif
54
55 %configure \
56 --enable-option-checking=fatal \
57 --sysconfdir=%{_sysconfdir}/%{name} \
58 --with-libsodium \
59 --with-net-snmp \
60 --disable-silent-rules \
61 --disable-static \
62 --enable-unit-tests \
63 --enable-dns-over-tls \
64 --enable-dnstap \
65 --with-libcap \
66 --with-lua=%{lua_implementation} \
67 --enable-systemd --with-systemd=%{_unitdir}
68
69 make %{?_smp_mflags}
70
71 %check
72 make %{?_smp_mflags} check || (cat test-suite.log && false)
73
74 %install
75 make install DESTDIR=%{buildroot}
76
77 %{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,}
78
79 # change user and group to pdns-recursor
80 sed -i \
81 -e 's/# setuid=/setuid=pdns-recursor/' \
82 -e 's/# setgid=/setgid=pdns-recursor/' \
83 %{buildroot}%{_sysconfdir}/%{name}/recursor.conf
84
85 # 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
86 %if 0%{?rhel} < 9
87 sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor!' -i %{buildroot}/%{_unitdir}/pdns-recursor.service
88 %if 0%{?rhel} < 8
89 sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor-%i!' -e 's!RuntimeDirectory=pdns-recursor!&-%i!' -i %{buildroot}/%{_unitdir}/pdns-recursor@.service
90 %endif
91 %endif
92
93 %pre
94 getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor
95 getent passwd pdns-recursor > /dev/null || \
96 useradd -r -g pdns-recursor -d / -s /sbin/nologin \
97 -c "PowerDNS Recursor user" pdns-recursor
98 exit 0
99
100 %post
101 systemctl daemon-reload ||:
102 %systemd_post %{name}.service
103
104 %preun
105 %systemd_preun %{name}.service
106
107 %postun
108 %systemd_postun_with_restart pdns-recursor.service
109
110 %files
111 %{_bindir}/rec_control
112 %{_sbindir}/pdns_recursor
113 %{_mandir}/man1/pdns_recursor.1.gz
114 %{_mandir}/man1/rec_control.1.gz
115 %{_unitdir}/pdns-recursor.service
116 %{_unitdir}/pdns-recursor@.service
117 %dir %{_sysconfdir}/%{name}
118 %config(noreplace) %{_sysconfdir}/%{name}/recursor.conf
119 %doc README