## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    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 intname scn
%global upname %{intname}lib

Name: libscn
Version: 4.0.1
Release: %autorelease

License: Apache-2.0
Summary: Library for replacing scanf and std::istream
URL: https://github.com/eliaskosunen/%{upname}
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz

# https://github.com/eliaskosunen/scnlib/pull/136
Patch100:      %{name}-4.0.1-fast_float-fixes.patch

BuildRequires: doctest-devel
BuildRequires: fast_float-devel
# Since fast_float is header-only, we are required to BR the -static virtual
# Provide for dependency tracking purposes.
BuildRequires: fast_float-static
BuildRequires: gmock-devel
BuildRequires: google-benchmark-devel
BuildRequires: gtest-devel

BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: ninja-build

%description
%{upname} is a modern C++ library for replacing scanf and std::istream.

This library attempts to move us ever so closer to replacing iostreams
and C stdio altogether. It's faster than iostream (see Benchmarks) and
type-safe, unlike scanf.

This library is the reference implementation of the ISO C++ standards
proposal P1729 "Text Parsing".

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

%description devel
%{summary}.

%prep
%autosetup -n %{upname}-%{version} -p1

%build
%cmake -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DSCN_BENCHMARKS:BOOL=ON \
    -DSCN_DOCS:BOOL=OFF \
    -DSCN_EXAMPLES:BOOL=OFF \
    -DSCN_INSTALL:BOOL=ON \
    -DSCN_PEDANTIC:BOOL=OFF \
    -DSCN_TESTS:BOOL=ON \
    -DSCN_USE_EXTERNAL_FAST_FLOAT:BOOL=ON \
    -DSCN_USE_EXTERNAL_GTEST:BOOL=ON \
    -DSCN_USE_EXTERNAL_BENCHMARK:BOOL=ON \
    -DSCN_USE_EXTERNAL_REGEX_BACKEND:BOOL=ON \
    -DSCN_WERROR:BOOL=OFF
%cmake_build

%check
%ctest

%install
%cmake_install

%files
%doc README.md
%license LICENSE
%{_libdir}/%{name}.so.4*

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

%changelog
## START: Generated by rpmautospec
* Sun Dec 01 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 4.0.1-3
- Patch for fast_float 7.0.0

* Mon Nov 04 2024 Vitaly <vitaly@easycoding.org> - 4.0.1-2
- Removed no longer needed post-install file cleaning.

* Mon Nov 04 2024 Vitaly <vitaly@easycoding.org> - 4.0.1-1
- Updated to version 4.0.1.

* Sun Nov 03 2024 Vitaly <vitaly@easycoding.org> - 3.0.2-1
- Updated to version 3.0.2.

* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sun Jun 16 2024 Vitaly <vitaly@easycoding.org> - 3.0.1-2
- Added upstream patch with benchmark fixes on Big Endian arches.

* Sun Jun 16 2024 Vitaly <vitaly@easycoding.org> - 3.0.1-1
- Updated to version 3.0.1.

* Wed Mar 27 2024 Vitaly <vitaly@easycoding.org> - 1.1.3-1
- Updated to version 1.1.3.

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

## END: Generated by rpmautospec