File opendht.spec of Package opendht

#
# spec file for package opendht
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2014-2019 Szőts Ákos <szotsaki@gmail.com>
#
# 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/
#


%define sover   3
Name:           opendht
Version:        3.2.0
Release:        0
Summary:        Lightweight C++11 Distributed Hash Table implementation
License:        GPL-3.0-or-later
URL:            https://github.com/savoirfairelinux/opendht/
Source:         %{name}-%{version}.tar
BuildRequires:  c++_compiler
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  graphviz
BuildRequires:  pkgconfig
BuildRequires:  readline-devel >= 6
BuildRequires:  cmake(llhttp)
BuildRequires:  cmake(msgpack-cxx) >= 1.3
BuildRequires:  cmake(restinio) >= 0.7.2
BuildRequires:  cmake >= 3.21
BuildRequires:  pkgconfig(asio)
BuildRequires:  pkgconfig(cppunit)
BuildRequires:  pkgconfig(fmt)
BuildRequires:  pkgconfig(gnutls) >= 3.3
BuildRequires:  pkgconfig(jsoncpp) >= 1.7.4
BuildRequires:  pkgconfig(libargon2)
BuildRequires:  pkgconfig(nettle) >= 2.4
BuildRequires:  pkgconfig(simdutf) >= 7

%description
A lightweight C++11 Distributed Hash Table implementation
- Light and fast C++11 Kademlia DHT library
- Distributed shared key->value data-store
- Clean and powerful distributed map API with storage of arbitrary binary values of up to 56 KB
- Optional public key cryptography layer providing data signature and encryption (using GnuTLS)
- IPv4 and IPv6 support
- Python binding

%package -n lib%{name}%{sover}
Summary:        Library for OpenDHT, a C++11 Distributed Hash Table implementation

%description -n lib%{name}%{sover}
A library for OpenDHT, a C++11 Distributed Hash Table implementation.

%package devel
Summary:        Development header files for lib%{name}
Requires:       lib%{name}%{sover} = %{version}

%description devel
Development files for lib%{name}%{sover}.

#%%package -n python-%%{name}
#Summary:        Python wrapper for OpenDHT
#
#%%description -n python-%%{name}
#Python wrapper for OpenDHT.

%prep
%autosetup -p1
# fix shebang
sed -i "s|^#!.*|#!$(which python3)|" python/tools/dhtcluster.py

%build
%cmake \
    -DOPENDHT_PYTHON=OFF                             \
    -DOPENDHT_TOOLS=ON                               \
    -DOPENDHT_SYSTEMD=OFF                            \
    -DOPENDHT_SYSTEMD_UNIT_FILE_LOCATION=%{_unitdir} \
    -DOPENDHT_SANITIZE=OFF                           \
    -DOPENDHT_PROXY_SERVER=ON                        \
    -DOPENDHT_PUSH_NOTIFICATIONS=ON                  \
    -DOPENDHT_PROXY_SERVER_IDENTITY=ON               \
    -DOPENDHT_INDEX=ON                               \
    -DOPENDHT_IO_URING=ON                            \
    -DOPENDHT_DOWNLOAD_DEPS=OFF                      \
    -DOPENDHT_TESTS_NETWORK=OFF                      \
    -DOPENDHT_DOCUMENTATION=OFF                      \
    -DOPENDHT_PROXY_CLIENT=ON                        \
    -DLLHTTP_INCLUDE_DIR="%{_includedir}/"             \
    %{?nil}
%cmake_build

%install
%cmake_install
#mkdir -pv %%{buildroot}%%{_sbindir}
#pushd %%{buildroot}%%{_sbindir}
#ln -sfv %%{_unitdir}/dhtnode.service rcdhtnode
#popd
%fdupes %{buildroot}%{_prefix}

#%%pre
#%%service_add_pre dhtnode.service
#
#%%post
#%%service_add_post dhtnode.service
#
#%%preun
#%%service_del_preun dhtnode.service
#
#%%postun
#%%service_del_postun dhtnode.service

%post -n lib%{name}%{sover} -p /sbin/ldconfig
%postun -n lib%{name}%{sover} -p /sbin/ldconfig

%files
%{_bindir}/dhtnode
%{_mandir}/man1/dhtnode.1%{?ext_man}
#%%config %%{_sysconfdir}/dhtnode.conf
#%%{_unitdir}/dhtnode.service
#%%{_sbindir}/rcdhtnode
%license COPYING
%doc README.md tools/proxy_node.html

%files -n lib%{name}%{sover}
%{_libdir}/lib%{name}.so.%{sover}*

%files devel
#%%dir %%{_datadir}/doc/%%{name}
#%%docdir %%{_datadir}/doc/%%{name}/html
%dir %{_includedir}/%{name}
%dir %{_includedir}/%{name}/indexation
%dir %{_libdir}/cmake/%{name}
%{_includedir}/%{name}/*.h
%{_includedir}/%{name}/indexation/*.h
%{_includedir}/%{name}.h
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/cmake/%{name}/*.cmake
%{_libdir}/lib%{name}.so
%dir %{_includedir}/%{name}/crypto
%{_includedir}/%{name}/crypto/secure_vector.h
#%%{_datadir}/doc/%%{name}/html

#%%files -n python-%%{name}
#%%dir %%{python3_sitearch}/%%{name}-*-py%%{py3_ver}.egg-info
#%%{python3_sitearch}/%%{name}-*-py%%{py3_ver}.egg-info/*
#%%{python3_sitearch}/%%{name}.%%{py3_soflags}.so

%changelog
openSUSE Build Service is sponsored by