File broadcom-wl.spec of Package broadcom-wl

# spec file for package broadcom-wl
#
# Copyright (c) 2025 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:           broadcom-wl
Version:        0+git20251102.4d15843
Release:        0
Summary:        Broadcom 802.11 STA (wl) wireless driver
License:        SUSE-NonFree
Group:          System/Kernel
URL:            https://github.com/bazzite-org/broadcom-wl
Source:         %name-%version.tar.xz
Source1:        preamble
Source2:        broadcom-wl.conf
BuildRequires:  %kernel_module_package_buildreqs
BuildRequires:  xz
Requires:       %{name}-kmp

%kernel_module_package -n %name -p %_sourcedir/preamble

%description
Broadcom’s proprietary "wl" 802.11 driver built as an out-of-tree module.

%prep
%autosetup -p1

%build
pushd ../
for flavor in %flavors_to_build; do
	cp -a "%name-%version" "%name-$flavor-%version"
	pushd "%name-$flavor-%version/"
	# kernel's make install is picky about flags changing/being the same between %%build and %%install
	%make_build -C "/usr/src/linux-obj/%_target_cpu/$flavor" M=$PWD KCFLAGS="-DDEBUG"
	popd
done

%install
pushd ../
for flavor in %flavors_to_build; do
	pushd "%name-$flavor-%version/"
	%make_build -C "/usr/src/linux-obj/%_target_cpu/$flavor" M=$PWD KCFLAGS="-DDEBUG" \
		INSTALL_MOD_PATH="%buildroot" modules_install
	popd
done

install -Dm0644 %SOURCE2 %buildroot/%_modprobedir/broadcom-wl.conf
chmod 0644 %name-%version/LICENSE

%files
%license LICENSE
%_modprobedir/broadcom-wl.conf

%changelog
openSUSE Build Service is sponsored by