SHA256
1
0
forked from pool/dnsdist
dnsdist/dnsdist.spec

214 lines
6.0 KiB
RPMSpec

#
# spec file for package dnsdist
#
# Copyright (c) 2015 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/
#
%if 0%{?suse_version} > 1230 || 0%{?rhel_version} > 600 || 0%{?centos_version} > 600 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without systemd
%else
%bcond_with systemd
%endif
%if 0%{?fedora_version} >= 24 || 0%{?fc24}%{?fc25} || 0%{?suse_version} > 1320
%bcond_with systemd_separetedlibs
%else
%bcond_without systemd_separetedlibs
%endif
%if 0%{?suse_version} >= 1320 || 0%{?is_opensuse} || 0%{?fedora_version} >= 21 || 0%{?fc21}%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without dnsdist_sodium
%else
%bcond_with dnsdist_sodium
%endif
%if 0%{?is_opensuse} || 0%{?fedora_version} >= 21 || 0%{?fc21}%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without dnsdist_re2
%else
%bcond_with dnsdist_re2
%endif
%if 0%{?suse_version}
%bcond_without apparmor
%else
%bcond_with apparmor
%endif
#
# this should only be needed if we have to patch the ragel files
# in which case it might be faster to just run it locally and put the regenerated file into the tarball
%bcond_with dnsdist_ragel
%bcond_with dnsdist_luajit
%if 0%{?suse_version} && ! ( 0%{?suse_version} == 1315 && ! 0%{?is_opensuse} )
%bcond_without dnsdist_protobuf
%else
%bcond_with dnsdist_protobuf
%endif
Name: dnsdist
Version: 1.3.2
Release: 0
License: GPL-2.0
Summary: A highly DNS-, DoS- and abuse-aware loadbalancer
Url: http://www.powerdns.com/
Group: Productivity/Networking/DNS/Servers
Source: http://buildmaster1.test.powerdns.plexis.eu/files/dnsdist/dist/dnsdist-%{version}.tar.bz2
Source1: dnsdist.lua
Source2: usr.sbin.dnsdist
Source3: local.usr.sbin.dnsdist
Patch: dnsdist_bindir.patch
%if %{with apparmor}
BuildRequires: apparmor-profiles
%endif
BuildRequires: boost-devel >= 1.35.0
BuildRequires: gcc-c++ >= 4.8
BuildRequires: libfstrm-devel
BuildRequires: gnutls-devel
%if %{with dnsdist_sodium}
BuildRequires: libsodium-devel
%endif
%if %{with dnsdist_protobuf}
BuildRequires: protobuf-devel
%endif
%if %{with dnsdist_luajit}
BuildRequires: luajit-devel
%else
BuildRequires: lua-devel
%endif
BuildRequires: net-snmp-devel
BuildRequires: pkgconfig
%if %{with dnsdist_ragel}
BuildRequires: ragel
%endif
%if %{with dnsdist_re2}
BuildRequires: re2-devel
%endif
BuildRequires: libedit-devel
%if 0%{?suse_version}
Requires(post): %fillup_prereq
%endif
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%if %{with systemd_separetedlibs}
BuildRequires: pkgconfig(libsystemd-daemon)
%else
BuildRequires: pkgconfig(libsystemd)
%endif
%{?systemd_requires}
%endif
Requires(pre): shadow
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define home %{_var}/lib/%{name}
%description
dnsdist is a highly DNS-, DoS- and abuse-aware loadbalancer. Its goal in life
is to route traffic to the best server, delivering top performance to
legitimate users while shunting or blocking abusive traffic.
dnsdist is dynamic, in the sense that its configuration can be changed at
runtime, and that its statistics can be queried from a console-like interface.
WARNING: dnsdist is still under HEAVY development, but we are giving it some
publicity in hopes of getting constructive feedback that will help us guide our
feature set.
Do NOT take this into production, but please DO let us know your thoughts!
%prep
%setup -q -n %{name}-%{version}
%patch -p1
%build
%configure \
--enable-dns-over-tls \
%if %{with dnsdist_sodium}
--enable-libsodium --enable-dnscrypt \
%endif
%if %{with dnsdist_re2}
--enable-re2 \
%endif
%if %{with dnsdist_protobuf}
--with-protobuf \
%endif
--disable-silent-rules --bindir=%{_sbindir} --sysconfdir=%{_sysconfdir}/%{name}/
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot} %{?_smp_mflags}
#
%if %{with systemd} && 0%{?suse_version}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%endif
%if %{with apparmor}
install -D -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/apparmor.d/usr.sbin.dnsdist
install -D -m 0644 %{S:3} %{buildroot}%{_sysconfdir}/apparmor.d/local/usr.sbin.dnsdist
%endif
install -Dd -m 0750 %{buildroot}%{_sysconfdir}/%{name}/ %{buildroot}%{home}/
install -m 0640 %{S:1} %{buildroot}%{_sysconfdir}/%{name}/dnsdist.conf
%pre
getent group %{name} >/dev/null || /usr/sbin/groupadd -r %{name}
getent passwd %{name} >/dev/null || \
/usr/sbin/useradd -g %{name} -s /bin/false -r -c "%{name}" -d %{home} %{name}
# START BIG SYSTEMD
%if %{with systemd}
%if 0%{?suse_version}
%service_add_pre %{name}.service
%endif
%preun
%if 0%{?suse_version}
%service_del_preun %{name}.service
%else
%systemd_preun %{name}.service
%endif
%post
%if 0%{?suse_version}
%service_add_post %{name}.service
%else
%systemd_post %{name}.service
%endif
%postun
%if 0%{?suse_version}
%service_del_postun %{name}.service
%else
%systemd_postun_with_restart %{name}.service
%endif
%endif
# /END BIG SYSTEMD
%files
%defattr(-,root,root)
%doc README.md
%{_sbindir}/dnsdist
%{_mandir}/man1/dnsdist.1*
%if %{with systemd}
%{_unitdir}/%{name}*.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}
%endif
%endif
%if %{with apparmor}
%config(noreplace) %{_sysconfdir}/apparmor.d/usr.sbin.dnsdist
%config(noreplace) %{_sysconfdir}/apparmor.d/local/usr.sbin.dnsdist
%endif
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/%{name}/
%dir %attr(700,%{name},%{name}) %{home}
%changelog