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