%global use_qt5 1 %global use_qt6 1 %global appname QHotkey %global qt5_build_dir release-qt5 %global qt6_build_dir release-qt6 Name: qhotkey Version: 1.5.0 Release: 2%{?dist} Summary: A global shortcut library for Desktop Qt-Applications License: BSD-3-Clause URL: https://github.com/Skycoder42/QHotkey Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/%{appname}-%{version}.tar.gz Patch0: %{name}-fix-crash-on-wayland-qt6.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig(x11) %if 0%{?use_qt5} BuildRequires: qt5-qtbase-devel BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Widgets) BuildRequires: pkgconfig(Qt5X11Extras) %endif %if 0%{?use_qt6} BuildRequires: qt6-qtbase-devel BuildRequires: pkgconfig(Qt6Core) BuildRequires: pkgconfig(Qt6Widgets) %endif %description QHotkey is a library to handle global shortcuts (hotkeys) in Qt applications, on both Windows and Linux (X11). %if 0%{?use_qt5} %package -n qhotkey-qt5 Summary: A global shortcut library for Qt5 %description -n qhotkey-qt5 QHotkey is a library to handle global shortcuts (hotkeys) in Qt applications, on both Windows and Linux (X11). This package contains the Qt5 version. %package qt5-devel Summary: Development files for QHotkey Qt5 Requires: qhotkey-qt5 = %{version}-%{release} Requires: qt5-qtbase-devel Requires: qt5-qtx11extras-devel %description qt5-devel Development files for QHotkey Qt5 %endif %if 0%{?use_qt6} %package -n qhotkey-qt6 Summary: A global shortcut library for Qt6 %description -n qhotkey-qt6 QHotkey is a library to handle global shortcuts (hotkeys) in Qt applications, on both Windows and Linux (X11). This package contains the Qt6 version. %package qt6-devel Summary: Development files for QHotkey Qt5 Requires: qhotkey-qt6 = %{version}-%{release} Requires: qt5-qtbase-devel Requires: qt5-qtx11extras-devel %description qt6-devel Development files for QHotkey Qt6 %endif %prep %autosetup -p1 -n %{appname}-%{version} %build # Build for Qt5 %{set_build_flags} %if 0%{?use_qt5} mkdir %{qt5_build_dir} && pushd %{qt5_build_dir} %cmake -S'..' \ -DQT_DEFAULT_MAJOR_VERSION=5 \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DQHOTKEY_EXAMPLES:BOOL=ON \ -DCMAKE_INSTALL_LIBDIR=%{_libdir}/qt5 \ -DCMAKE_INSTALL_INCLUDEDIR:PATH=%{_qt5_headerdir} %cmake_build popd %endif # Build for Qt6 %{set_build_flags} %if 0%{?use_qt6} mkdir %{qt6_build_dir} && pushd %{qt6_build_dir} %cmake -S'..' \ -DQT_DEFAULT_MAJOR_VERSION=6 \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DQHOTKEY_EXAMPLES:BOOL=ON \ -DCMAKE_INSTALL_LIBDIR=%{_libdir}/qt6 \ -DCMAKE_INSTALL_INCLUDEDIR:PATH=%{_qt6_headerdir} %cmake_build popd %endif %install # Install Qt5 version %if 0%{?use_qt5} pushd %{qt5_build_dir} %cmake_install popd %endif # Install Qt6 version %if 0%{?use_qt6} pushd %{qt6_build_dir} %cmake_install popd %endif %if 0%{?use_qt5} %files -n qhotkey-qt5 %license LICENSE %doc README.md %{_libdir}/qt5/libqhotkey*.so.* %files qt5-devel %doc README.md %dir %{_libdir}/qt5/cmake %dir %{_libdir}/qt5/cmake/%{appname} %{_libdir}/qt5/cmake/%{appname}/QHotkeyConfig.cmake %{_libdir}/qt5/cmake/%{appname}/QHotkeyConfigVersion.cmake %{_libdir}/qt5/cmake/%{appname}/QHotkeyConfig-release.cmake %{_libdir}/qt5/libqhotkey*.so %dir %{_includedir}/qt5 %{_includedir}/qt5/%{appname} %{_includedir}/qt5/qhotkey.h %endif %if 0%{?use_qt6} %files -n qhotkey-qt6 %license LICENSE %doc README.md %{_libdir}/qt6/libqhotkey*.so.* %files qt6-devel %doc README.md %dir %{_libdir}/qt6/cmake %dir %{_libdir}/qt6/cmake/%{appname} %{_libdir}/qt6/cmake/%{appname}/QHotkeyConfig.cmake %{_libdir}/qt6/cmake/%{appname}/QHotkeyConfigVersion.cmake %{_libdir}/qt6/cmake/%{appname}/QHotkeyConfig-release.cmake %{_libdir}/qt6/libqhotkey*.so %dir %{_includedir}/qt6 %{_includedir}/qt6/%{appname} %{_includedir}/qt6/qhotkey.h %endif %changelog * Thu Aug 08 2024 Martin Gansser - 1.5.0-2 - Add %%{name}-fix-crash-on-wayland-qt6.patch * Sat Jul 06 2024 Martin Gansser - 1.5.0-1 - Initial package