File knot.spec of Package knot
#
# spec file for package knot
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
Name: knot
Url: http://www.knot-dns.cz
Version: 1.5.3
Release: 0
Summary: An authoritative DNS daemon
License: GPL-3.0+
Group: Productivity/Networking/DNS/Servers
Requires(pre): pwdutils
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: libtool
BuildRequires: flex
BuildRequires: liburcu-devel
BuildRequires: pkg-config
BuildRequires: openssl-devel
%if 0%{?suse_version} > 1140
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%endif
Source0: https://secure.nic.cz/files/knot-dns/%{name}-%{version}.tar.gz
Source1: knot.conf
Source2: knot.service
Patch0: 0001-loosen-openssl-dependency.patch
Patch1: 0002-make-configure.ac-compatible-with-old-tools.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Knot DNS is a high-performance authoritative DNS server implementation.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
%if 0%{suse_version} == 1210
export SUSE_ASNEEDED=0
%endif
autoreconf -fi
%configure \
--sysconfdir=%{_sysconfdir} \
--libexecdir=%{_libexecdir}/%{name} \
--localstatedir=/var/lib \
--libexecdir=%{_libexecdir}/%{name} \
--enable-recvmmsg=yes \
--disable-silent-rules
make %{?_smp_mflags}
%install
make DESTDIR=%{buildroot} install
install -d %{buildroot}%{_docdir}/%{name}
install -d %{buildroot}%{_docdir}/%{name}/samples/
rm %{buildroot}%{_sysconfdir}/%{name}/*
install -p -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
%if 0%{?has_systemd}
install -d %{buildroot}%{_unitdir}
install -p -m644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
%endif
install -p -m644 COPYING AUTHORS NEWS THANKS README %{buildroot}%{_docdir}/%{name}
install -p -m644 samples/*.conf samples/*.zone* %{buildroot}%{_docdir}/%{name}/samples/
ln -s /sbin/service %{buildroot}%{_sbindir}/rcknot
rm %{buildroot}%{_libdir}/*.so %{buildroot}%{_libdir}/*.la
%pre
getent group knot >/dev/null || groupadd -r knot
getent passwd knot >/dev/null || \
useradd -r -g knot -d %{_sysconfdir}/knot -s /sbin/nologin \
-c "Knot DNS server" knot
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif
%preun
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%endif
%post
/sbin/ldconfig
%if 0%{?has_systemd}
%service_add_post %{name}.service
%endif
%postun
/sbin/ldconfig
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%endif
%files
%defattr(-,root,root)
%dir %attr(750,root,root) %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_sbindir}/*
%{_bindir}/*
%{_libdir}/*.so.*
%{_mandir}/man?/*
%doc %{_docdir}/%{name}
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%endif
%changelog