File hid-nintendo.spec of Package hid-nintendo

#
# spec file for package hid-nintendo
#
# 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:           hid-nintendo
Version:        0+git20210725~6ee682b2a99e
Release:        0
Summary:        HID driver for Nintendo Switch Joy-Cons and Pro Controllers
Group:          System/Kernel
License:        GPL-2.0-only
URL:            https://github.com/DanielOgorchock/linux
Source0:        %{name}-%{version}.tar.xz
Source1:        hid-nintendo.Kbuild
Source99:       preamble
Patch1:         0001-hid-nintendo-enabled-force-feedback.patch
Patch2:         0002-hid-nintendo-added-LED_FUNCTION_PLAYER-define.patch
BuildRequires:  %{kernel_module_package_buildreqs}

%kernel_module_package -p %{_sourcedir}/preamble


%description
This driver supports the Nintendo Switch Joy-Cons and Pro Controllers.
The Pro Controllers can either be used over USB or Bluetooth.

The driver will retrieve the factory calibration info from the
controllers, so little to no user calibration should be required.

%prep
%autosetup -p1
cp %{SOURCE1} Kbuild

%build
echo %flavors_to_build
for flavor in %flavors_to_build; do
  rm -rf obj/$flavor
  mkdir -p obj/$flavor/
  cp -r Kbuild hid-nintendo.c hid-ids.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='%{kernel_module_package_moddir}'
# needssslcertforbuild
export BRP_PESIGN_FILES='*.ko'
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install \
    M=$PWD/obj/$flavor
done

%changelog
openSUSE Build Service is sponsored by