File razer-laptop-control.spec of Package razer-laptop-control

#
# spec file for package razer-laptop-control
#
# Copyright (c) 2021 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:           razer-laptop-control
Version:        1.3.0
Release:        0
Summary:        Performance control for Razer laptops
License:        GPL-2.0-only AND SUSE-PublicDomain
URL:            https://github.com/rnd-ash/razer-laptop-control
Source:         https://github.com/rnd-ash/razer-laptop-control/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        preamble
# from https://freesvg.org/laptop-computer-seen-from-above
Source2:        %{name}.svg
# PATCH-FIX-UPSTREAM add_include.patch
###Patch0:         add_include.patch
# PATCH-FIX-UPSTREAM fix_typo.patch
###Patch1:         fix_typo.patch
# PATCH-FIX-UPSTREAM app_linking.patch
###Patch2:         app_linking.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  cmake(Qt5DBus)
BuildRequires:  pkgconfig(libsystemd)
###BuildRequires:  %{kernel_module_package_buildreqs}
###%kernel_module_package -p %{_sourcedir}/preamble

%description
Designed to be a replacment driver to openrazer project with additional
support for Razer laptops fan and power mode modifications.

%package utils
Summary:        Utils for the %{name} kernel module

%description utils
This package contains utilities to be used with the %{name} module.

%prep
%autosetup -p1
pushd driver
set -- *
mkdir source
mv "$@" source/
mkdir obj
popd

# fix udev path
sed -i 's|/etc/udev/rules.d|%{_udevrulesdir}|' udev/99-razerlc.rules

%build
pushd driver
for flavor in %{flavors_to_build}; do
	rm -rf obj/$flavor
	cp -r source obj/$flavor
	make V=1 %{?_smp_mflags} -C %{kernel_source $flavor} %{?linux_make_arch} modules M=$PWD/obj/$flavor
done
popd

pushd daemon
##%%cmake
##%%cmake_build
popd

pushd application/razer-laptop-control-daemon
##%%cmake
##%%cmake_build
popd

%install
pushd driver
export INSTALL_MOD_PATH=%{buildroot}
###export DESTDIR=%%{buildroot}
###export INSTALL_MOD_DIR='%%{kernel_module_package_moddir}'
export MODULEDIR='%{kernel_module_package_moddir}'
###/lib/modules/$(shell uname -r)/kernel/hid

for flavor in %{flavors_to_build}; do
	make V=1 -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor
###	make V=1 -C obj/$flavor install-utils DESTDIR=%{?buildroot:%{buildroot}} PREFIX=%{_prefix}
###	make V=1 -C obj/$flavor install-man DESTDIR=%{?buildroot:%{buildroot}} PREFIX=%{_prefix}
done
popd

##install -Dm0755 daemon/build/razercontrol-daemon %%{buildroot}%%{_bindir}/razercontrol-daemon
install -Dm0644 daemon/razerlaptop-control.service %{buildroot}%{_unitdir}/razerlaptop-control.service

##install -Dm0755 application/razer-laptop-control-daemon/build/razer-laptop-control-daemon \
##                %%{buildroot}%%{_bindir}/razer-laptop-control-daemon

install -Dm0644 udev/99-razerlc.rules %{buildroot}%{_udevrulesdir}/99-razerlc.rules
install -Dm0755 udev/razer_perms.sh %{buildroot}%{_udevrulesdir}/razer_perms.sh

install -Dm0644 %{SOURCE2} %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps/razer-laptop-control-daemon.svg
%suse_update_desktop_file -c razer-laptop-control-daemon razer-laptop-control-daemon 'Configure Razer keyboards' razer-laptop-control-daemon razer-laptop-control-daemon Settings HardwareSettings

%preun utils
%service_del_preun %{name}.service

%pre utils
%service_add_pre %{name}.service

%postun utils
%service_del_postun %{name}.service

%post utils
%service_add_post %{name}.service

%files utils
%license LICENSE
%doc README.md
##%%{_bindir}/razercontrol-daemon
##%%{_bindir}/razer-laptop-control-daemon
%{_datadir}/applications/razer-laptop-control-daemon.desktop
%{_datadir}/icons/hicolor/scalable/apps/razer-laptop-control-daemon.svg
%{_udevrulesdir}/99-razerlc.rules
%{_udevrulesdir}/razer_perms.sh
%{_unitdir}/razerlaptop-control.service

%changelog
openSUSE Build Service is sponsored by