File pdns-recursor.spec of Package pdns-recursor

# spec file for package pdns-recursor
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%if 0%{?suse_version} > 1230
%bcond_without systemd
%bcond_with    systemd

%if 0%{?fedora_version} >= 24 || 0%{?fc24}%{?fc25}
%bcond_with    systemd_separetedlibs
%bcond_without systemd_separetedlibs

%if 0%{?suse_version} > 1315 || 0%{?is_opensuse}
%bcond_without pdns_protobuf
%bcond_with    pdns_protobuf

Name:           pdns-recursor
Version:        4.4.2
Release:        0
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool

%if 0%{?suse_version} > 1325
%ifnarch s390x
BuildRequires:  libboost_context-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
%if 0%{?suse_version} == 1315 && 0%{?is_opensuse}
BuildRequires:  boost_1_58_0-devel
%if ( 0%{?suse_version} <= 1315 && ! 0%{?is_opensuse} ) || 0%{?suse_version} == 1320
BuildRequires:  boost-devel

BuildRequires:  gcc-c++
BuildRequires:  libsodium-devel
BuildRequires:  lua-devel
BuildRequires:  net-snmp-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
%if %{without systemd}
PreReq:         %insserv_prereq
PreReq:         %fillup_prereq
PreReq:         shadow
PreReq:         shadow-utils
%if %{with pdns_protobuf}
BuildRequires:  protobuf-devel
%if %{with systemd}
BuildRequires:  pkgconfig(systemd)
%if %{with systemd_separetedlibs}
BuildRequires:  pkgconfig(libsystemd)
PreReq:         pdns-common
Source1:        pdns-recursor.init
Source2:        recursor.conf
Summary:        Modern, advanced and high performance recursing/non authoritative nameserver
License:        GPL-2.0-or-later
Group:          Productivity/Networking/DNS/Servers

PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
package if you need a dns cache for your network.


%autosetup -n %{name}-%{version}

autoreconf -fi
ln effective_tld_names.dat effective_tld_list.dat
%configure                           \
  --enable-reproducible              \
  --disable-silent-rules             \
  --bindir=%{_sbindir}               \
  --sysconfdir=%{_sysconfdir}/pdns/  \
%if %{with dnsdist_protobuf}
  --with-protobuf \
  --with-lua                         \
  --with-socketdir=%{_rundir}        \
  --with-service-user=pdns           \
make %{?_smp_mflags}

make %{?_smp_mflags} install DESTDIR="%{buildroot}"
# config
%{__install} -D -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/pdns/recursor.conf
# init systems
%if %{with systemd}
%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
# installed by make install
rm -rvf %{buildroot}%{_sysconfdir}/init.d/%{name}
%{__install} -D  -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{name}
%{__ln_s} -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}

%{__rm} -rf %{buildroot}

%if 0%{?suse_version} && %{with systemd}
%service_add_pre %{name}.service

%if 0%{?suse_version} && %{with systemd}
%service_add_post %{name}.service

%if 0%{?suse_version}
%if %{with systemd}
%service_del_preun %{name}.service
%stop_on_removal %{name}

%if 0%{?suse_version}
%if %{with systemd}
%service_del_postun %{name}.service
%restart_on_update %{name}

%defattr (-,root,root,-)
%config(noreplace)  %attr(640,root,pdns) %{_sysconfdir}/pdns/*.conf
%if %{with systemd}
%config(noreplace) %{_sysconfdir}/init.d/%{name}

openSUSE Build Service is sponsored by