63a7b81
# remirepo/fedora spec file for rnp
63a7b81
#
96f7bc4
# Copyright (c) 2022-2024 Remi Collet
0d2487a
# License: CC-BY-SA-4.0
63a7b81
# http://creativecommons.org/licenses/by-sa/4.0/
63a7b81
#
63a7b81
# Please, preserve the changelog entries
63a7b81
#
63a7b81
63a7b81
%bcond_without      tests
63a7b81
%bcond_with         licensecheck
96f7bc4
%bcond_without      libsexpp
63a7b81
63a7b81
%if 0%{?rhel} == 8
63a7b81
# use openssl by default as botan2 is too old
63a7b81
%bcond_without      openssl
63a7b81
%else
63a7b81
# use botan2 as openssl seems experimental/wip
63a7b81
%bcond_with         openssl
63a7b81
%endif
63a7b81
63a7b81
%global libname     librnp
63a7b81
%global soname      0
63a7b81
96f7bc4
63a7b81
Name:          rnp
63a7b81
Summary:       OpenPGP (RFC4880) tools
96f7bc4
Version:       0.17.1
67669d8
Release:       1%{?dist}
63a7b81
# See rnp-files-by-license.txt and upstream LICENSE* files
96f7bc4
License:       BSD-2-Clause AND Apache-2.0 AND MIT
63a7b81
63a7b81
URL:           https://github.com/rnpgp/rnp
0d2487a
Source0:       %{url}/releases/download/v%{version}/rnp-v%{version}.tar.gz
0d2487a
Source1:       %{url}/releases/download/v%{version}/rnp-v%{version}.tar.gz.asc
63a7b81
# See https://www.rnpgp.org/openpgp_keys/
63a7b81
Source2:       %{name}-keyring.gpg
63a7b81
# Use --with licensecheck to generate
63a7b81
Source3:       %{name}-files-by-license.txt
63a7b81
63a7b81
BuildRequires:  cmake >= 3.14
63a7b81
BuildRequires:  gcc
63a7b81
BuildRequires:  gcc-c++
63a7b81
BuildRequires:  pkg-config
63a7b81
BuildRequires:  pkgconfig(zlib)
96f7bc4
BuildRequires:  pkgconfig(bzip2)
63a7b81
%if %{with openssl}
63a7b81
BuildRequires:  openssl-devel >= 1.1.1
63a7b81
BuildRequires:  json-c-devel >= 0.11
63a7b81
BuildRequires:  gtest-devel
63a7b81
%else
63a7b81
BuildRequires:  pkgconfig(botan-2) >= 2.14
63a7b81
BuildRequires:  cmake(json-c) >= 0.11
63a7b81
BuildRequires:  cmake(GTest)
63a7b81
%endif
63a7b81
BuildRequires:  python3
63a7b81
BuildRequires:  gnupg2
63a7b81
BuildRequires:  rubygem-asciidoctor
63a7b81
%if %{with licensecheck}
63a7b81
BuildRequires:  licensecheck
63a7b81
%endif
96f7bc4
%if %{with libsexpp}
96f7bc4
%global libsexpp_version 0.8.7
96f7bc4
BuildRequires:  pkgconfig(sexpp) >= %{libsexpp_version}
96f7bc4
%endif
63a7b81
63a7b81
Requires:       %{libname}%{?_isa} = %{version}-%{release}
63a7b81
63a7b81
63a7b81
%description
63a7b81
RNP is a set of OpenPGP (RFC4880) tools.
63a7b81
63a7b81
%package -n %{libname}
63a7b81
Summary:    Library for all OpenPGP functions
96f7bc4
%if %{without libsexpp}
96f7bc4
%global libsexpp_version 0.8.2
96f7bc4
Provides:   bundled(libsexpp) = %{libsexpp_version}
96f7bc4
%endif
0d2487a
63a7b81
63a7b81
%description -n %{libname}
63a7b81
%{libname} is the library used by RNP for all OpenPGP functions,
63a7b81
useful for developers to build against, different from GPGME.
63a7b81
63a7b81
63a7b81
%package -n %{libname}-devel
63a7b81
Summary:    Header files and development libraries for %{libname}
63a7b81
Requires:   %{libname}%{?_isa} = %{version}-%{release}
63a7b81
63a7b81
%description -n %{libname}-devel
63a7b81
This package contains the header files and development libraries
63a7b81
for %{libname}.
63a7b81
63a7b81
63a7b81
%prep
0d2487a
%setup -q -n %{name}-v%{version}
63a7b81
%{?gpgverify:%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'}
0d2487a
96f7bc4
%if %{with libsexpp}
96f7bc4
rm -rf  src/libsexp
96f7bc4
: check system version requirement
96f7bc4
if ! grep -q 'sexpp>=%{libsexpp_version}' CMakeLists.txt; then
96f7bc4
    echo fix %%libsexpp_version macro, defined %{libsexpp_version}, expected \
96f7bc4
        $(grep 'sexpp>=' CMakeLists.txt | sed 's/.*sexp>=//;s/)//')
96f7bc4
    exit 1
96f7bc4
fi
96f7bc4
%else
0d2487a
pushd src/libsexp
96f7bc4
: retrieve LICENSE
0d2487a
cp LICENSE.md ../../LICENSE-libsexp.md
96f7bc4
: check bundled version
96f7bc4
if ! grep -q %{libsexpp_version} version.txt; then
96f7bc4
    echo fix %%libsexpp_version macro, defined %{libsexpp_version}, expected \
96f7bc4
        $(cat version.txt)
96f7bc4
    exit 1
96f7bc4
fi
0d2487a
popd
96f7bc4
%endif
63a7b81
63a7b81
%if %{with licensecheck}
63a7b81
LST=$(mktemp)
63a7b81
63a7b81
licensecheck -r . | sed -e 's:^./::' >$LST
63a7b81
grep -v UNKNOWN $LST | sed -e 's/.*: //' | sort -u | while read lic
63a7b81
do
63a7b81
	echo -e "\n$lic\n------------"
63a7b81
	grep ": $lic\$" $LST | sed -e "s/: $lic//"
63a7b81
done  | tee %{SOURCE3}
63a7b81
rm $LST
63a7b81
%endif
63a7b81
63a7b81
63a7b81
%build
63a7b81
%cmake . \
0d2487a
   -DINSTALL_STATIC_LIBS:BOOL=OFF \
63a7b81
%if %{with openssl}
63a7b81
   -DCRYPTO_BACKEND:STRING=openssl \
63a7b81
%else
63a7b81
   -DCRYPTO_BACKEND:STRING=botan \
63a7b81
%endif
96f7bc4
%if %{with libsexpp}
96f7bc4
   -DSYSTEM_LIBSEXPP:BOOL=ON \
96f7bc4
%else
96f7bc4
   -DSYSTEM_LIBSEXPP:BOOL=OFF \
96f7bc4
%endif
96f7bc4
   -DENABLE_COVERAGE:BOOL=OFF \
96f7bc4
   -DENABLE_SANITIZERS:BOOL=OFF \
96f7bc4
   -DENABLE_SANITIZERS:BOOL=OFF \
96f7bc4
   -DENABLE_FUZZERS:BOOL=OFF \
63a7b81
   -DDOWNLOAD_GTEST:BOOL=OFF \
63a7b81
   -DDOWNLOAD_RUBYRNP:BOOL=OFF
63a7b81
63a7b81
%cmake_build
63a7b81
63a7b81
63a7b81
%install
63a7b81
%cmake_install
63a7b81
63a7b81
63a7b81
%if %{with tests}
63a7b81
%check
861be0b
# erratic results on koji
96f7bc4
FILTER="s2k_iteration_tuning|test_key_add_userid|test_ffi_security_profile|EncryptElgamal|cli_tests"
861be0b
861be0b
%ctest --exclude-regex $FILTER
de85d31
%endif
63a7b81
63a7b81
63a7b81
%files
63a7b81
%{_bindir}/rnp
63a7b81
%{_bindir}/rnpkeys
63a7b81
%{_mandir}/man1/rnp*
63a7b81
63a7b81
%files -n %{libname}
63a7b81
%license LICENSE*
63a7b81
%{_libdir}/%{libname}.so.%{soname}*
63a7b81
63a7b81
%files -n %{libname}-devel
63a7b81
%doc CHANGELOG.md
63a7b81
%{_includedir}/rnp
63a7b81
%{_libdir}/%{libname}.so
63a7b81
%{_libdir}/pkgconfig/%{libname}.pc
63a7b81
%{_libdir}/cmake/rnp
63a7b81
%{_mandir}/man3/librnp*
63a7b81
63a7b81
63a7b81
%changelog
96f7bc4
* Fri May  3 2024 Remi Collet <remi@remirepo.net> - 0.17.1-1
96f7bc4
- update to 0.17.1
96f7bc4
- drop all patches merged upstream
96f7bc4
- use system libsexpp
96f7bc4
0d2487a
* Tue May  2 2023 Remi Collet <remi@remirepo.net> - 0.17.0-1
0d2487a
- update to 0.17.0
0d2487a
- use bundled libsexp
0d2487a
- add patch to not install static libraries from
0d2487a
  https://github.com/rnpgp/rnp/pull/2071
0d2487a
- use upstream patch to fix build with GCC 13
0d2487a
67669d8
* Thu Apr 13 2023 Remi Collet <remi@remirepo.net> - 0.16.3-1
67669d8
- update to 0.16.3
67669d8
63a7b81
* Fri Nov  4 2022 Remi Collet <remi@remirepo.net> - 0.16.2-4
63a7b81
- add upstream fix to clarify license and abandoned patent
63a7b81
63a7b81
* Wed Nov  2 2022 Remi Collet <remi@remirepo.net> - 0.16.2-3
63a7b81
- add files by license list in package sources
63a7b81
- open https://github.com/rnpgp/rnp/issues/1932 missing MIT
63a7b81
- add man pages
63a7b81
- check archive signature
63a7b81
63a7b81
* Fri Oct 28 2022 Remi Collet <remi@remirepo.net> - 0.16.2-2
63a7b81
- switch from botan-2 to openssl on EL-8
63a7b81
63a7b81
* Thu Oct 27 2022 Remi Collet <remi@remirepo.net> - 0.16.2-1
63a7b81
- initial package