File OpenRGB.spec of Package OpenRGB
#
# 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/
#
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
# PATCH-FEATURE-OPENSUSE OpenRGB-use_system_libs.patch
# No longer needed, auto-detection code built-in to project now.
# Patch0: OpenRGB-use_system_libs.patch
# PATCH-FEATEURE-OPENSUSE OpenRGB-include_compiler_override.patch
Patch2: OpenRGB-include_compiler_override.patch
# Tumbleweed can use the default compiler
%if 0%{?suse_version} > 1600
BuildRequires: gcc-c++
# Leap 15.6 and below cannot use the default GCC7 due to std::filesystem.
# We could technically use GCC8, but this must synchronise with the
# compiler override patch above so GCC10 is where it is.
%else
%if ((0%{?sle_version} != 0) && (0%{?sle_version} <= 150600)) && 0%{?is_opensuse}
BuildRequires: gcc10
BuildRequires: gcc10-c++
%endif
%endif
BuildRequires: libqt5-linguist
BuildRequires: libqt5-linguist-devel
BuildRequires: libQt5DBus-devel
BuildRequires: mbedtls-devel
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(gusb)
BuildRequires: pkgconfig(hidapi-hidraw)
BuildRequires: pkgconfig(libe131)
Requires: %{name}-udev-rules = %{version}
%description
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
%description udev-rules
This package contain the udev rules for OpenRGB.
%prep
%autosetup -p1 -n %{_sourcedir}/%{name}-%{version} -T -D
%build
# 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}
# Replicate qmake5 macro with config callout to project compiler override
%{_libdir}/qt5/bin/qmake CONFIG+=LINUX_GCC_WORKAROUND QMAKE_CXXFLAGS="$CXXFLAGS %{optflags} -DOPENSSL_LOAD_CONF" QMAKE_CFLAGS="$CFLAGS %{optflags} -DOPENSSL_LOAD_CONF" QMAKE_LFLAGS="$LDFLAGS -Wl,--as-needed -Wl,--no-undefined"
%else
%qmake5
%endif
%make_build
%install
%make_install INSTALL_ROOT=%{buildroot}
%suse_update_desktop_file -c %{name} %{name} 'Configure RGB LEDs' openrgb %{name} Settings HardwareSettings
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}"
# see if creating .conf to load speficic kernel modules is necessary
%post udev-rules
%udev_rules_update
%postun udev-rules
%udev_rules_update
%files
%_docdir/%{name}
/usr/share/licenses/%{name}
%{_bindir}/openrgb
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/applications/*.desktop
%{_datadir}/metainfo/org.openrgb.OpenRGB.metainfo.xml
%files udev-rules
%{_udevrulesdir}/60-openrgb.rules
%changelog