## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 7;
    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 forgeurl0 https://github.com/skypjack/uvw
%global libuv_ver 1.44
%global tag0 v%{version}_libuv_v%{libuv_ver}
%global distprefix %{nil}

%undefine __cmake_in_source_build
%global debug_package %{nil}

Name:           uvw
Version:        2.12.1
%forgemeta
Release:        %autorelease
Summary:        Header-only easy to use libuv C++ wrapper

License:        MIT
URL:            https://github.com/skypjack/uvw
Source0:        %forgesource

# https://github.com/skypjack/uvw/pull/253
Patch1:         uvw-2.10-test-libuv-dynamic.patch
# https://github.com/skypjack/uvw/pull/273
Patch2:         uvw-2.12-stdint.patch

BuildRequires:  gcc-c++, cmake
BuildRequires:  libuv-devel >= %{libuv_ver}
BuildRequires:  libcxx-devel
BuildRequires:  doxygen
BuildRequires:  gtest-devel
BuildRequires:  sed

%description
Not used.

%package        devel
Summary:        %{summary}
# Default is header only mode
#Requires:       %%{name}%%{?_isa} = %%{version}-%%{release}
Requires:       pkg-config
Requires:       cmake-filesystem
Requires:       libuv-devel >= %{libuv_ver}
Provides:       %{name}-static = %{version}-%{release}
Suggests:       %{name}-doc

%description    devel
uvw started as a header-only, event based, tiny and easy to use
wrapper for libuv written in modern C++.
Now it's finally available also as a compilable static library.

The basic idea is to hide completely the C-ish interface of libuv behind a graceful C++ API.
Currently, no uv_*_t data structure is actually exposed by the library.
Note that uvw stays true to the API of libuv and it doesn't add anything
to its interface. For the same reasons, users of the library must follow
the same rules which are used with libuv.

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

%package        doc
Summary:        %{summary} API documentation
BuildArch:      noarch

%description    doc
uvw started as a header-only, event based, tiny and easy to use
wrapper for libuv written in modern C++.

The %{name}-doc package contains API documentation in HTML format.

%prep
%forgeautosetup -p1

sed -e 's,DESTINATION share/${PROJECT_NAME},DESTINATION share/doc/${PROJECT_NAME},' \
    -i docs/CMakeLists.txt
# Make uvw semi-dynamic. libuv should be linked dynamic, uvw static way.
echo 'Requires: libuv' >> libuvw-static.pc.in

# This check is failing on some platforms
sed -e 's|ASSERT_NE(cpuInfo\[0\].speed, decltype(cpuInfo\[0\].speed){0});|// &|' \
    -i test/uvw/util.cpp

%build
%cmake -DFETCH_LIBUV=OFF -DBUILD_TESTING=ON -DBUILD_DOCS=ON -DFIND_GTEST_PACKAGE=ON
%cmake_build


%install
%cmake_install


%check
%ctest


%{?ldconfig_scriptlets}


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

%files doc
%license LICENSE
%dir %{_docdir}/%{name}-%{version}
%{_docdir}/%{name}-%{version}/html


%changelog
## START: Generated by rpmautospec
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.12.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.12.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.12.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Mon Feb 20 2023 Petr Menšík <pemensik@redhat.com> - 2.12.1-4
- Include cstdint header where appropriate

* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.12.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Aug 02 2022 Petr Menšík <pemensik@redhat.com> - 2.12.1-2
- Remove pkg-config, remove CC-BY from licenses

* Tue Aug 02 2022 Petr Menšík <pemensik@redhat.com> - 2.12.1-1
- Upgrade to 12.1 (#2113750)

* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.11.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.11.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Jan 19 2022 Petr Menšík <pemensik@redhat.com> - 2.11.0-2
- Make not to documentation license

* Tue Jan 18 2022 Petr Menšík <pemensik@redhat.com> - 2.11.0-1
- Update to 2.11.0

* Tue Jan 18 2022 Petr Menšík <pemensik@redhat.com> - 2.10.0-4
- Do not require non-existing package

* Tue Jan 18 2022 Petr Menšík <pemensik@redhat.com> - 2.10.0-3
- Upload sources

* Tue Jan 18 2022 Petr Menšík <pihhan@gmail.com> - 2.10.0-2
- Add version to static provide

* Tue Jan 18 2022 Petr Menšík <pihhan@gmail.com> - 2.10.0-1
- Incorporate comments from review

* Tue Jan 18 2022 Petr Menšík <pemensik@redhat.com> - 2.9.0-3
- Ignore failing test, comment it out

* Tue Jan 18 2022 Petr Menšík <pemensik@redhat.com> - 2.9.0-2
- Move bigger doc part into noarch package

* Tue Jan 18 2022 Petr Menšík <pemensik@redhat.com> - 2.9.0-1
- Initial fedora package spec
## END: Generated by rpmautospec