File iqaudio.spec of Package iqaudio

#
# spec file for package iqaudio
#
# Copyright (c) 2022 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/
#

%define _rpi_branch_tumbleweed rpi-6.16.y
%define _rpi_branch_leap_16_0 rpi-6.12.y

Name:           iqaudio
Version:        0.1
Release:        0
Summary:        iqaudio-dac Kernel module
License:        GPL-2.0-only
Source0:        preamble
Source1:        Kbuild
Source10:       https://raw.githubusercontent.com/raspberrypi/linux/%{_rpi_branch_tumbleweed}/sound/soc/bcm/iqaudio-dac.c#/iqaudio-dac-%{_rpi_branch_tumbleweed}.c
Source11:       https://raw.githubusercontent.com/raspberrypi/linux/%{_rpi_branch_leap_16_0}/sound/soc/bcm/iqaudio-dac.c#/iqaudio-dac-%{_rpi_branch_leap_16_0}.c
BuildRequires:  %{kernel_module_package_buildreqs}

%kernel_module_package -p %{_sourcedir}/preamble

%description
iqaudio-dac Kernel module

%prep
mkdir source
cp "%{SOURCE0}" source/
cp "%{SOURCE1}" source/
%if 0%{?suse_version} > 1600
cp "%{SOURCE10}" source/iqaudio-dac.c
%else
cp "%{SOURCE11}" source/iqaudio-dac.c
%endif
mkdir obj

%build
for flavor in %{flavors_to_build}; do
	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

%changelog
openSUSE Build Service is sponsored by