File openrgb.spec of Package OpenRGB-git-qt6
#
# spec file for package OpenRGB
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global _name OpenRGB
%global _branch master
Name: openrgb
Version: 0.9.1
Release: 0%{?dist}
Summary: Open source RGB lighting control
License: GPL-2.0-only
URL: https://gitlab.com/CalcProgrammer1/OpenRGB
Source0: _service
Source1: openrgb.conf
Patch0: OpenRGB-include_compiler_override.patch
# Leap 15.6 and below cannot use the default GCC7 due to std::filesystem.
# Picking GCC13 as this works with position independent executables
%if ((0%{?sle_version} != 0) && (0%{?sle_version} <= 150600)) && 0%{?is_opensuse}
BuildRequires: gcc13
BuildRequires: gcc13-c++
%endif
BuildRequires: appstream-glib
BuildRequires: desktop-file-utils
BuildRequires: hicolor-icon-theme
BuildRequires: mbedtls-devel
BuildRequires: pkgconfig(gusb)
BuildRequires: pkgconfig(hidapi-hidraw)
BuildRequires: pkgconfig(libe131)
BuildRequires: pkgconfig(Qt6Core)
BuildRequires: pkgconfig(Qt6Widgets)
BuildRequires: qt6-tools-linguist
BuildRequires: qt6-linguist-devel
BuildRequires: qt6-dbus-devel
Requires: %{name}-udev-rules = %{version}
Conflicts: OpenRGB
%description
Git build of OpenRGB with Qt6 and systemd unit.
The purpose of this tool is to control RGB lights on different peripherals.
Accessing the SMBus is a potentially dangerous operation, so exercise caution.
%package udev-rules
BuildArch: noarch
Summary: OpenRGB udev rules
Conflicts: OpenRGB-udev-rules
%description udev-rules
This package contains the udev rules for OpenRGB.
%package systemd-unit
BuildArch: noarch
Summary: OpenRGB systemd unit
%description systemd-unit
This package contains the systemd unit for OpenRGB.
%prep
%autosetup -p1 -n %{_sourcedir}/%{name}-%{version} -T -D
%build
%define _commit %(awk '/^commit/{print $2}' %{_sourcedir}/%{name}.obsinfo)
# Leap 15.6 and below cannot use default GCC7 due to std::filesystem, use override.
%if ((0%{?sle_version} != 0) && (0%{?sle_version} <= 150600)) && 0%{?is_opensuse}
# Use config callout to project for compiler override
%qmake6 CONFIG+=LINUX_GCC_WORKAROUND GIT_COMMIT_ID=%{_commit} GIT_BRANCH=%{_branch}
%else
%qmake6 GIT_COMMIT_ID=%{_commit} GIT_BRANCH=%{_branch}
%endif
%make_build
%install
%make_install INSTALL_ROOT=%{buildroot}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_modulesloaddir}/%{name}.conf
%check
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
mkdir -p "%buildroot/%_docdir/%{name}"
cp -a %{_sourcedir}/%{name}-%{version}/README.md "%buildroot/%_docdir/%{name}"
mkdir -p "%buildroot/usr/share/licenses/%{name}"
cp -a %{_sourcedir}/%{name}-%{version}/LICENSE "%buildroot/usr/share/licenses/%{name}"
%post udev-rules
%udev_rules_update
%postun udev-rules
%udev_rules_update
%pre systemd-unit
%service_add_pre %{name}.service
%post systemd-unit
%fillup_only
%service_add_post %{name}.service
%preun systemd-unit
%service_del_preun %{name}.service
%postun systemd-unit
%service_del_postun %{name}.service
%files
%_docdir/%{name}
/usr/share/licenses/%{name}
%{_bindir}/%{name}
%{_datadir}/icons/hicolor/*/apps/org.%{name}.%{_name}.png
%{_datadir}/applications/org.%{name}.%{_name}.desktop
%{_datadir}/metainfo/org.%{name}.%{_name}.metainfo.xml
%files udev-rules
%{_udevrulesdir}/60-openrgb.rules
%files systemd-unit
%dir %{_modulesloaddir}
%{_unitdir}/%{name}.service
%{_modulesloaddir}/%{name}.conf
%changelog