#global unstable 0
%global qt_module qthttpserver

%global examples 1

Name:       qt6-qthttpserver
Version: 6.8.1
Release: 1%{?dist}
Summary:    Library to facilitate the creation of an http server with Qt

License:    BSD-3-Clause AND GFDL-1.3-no-invariants-only AND GPL-3.0-only WITH Qt-GPL-exception-1.0
URL:        http://qt-project.org/
%global     majmin %(echo %{version} | cut -d. -f1-2)
%global     qt_version %(echo %{version} | cut -d~ -f1)

%if 0%{?unstable}
Source0:    https://download.qt.io/development_releases/qt/%{majmin}/%{qt_version}/submodules/%{qt_module}-everywhere-src-%{qt_version}-%{prerelease}.tar.xz
%else
Source0:    https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submodules/%{qt_module}-everywhere-src-%{version}.tar.xz
%endif

BuildRequires:  qt6-rpm-macros
BuildRequires:  cmake
BuildRequires:  gcc-toolset-14-gcc-c++
BuildRequires:  ninja-build
BuildRequires:  cmake(Qt6BuildInternals) = %{version}
BuildRequires:  cmake(Qt6Core) = %{version}
BuildRequires:  qt6-qtbase-private-devel = %{version}
BuildRequires:  cmake(Qt6Network) = %{version}
BuildRequires:  cmake(Qt6Concurrent) = %{version}
BuildRequires:  cmake(Qt6WebSockets) = %{version}
BuildRequires:  cmake(Qt6Gui) = %{version}
BuildRequires:  pkgconfig(xkbcommon)

%description
%{summary}.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%if 0%{?examples}
%package        examples
Summary:        Document files for %{name}
Requires:       %{name}-devel = %{version}-%{release}
%description    examples
The %{name}-examples package contains examples that pertain
to the usage of %{name}.
%endif

%prep
%autosetup -n %{qt_module}-everywhere-src-%{version} -p1


%build
%enable_devtoolset14

%cmake_qt6 \
  -DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF} \
  -DQT_INSTALL_EXAMPLES_SOURCES=%{?examples:ON}%{!?examples:OFF}

%cmake_build


%install
%cmake_install

%files
%license LICENSES/*.txt
%{_qt6_libdir}/libQt6HttpServer.so.6{,.*}

%files devel
%dir %{_qt6_headerdir}/QtHttpServer
%{_qt6_headerdir}/QtHttpServer/*
%{_qt6_libdir}/cmake/Qt6BuildInternals/StandaloneTests/QtHttpServerTestsConfig.cmake
%dir %{_qt6_libdir}/cmake/Qt6HttpServer
%{_qt6_libdir}/cmake/Qt6HttpServer/*
%{_qt6_libdir}/libQt6HttpServer.prl
%{_qt6_libdir}/libQt6HttpServer.so
%{_qt6_libdir}/pkgconfig/Qt6HttpServer.pc
%{_qt6_libdir}/qt6/metatypes/qt6httpserver_relwithdebinfo_metatypes.json
%{_qt6_libdir}/qt6/mkspecs/modules/qt_lib_httpserver.pri
%{_qt6_libdir}/qt6/mkspecs/modules/qt_lib_httpserver_private.pri
%{_qt6_libdir}/qt6/modules/HttpServer.json
%{_qt6_libdir}/qt6/sbom/%{qt_module}-*.spdx

%if 0%{?examples}
%files examples
%{_qt6_libdir}/qt6/examples/
%endif

%changelog
* Tue Dec  3 2024 Raven <raven@sysadmins.ws> - 6.8.1-1
- 6.8.1

* Thu Oct 10 2024 Raven <raven@sysadmins.ws> - 6.8.0-1
- 6.8.0

* Mon Sep 30 2024 Raven <raven@sysadmins.ws> - 6.7.3-1
- 6.7.3

* Thu Jun 27 2024 Raven <raven@sysadmins.ws> - 6.7.2-2
- rebuild (libxkbcommon)

* Wed Jun 26 2024 Raven <raven@sysadmins.ws> - 6.7.2-1
- 6.7.2

* Mon May 27 2024 Raven <raven@sysadmins.ws> - 6.7.1-1
- 6.7.1

* Wed May  8 2024 Raven <raven@sysadmins.ws> - 6.7.0-1
- 6.7.0

* Mon Nov 27 2023 Jan Grulich <jgrulich@redhat.com> - 6.6.1-1
- 6.6.1

* Tue Oct 10 2023 Jan Grulich <jgrulich@redhat.com> - 6.6.0-1
- 6.6.0

* Mon Oct 02 2023 Justin Zobel <justin.zobel@gmail.com> - 6.5.3-1
- Update to 6.5.3

* Sat Sep 23 2023 Steve Cossette <farchord@gmail.com> - 6.5.2-1
- Initial release
