%global pkgvers 1
%global scdate0 20201208
%global schash0 63058eff77e11aa15bf531df5dd34395ec3017c8
%global branch0 master
%global source0 https://github.com/Maratyszcza/fxdiv.git

%global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}}

Name:           fxdiv
Version:        0
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        Division via fixed-point multiplication by inverse
License:        BSD
Epoch:          1
BuildArch:      noarch

URL:            https://github.com/Maratyszcza/fxdiv

BuildRequires:  cmake gcc-c++ git

%global __cmake_in_source_build 1

%description
Header-only library for division via fixed-point
multiplication by inverse. FXdiv implements an
algorithm to replace an integer division with a
multiplication and two shifts.

%package        devel
Summary:        Development files

%description    devel
This package contains the development files for %{name}.


%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{branch0} %{source0} .
git fetch --depth 1 origin %{schash0}
git reset --hard %{schash0}
git log --format=fuller


%build
mkdir build
pushd build
%cmake .. \
       -DCMAKE_SKIP_RPATH=ON \
       -DCMAKE_VERBOSE_MAKEFILE=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo \
       -DFXDIV_BUILD_TESTS=OFF \
       -DFXDIV_BUILD_BENCHMARKS=OFF
make %{?_smp_mflags}
popd


%install
rm -rf %{buildroot}
pushd build
make install DESTDIR=%{buildroot}
popd


%files devel
%license LICENSE
%doc README.md
%{_includedir}/*


%changelog
* Fri Sep 25 2020 Cristian Balint <cristian.balint@gmail.com>
- github update releases