File opendragon.spec of Package opendragon

#
# spec file for package opendragon
#
# 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/
#
# needssslcertforbuild


%{!?_modprobedir: %define _modprobedir /lib/modprobe.d/}
%{!?_modulesloaddir: %define _modulesloaddir /usr/lib/modules-load.d/}

Name:           opendragon
Version:        0~git20210815.a046999
Release:        0
Summary:        Open Redragon drivers
License:        GPL-3.0-only
URL:            https://github.com/GrbavaCigla/opendragon
Source:         %{name}-%{version}.tar.xz
Source1:        preamble
Source2:        modules-load.d_opendragon.conf
BuildRequires:  %{kernel_module_package_buildreqs}

%if 0%{?is_opensuse}
%kernel_module_package -p %{_sourcedir}/preamble
%else
%kernel_module_package -c %_sourcedir/_projectcert.crt -p %{_sourcedir}/preamble
%endif

%description
Open Redragon drivers. Currently only supporting some mice.

%package autoload
Summary:        Autoload driver for opendragon device
Supplements:    kmod(opendragon.ko)
BuildArch:      noarch
Requires:       systemd

%description autoload
Configuration files to autoload the module during system startup.

%prep
%autosetup
set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
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

%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR='%{kernel_module_package_moddir}'
for flavor in %{flavors_to_build}; do
	make V=1 -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor
done

export BRP_PESIGN_FILES='*.ko'

install -D -m 0644 %{SOURCE2} %{buildroot}%{_modulesloaddir}/opendragon.conf

%files autoload
%dir %{_modulesloaddir}
%{_modulesloaddir}/opendragon.conf

%changelog
openSUSE Build Service is sponsored by