41 lines
1.8 KiB
Plaintext
41 lines
1.8 KiB
Plaintext
|
# Defines %flavors_to_build and %kernel_source() as a side effect.
|
||
|
%_kernel_module_package(n:v:r:s:f:Xp:) \
|
||
|
BuildRequires: module-init-tools kernel-syms\
|
||
|
%{expand:%( \
|
||
|
subpkg=%{-s*}%{!-s:/usr/lib/rpm/kernel-module-subpackage} \
|
||
|
echo "%%define _suse_kernel_module_subpackage(n:v:r:f:p:) %%{expand:%%(cd %_sourcedir; cat $subpkg; echo %%%%nil)}" \
|
||
|
flavors="%{!-X:%*}%{-X:$(ls /usr/src/linux-obj/%_target_cpu 2>/dev/null)}" \
|
||
|
flavors_to_build= \
|
||
|
kver=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-source) \
|
||
|
for flavor in $flavors; do \
|
||
|
if [ -n "%{-X}" ]; then \
|
||
|
case " %* " in \
|
||
|
(*" $flavor "*) \
|
||
|
continue ;; \
|
||
|
esac \
|
||
|
fi \
|
||
|
krel=$(make -s -C /usr/src/linux-obj/%_target_cpu/$flavor kernelrelease) \
|
||
|
[ -e /boot/symsets-$krel.tar.gz ] || continue \
|
||
|
flavors_to_build="$flavors_to_build $flavor" \
|
||
|
echo "%%_suse_kernel_module_subpackage -n %{-n*}%{!-n:%name}-kmp -v %{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-p} $flavor $krel $kver" \
|
||
|
done \
|
||
|
echo "%%global flavors_to_build${flavors_to_build:-%%nil}" \
|
||
|
echo "%%{expand:%%(test -z '%flavors_to_build' && echo %%%%internal_kmp_error)}" \
|
||
|
echo "%%global kernel_source() /usr/src/linux-obj/%_target_cpu/%%%%{1}" \
|
||
|
\
|
||
|
echo "%package -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
|
||
|
echo "Version: %version" \
|
||
|
echo "Summary: %summary" \
|
||
|
echo "Group: %group" \
|
||
|
echo "%description -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
|
||
|
)}
|
||
|
|
||
|
# kernel_module_package: simply pass on all options and arguments.
|
||
|
%kernel_module_package(n:v:r:s:f:xp:) \
|
||
|
%{expand:%%_kernel_module_package %{-x:-X} %{-n} %{-v} %{-r} %{-s} %{-f} %{-p} %*}
|
||
|
|
||
|
# suse_kernel_module_package: invert the meaning of the -x flag. (You are not
|
||
|
# supposed to understand why a simple %{-x:}%{!-x:-x} won't work.)
|
||
|
%suse_kernel_module_package(n:v:r:s:f:xp:) \
|
||
|
%{expand:%%_kernel_module_package %{-x: }%{!-x:-X} %{-n} %{-v} %{-r} %{-s} %{-f} %{-p} %*}
|