File openrazer.spec of Package openrazer

#
# spec file for package openrazer
#
# Copyright (c) 2021 sp1rit <sp1ritCS@protonmail.com>
# 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: openrazer
Version: 0
Release: 0
Summary: KMP driver for Razerâ„¢ periphials
License: GPL-2.0
Group: System/Kernel
URL: https://openrazer.github.io/
Source0: %{name}-%{version}.tar.xz
Source1: system-group-plugdev.conf
Source99: preamble
Requires: openrazer-kmp group(plugdev)

BuildRequires: %kernel_module_package_buildreqs

BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools

%kernel_module_package -p %{_sourcedir}/preamble

%description
An entirely open source driver and user-space daemon that allows you to manage your Razer peripherals on GNU/Linux 

%package -n system-group-plugdev
Summary:        System group 'plugdev'
Group:          System/Fhs
%{sysusers_requires}

%description -n system-group-plugdev
This package provides the system group 'plugdev'.

%prep
%autosetup -p1
%sysusers_generate_pre %{SOURCE1} plugdev

%build
cd driver
for flavor in %flavors_to_build; do
	rm -rf obj/$favor
	mkdir -p obj/$flavor/
	cp -r Makefile *.c *.h obj/$flavor
	make %{?_smp_mflags} -C %{kernel_source $flavor} %{?linux_make_arch} modules M=$PWD/obj/$flavor
done

%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
# needssslcertforbuild
export BRP_PESIGN_FILES='*.ko'
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install M=$PWD/driver/obj/$flavor
done

install -m 644 %{SOURCE1} -D %{buildroot}%{_sysusersdir}/system-group-plugdev.conf

make %{?_smp_mflags} DESTDIR=%{buildroot} udev_install

%pre -n system-group-plugdev -f plugdev.pre

%files
%{_udevrulesdir}/../razer_mount
%{_udevrulesdir}/99-razer.rules

%files -n system-group-plugdev
%defattr(-,root,root)
%{_sysusersdir}/system-group-plugdev.conf

%changelog
openSUSE Build Service is sponsored by