File tuxedo-keyboard.spec of Package tuxedo-keyboard

#
# spec file for package tuxedo-keyboard
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2020-2021 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# 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:           tuxedo-keyboard
Version:        3.2.3
Release:        0
Summary:        TUXEDO Computers Kernel Module
License:        GPL-2.0-only
Group:          System/Kernel
URL:            https://www.tuxedocomputers.com/
Source0:        %{name}-%{version}.tar.gz
Source1:        SUSE.tuxedo-keyboard.conf
Source99:       preamble
BuildRequires:  %{kernel_module_package_buildreqs}
Conflicts:      %{name} = %{version}
Provides:       %{name} = %{version}
Obsoletes:      %{name} < %{version}

%description
TUXEDO Computers Kernel Module for keyboard backlighting.

%kernel_module_package -p %{_sourcedir}/preamble

%prep
%autosetup -p1

set -- *
mkdir source
cp -r "$@" source/
mkdir obj

%build
export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'
export KBUILD_NOPEDANTIC=1
for flavor in %{flavors_to_build}; do
	rm -rf obj/$flavor
	cp -r source obj/$flavor
	%make_build -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules \
		M=$PWD/obj/$flavor
done

%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
for flavor in %{flavors_to_build}; do
	make -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules_install \
		M=$PWD/obj/$flavor
done

install -Dm0644 tuxedo_keyboard.conf %{buildroot}%{_sysconfdir}/modprobe.d/tuxedo_keyboard.conf
install -Dm0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/modules-load.d/tuxedo-keyboard.conf

%files
%config %{_sysconfdir}/modprobe.d/tuxedo_keyboard.conf
%dir %{_prefix}/lib/modules-load.d
%{_prefix}/lib/modules-load.d/tuxedo-keyboard.conf

%changelog
openSUSE Build Service is sponsored by