%global commit			2d8ccce67e5562023309244fe662ee21fd6caf79
%global shortcommit		%(c=%{commit}; echo ${c:0:7})
%global snapshotdate	20200702

Summary:		Cryptographic library
Name:			bee2	
Version:		2.0.5
Release:		6.%{snapshotdate}git%{shortcommit}%{?dist}
License:		GPLv3
Url:			http://apmi.bsu.by/resources/tools.html
Source0:		https://github.com/agievich/bee2/archive/%{commit}/%{name}-%{shortcommit}.zip
Patch0:			bee2-2.0.5-versioned.patch
BuildRequires:	cmake, gcc

%description
Bee2 is a cryptographic library which implements cryptographic 
algorithms and protocols standardized in Belarus. Additionally, Bee2 
implements digital signature algorithms standardized in Russia and 
Ukraine.

%package		devel
Summary:		Files for development of applications which will use bee2
Requires:		%{name}%{?_isa} = %{version}-%{release}
%description	devel
Bee2 is a cryptographic library which implements cryptographic 
algorithms and protocols standardized in Belarus. The bee2-devel package
contains files needed to develop applications which support these 
cryptographic algorithms and protocols.

#------------------------------------------------------------------

%prep
%autosetup -n %{name}-%{commit} -p 1

%build

%if 0%{?fedora} || 0%{?rhel} > 7
%cmake -S %{_vpath_srcdir} -B %{_vpath_builddir}
%else
%cmake 
%endif

%if 0%{?fedora} || 0%{?rhel} > 7
%make_build -C %{_vpath_builddir}
%else
%make_build
%endif

%install

%if 0%{?fedora} || 0%{?rhel} > 7
%make_install -C %{_vpath_builddir}
%else
%make_install
%endif

%{__rm} -rf %{buildroot}%{_bindir}/bsum
%{__rm} -rf %{buildroot}%{_libdir}/libbee2_static.a

%check

%if 0%{?fedora}
%make_build -C %{_vpath_builddir} test
%else
%make_build test
%endif

%files

%{_libdir}/libbee2.so.2.0
%{_libdir}/libbee2.so.2.0.5

%license LICENSE
%doc AUTHORS.md README.md

%files devel

%{_includedir}/bee2/
%{_libdir}/libbee2.so

%changelog
* Sat Jul 04 2020 Yury Kashcheyeu <kashcheyeu@tiksi.ru> - 2.0.5-6
- Initial RPM release