File stubby.spec of Package stubby

#
# spec file for package stubby
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2021/22 Florian "sp1rit" <packaging@sp1rit.anonaddy.me>
#
# 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 https://bugs.opensuse.org/
#


Name:           stubby
Version:        0.4.3
Release:        0
Summary:        DNS Privacy stub resolver
License:        BSD-3-Clause
URL:            https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby
Source0:        https://github.com/getdnsapi/stubby/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
#Source1:        https://github.com/getdnsapi/stubby/releases/download/v%{version}/stubby-%{version}.tar.gz.asc
# Willem Toorop <willem@nlnetlabs.nl>
# https://nlnetlabs.nl/people/#willem-toorop
# DC34EE5DB2417BCC151E5100E5F8F8212F77A498
Source2:        https://keys.openpgp.org/pks/lookup?op=get&search=0xE5F8F8212F77A498#/%{name}.keyring
BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  pkgconfig
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(getdns)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(yaml-0.1)
%{?systemd_requires}

%description
Stubby is an application that acts as a local DNS Privacy stub
resolver (using DNS-over-TLS). Stubby encrypts DNS queries sent
from a client machine (desktop or laptop) to a DNS Privacy resolver
increasing end user privacy. Stubby is in the early stages of
development but is suitable for technical/advanced users. A more
generally user-friendly version is on the way!

Stubby provides DNS Privacy by:
- Running as a daemon
- Listening on the loopback address to send all outgoing DNS queries
  received on that address out over TLS
- Using a default configuration which provides Strict Privacy and
  uses a subset of the available DNS Privacy servers

Stubby is developed by the getdns team.

%prep
%autosetup -p1

%build
%cmake -DCMAKE_BUILD_TAPE:STRING=Release
%cmake_build

%install
%cmake_install

mkdir -p %{buildroot}%{_unitdir}
install -pm 0644 systemd/stubby.service %{buildroot}%{_unitdir}/stubby.service
mkdir -p %{buildroot}%{_sbindir}/
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}

rm -rf %{buildroot}%{_datadir}/doc/%{name}

%pre
%service_add_pre %{name}.service

%post
# systemd would replace it with symlink
if [ ! -L "%{_localstatedir}/cache/stubby" -a -d "%{_localstatedir}/cache/stubby" ]; then
       mv "%{_localstatedir}/cache/stubby"{,.rpmsave}
fi
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun_with_restart %{name}.service

%files
%license COPYING
%doc README.md AUTHORS ChangeLog
%{_bindir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}
%ghost %{_localstatedir}/cache/stubby
%{_unitdir}/stubby.service
%{_sbindir}/rc%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by