Provides: powerdns-recursor = %{version}-%{release}
+%if 0%{?rhel} < 8 && 0%{?amzn} != 2023
+BuildRequires: boost169-devel
+%else
BuildRequires: boost-devel
+%endif
BuildRequires: libcap-devel
BuildRequires: systemd
BuildRequires: systemd-devel
BuildRequires: openssl-devel
+BuildRequires: fstrm-devel
+BuildRequires: libcurl-devel
+
+%if 0%{?amzn} != 2023
BuildRequires: net-snmp-devel
BuildRequires: libsodium-devel
-BuildRequires: fstrm-devel
+%endif
%ifarch aarch64
BuildRequires: lua-devel
%prep
-%autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
+%autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
%build
+%if 0%{?rhel} < 8
+export CPPFLAGS=-I/usr/include/boost169
+export LDFLAGS=-L/usr/lib64/boost169
+%endif
+
%configure \
--enable-option-checking=fatal \
--sysconfdir=%{_sysconfdir}/%{name} \
- --with-libsodium \
- --with-net-snmp \
--disable-silent-rules \
--disable-static \
--enable-unit-tests \
--enable-dnstap \
--with-libcap \
--with-lua=%{lua_implementation} \
- --enable-systemd --with-systemd=%{_unitdir}
+%if 0%{?amzn} != 2023
+ --with-libsodium \
+ --with-net-snmp \
+%endif
+ --enable-systemd --with-systemd=%{_unitdir} \
+ --enable-nod
make %{?_smp_mflags}
make install DESTDIR=%{buildroot}
%{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,}
+%{__mkdir} %{buildroot}%{_sysconfdir}/%{name}/recursor.d
-# change user and group to pdns-recursor
+# change user and group to pdns-recursor and add default include-dir
sed -i \
-e 's/# setuid=/setuid=pdns-recursor/' \
-e 's/# setgid=/setgid=pdns-recursor/' \
+ -e 's!# include-dir=.*!&\ninclude-dir=%{_sysconfdir}/%{name}/recursor.d!' \
%{buildroot}%{_sysconfdir}/%{name}/recursor.conf
+# 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
+%if 0%{?rhel} < 9
+sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor!' -i %{buildroot}/%{_unitdir}/pdns-recursor.service
+%if 0%{?rhel} < 8
+sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor-%i!' -e 's!RuntimeDirectory=pdns-recursor!&-%i!' -i %{buildroot}/%{_unitdir}/pdns-recursor@.service
+%endif
+%endif
+
%pre
getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor
getent passwd pdns-recursor > /dev/null || \
%{_unitdir}/pdns-recursor.service
%{_unitdir}/pdns-recursor@.service
%dir %{_sysconfdir}/%{name}
+%dir %{_sysconfdir}/%{name}/recursor.d
%config(noreplace) %{_sysconfdir}/%{name}/recursor.conf
+%config %{_sysconfdir}/%{name}/recursor.yml-dist
%doc README