Name:           drpm
Version:        0.5.0
Release:        1%{?dist}
Summary:        A library for making, reading and applying deltarpm packages
# the entire source code is LGPLv2+, except src/drpm_diff.c and src/drpm_search.c which are BSD
License:        LGPLv2+ and BSD
URL:            https://github.com/rpm-software-management/%{name}
Source:         %{url}/releases/download/%{version}/%{name}-%{version}.tar.bz2
# add workaround for gcc7 on ppc64le temporary before it's fixed in gcc
# https://bugzilla.redhat.com/show_bug.cgi?id=1420350
Patch1:         drpm-0.3.0-workaround-ppc64le-gcc.patch
BuildRequires:  gcc-c++
BuildRequires:  cmake >= 2.8.5
BuildRequires:  gcc
BuildRequires:  rpm-devel
BuildRequires:  openssl-devel
BuildRequires:  zlib-devel
BuildRequires:  bzip2-devel
BuildRequires:  xz-devel
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig
BuildRequires:  doxygen
BuildRequires:  libcmocka-devel >= 1.0
BuildRequires:  valgrind


%description
The drpm package provides a library for making, reading and applying deltarpms,
compatible with the original deltarpm packages.


%package devel
Summary:        C interface for the drpm library
Requires:       %{name}%{?_isa} = %{version}-%{release}
%description devel
The drpm-devel package provides a C interface (drpm.h) for the drpm library.


%prep
%autosetup -p1
mkdir build


%build
pushd build
%cmake .. -DWITH_ZSTD:BOOL=ON -DHAVE_LZLIB_DEVEL:BOOL=OFF
%make_build
make doc
popd


%install
pushd build
%make_install
popd


%check
pushd build
ctest -VV
popd


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%{_libdir}/lib%{name}.so.*
%license COPYING LICENSE.BSD


%files devel
%doc build/doc/html/
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}.h
%{_libdir}/pkgconfig/%{name}.pc


%changelog