## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 5;
    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

%global debug_package %{nil}
# header only lib

Name:           safeint
Version:        3.0.27
Release:        %autorelease
Summary:        Class library for C++ that manages integer overflows

License:        MIT
URL:            https://github.com/dcleblanc/SafeInt
Source0:        https://github.com/dcleblanc/SafeInt/archive/%{version}/SafeInt-%{version}.tar.gz

BuildRequires:  gcc-c++
BuildRequires:  cmake

# Test fail on i686 arch
# https://bugzilla.redhat.com/show_bug.cgi?id=2144864#c5
ExcludeArch: %{ix86}

%global _description %{expand:
An integer overflow library that was originally created in Microsoft
Office in 2003, and later was made open source on CodePlex using the MS-PL
license. After CodePlex was deprecated, the project was moved to github
and the license was changed to the MIT license.}


%description
%{_description}


%package devel
Summary: %{summary}
Provides: %{name}-static = %{version}-%{release}


%description devel
%{_description}


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

%check
%cmake
%cmake_build
%ctest


%build


%install
install -d %{buildroot}%{_includedir}/SafeInt
install -D -p SafeInt.hpp -t %{buildroot}%{_includedir}/SafeInt/
install -D -p safe_math.h -t %{buildroot}%{_includedir}/SafeInt/
install -D -p safe_math_impl.h -t %{buildroot}%{_includedir}/SafeInt/


%files devel
%license LICENSE
%doc README.md
%dir %{_includedir}/SafeInt
%{_includedir}/SafeInt/SafeInt.hpp
%{_includedir}/SafeInt/safe_math.h
%{_includedir}/SafeInt/safe_math_impl.h


%changelog
* Thu Dec 08 2022 Diego Herrera <dherrera@redhat.com> 3.0.27-5
- Exclude i686 since the test fail on that arch

* Tue Dec 06 2022 Diego Herrera <dherrera@redhat.com> 3.0.27-4
- Add dir to the file section

* Mon Nov 28 2022 Diego Herrera <dherrera@redhat.com> 3.0.27-3
- Move files into include/SafeInt dir

* Mon Nov 28 2022 Diego Herrera <dherrera@redhat.com> 3.0.27-2
- Run tests on %%check command

* Tue Nov 22 2022 Diego Herrera <dherrera@redhat.com> 3.0.27-1
- Initial version