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