File rtw89.spec of Package rtw89.openSUSE_Leap_15.3_Update

#
# spec file for package rtw89
#
# 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

%{?!_firmwaredir:%define _firmwaredir /lib/firmware}

Name:           rtw89
Version:        5.16~3.g38316db
Release:        0
Summary:        Driver for Realtek 8852AE Wifi chip
License:        GPL-2.0-only
Group:          System/Kernel
URL:            https://github.com/lwfinger/rtw89
Source0:        %{name}-%{version}.tar
Source1:        preamble
BuildRequires:  %{kernel_module_package_buildreqs}
BuildRequires:  pesign-obs-integration
%kernel_module_package -n rtw89 -x debug -x trace -c %{_sourcedir}/_projectcert.crt -p %{_sourcedir}/preamble

%description
A driver for the Realtek 8852AE. Wifi chip with
802.11ax / Wi-Fi 6 support.

%package firmware
Summary:        Firmware for Realtek 8852AE Wifi chip
License:        SUSE-Firmware

%description firmware
Firmware for the Realtek 8852AE. Wifi chip with
802.11ax / Wi-Fi 6 support.

%prep
%setup -q

set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'
[ -n "$SOURCE_DATE_EPOCH" ] && export KBUILD_BUILD_TIMESTAMP=@$SOURCE_DATE_EPOCH
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/rtw89/
export BRP_PESIGN_FILES='*.ko'
export BRP_PESIGN_COMPRESS_MODULE="xz"

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

install -d -m 755 %{buildroot}%{_firmwaredir}/rtw89
install -m 644 -t %{buildroot}%{_firmwaredir}/rtw89 source/*.bin

%files firmware
%{_firmwaredir}/rtw89

%changelog
openSUSE Build Service is sponsored by