File getdns.spec of Package getdns

#
# spec file for package getdns
#
# 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/
#


%global soversion 10
%global libname lib%{name}%{soversion}
%bcond_with libev_over_libevent
Name:           getdns
Version:        1.7.3
Release:        0
Summary:        A modern asynchronous DNS API
License:        BSD-3-Clause
Group:          System/Libraries
URL:            https://getdnsapi.net/
Source0:        https://getdnsapi.net/dist/%{name}-%{version}.tar.gz
Source1:        https://getdnsapi.net/dist/%{name}-%{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 >= 3.20
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  unbound-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(check)
BuildRequires:  pkgconfig(libcrypto)
BuildRequires:  pkgconfig(libidn2)
BuildRequires:  pkgconfig(libssl)
BuildRequires:  pkgconfig(libuv)
Requires:       unbound-anchor
%if %{with libev_over_libevent}
BuildRequires:  pkgconfig(libev)
%else
BuildRequires:  pkgconfig(libevent)
%endif

%description
getdns is an implementation of a modern asynchronous DNS API; the
specification was originally edited by Paul Hoffman. It is intended
to make all types of DNS information easily available to application
developers and non-DNS experts.

%package -n %{libname}
Summary:        A modern asynchronous DNS API
Group:          System/Libraries

%description -n %{libname}
getdns is an implementation of a modern asynchronous DNS API; the
specification was originally edited by Paul Hoffman. It is intended
to make all types of DNS information easily available to application
developers and non-DNS experts.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        utils
Summary:        Utilities for interacting with %{name}
Group:          Productivity/Networking/DNS/Utilities
Requires:       %{libname} = %{version}

%description    utils
The %{name}-utils package contains utilities using getdns library,
getdns_query and getdns_query_mon utilities. They can be used to analyze
responses from DNS servers over UDP, TCP and TLS, including support for
DNS security.

getdns_query can be used for fetching details of DNS responses in json format.
getdns_query_mon is great for automated monitoring of DNS server replies.

%prep
%autosetup -p1

%build
%cmake \
	-DBUILD_DOXYGEN=ON \
	-DBUILD_EXAMPLES=ON \
	-DPATH_TRUST_ANCHOR_FILE=%{_sharedstatedir}/unbound/root.key \
	-DENABLE_STATIC=OFF \
%if %{with libev_over_libevent}
	-DBUILD_LIBEV=ON \
	-DBUILD_LIBEVENT=OFF
%else
	-DBUILD_LIBEV=OFF
%endif

%cmake_build

%check
# make test needs a network connection - so disabled per default
# make test

%install
%cmake_install
rm -rf %{buildroot}%{_docdir}/%{name}
rm -rf %{buildroot}%{_datadir}/doc/%{name}
%fdupes -s %{buildroot}/%{_mandir}

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%files -n %{libname}
%license LICENSE
%{_libdir}/lib%{name}.so.%{soversion}*
%{_libdir}/lib%{name}_ext_*.so.%{soversion}*

%files devel
%license LICENSE
%doc README.md NEWS AUTHORS ChangeLog
%doc spec
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}_ext_*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}/
%{_mandir}/man3/%{name}_*.3%{?ext_man}
%{_mandir}/man3/lib%{name}.3%{?ext_man}

%files utils
%{_bindir}/%{name}_query
%{_bindir}/%{name}_server_mon

%changelog
openSUSE Build Service is sponsored by