## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# NOTE(mhayden): Tests are disabled because the upstream repository doesn't
#include the 'googletest' component and even if 'googletest' is packaged
#separately, lots of patching for the cmake configuration is required to make it
#work.
%bcond_with tests

%global         srcname     google-crc32c
%global         reponame    crc32c
%global         forgeurl    https://github.com/google/%{reponame}
Version:        1.1.2
%global         tag         %{version}
%forgemeta -a

Name:           %{srcname}
Release:        %autorelease
License:        BSD
Summary:        CRC32C implementation with support for CPU-specific acceleration instructions
Url:            %forgeurl
Source0:        %forgesource

BuildRequires:  cmake
BuildRequires:  gcc-c++

%description
This project collects a few CRC32C implementations under an umbrella that
dispatches to a suitable implementation based on the host computer's hardware
capabilities. CRC32C is specified as the CRC that uses the iSCSI polynomial in
RFC 3720. The polynomial was introduced by G. Castagnoli, S. Braeuer and M.
Herrmann. CRC32C is used in software such as Btrfs, ext4, Ceph and leveldb.


%package devel
Summary:        Development files for %{srcname}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{srcname}.


%prep
%autosetup -n %{reponame}-%{version}


%build
# NOTE(mhayden): Thanks to the Arch Linux developers for providing ideas on how
# to compile this properly. https://aur.archlinux.org/packages/google-crc32c/
%cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCRC32C_BUILD_BENCHMARKS=OFF \
    -DCRC32C_BUILD_TESTS=OFF \
    -DCRC32C_USE_GLOG=OFF
%cmake_build


%install
%cmake_install


%if %{with tests}
%check
%ctest
%endif


%files
%license LICENSE
%doc README.md
%{_libdir}/lib%{reponame}.so.1*


%files devel
%license LICENSE
%doc README.md
%{_libdir}/lib%{reponame}.so
%{_libdir}/cmake/Crc32c/
%{_includedir}/%{reponame}


%changelog
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 1.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Fri Jun 03 2022 Major Hayden <major@redhat.com> 1.1.2-3
- Drop period from cmake line

* Tue May 10 2022 Major Hayden <major@mhtx.net> 1.1.2-1
- Update to 1.1.2

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> 1.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Sep 09 2021 Major Hayden <major@mhtx.net> 1.1.1-2
- Move to rpmautospec

* Mon Aug 23 2021 Major Hayden <major@mhtx.net> 1.1.1-1
- Initial import (#1983175)