%undefine __cmake_in_source_build
%global appname olm

Name: libolm
Version: 3.2.1
Release: 1%{?dist}
Summary: Double Ratchet cryptographic library
License: ASL 2.0
URL: https://gitlab.matrix.org/matrix-org/%{appname}
Source0: https://gitlab.matrix.org/matrix-org/%{appname}/-/archive/%{version}/%{appname}-%{version}.tar.bz2
BuildRequires: ninja-build
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: gcc


%description
An implementation of the Double Ratchet cryptographic ratchet in C++.


%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel
%{summary}.


%prep
%autosetup -n %{appname}-%{version} -p1
mkdir -p %{_target_platform}


%build
pushd %{_target_platform}
%cmake3 \
    -G Ninja \
    -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
    -DCMAKE_INSTALL_LIBDIR="%{_libdir}" \
    -DCMAKE_BUILD_TYPE=Release \
    -DOLM_TESTS=ON \
    ..
popd
%ninja_build -C %{_target_platform}


%install
%ninja_install -C %{_target_platform}


%files
%license LICENSE
%doc *.md *.rst docs/*.md
%{_libdir}/%{name}.so.3*


%files devel
%{_includedir}/%{appname}
%{_libdir}/%{name}.so
%{_libdir}/cmake/Olm


%changelog
