# PACKAGE_NAME with package name
#
# Conditional build:
-%bcond_without dist_kernel # allow non-distribution kernel
%bcond_without kernel # don't build kernel modules
%bcond_without userspace # don't build userspace programs
%bcond_with verbose # verbose build (V=1)
-%if %{without kernel}
-%undefine with_dist_kernel
+%if "%{?alt_kernel}" != "" && 0%{?build_kernels:1}
+ %{error:alt_kernel (%{?alt_kernel}) and build_kernels (%{?build_kernels}) defined}
%endif
-# The goal here is to have main, userspace, package built once with
-# simple release number, and only rebuild kernel packages with kernel
-# version as part of release number, without the need to bump release
-# with every kernel change.
%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
%{error:kernel and userspace cannot be built at the same time on PLD builders}
exit 1
%endif
-%if "%{_alt_kernel}" != "%{nil}"
-%if 0%{?build_kernels:1}
-%{error:alt_kernel and build_kernels are mutually exclusive}
-exit 1
-%endif
-%undefine with_userspace
-%global _build_kernels %{alt_kernel}
-%else
-%global _build_kernels %{?build_kernels:,%{?build_kernels}}
-%endif
-
%if %{without userspace}
# nothing to be placed to debuginfo package
%define _enable_debug_packages 0
%endif
-
-%define kbrs %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo "BuildRequires:kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2" ; done)
-%define kpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
-%define bkpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
-%define ikpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%install_kernel_pkg ; done)
-
#
# main package.
#
# Source1-md5: -
#Patch0: %{pname}-what.patch
#URL: -
-BuildRequires: rpmbuild(macros) >= 1.678
-%{?with_dist_kernel:%{expand:%kbrs}}
+BuildRequires: rpmbuild(macros) >= 1.701
+%{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
#BuildRequires: -
#Requires(postun): -
#Requires(pre,post): -
Release: %{rel}@%{_kernel_ver_str}\
Group: Base/Kernel\
Requires(post,postun): /sbin/depmod\
-%if %{with dist_kernel}\
%requires_releq_kernel\
Requires(postun): %releq_kernel\
-%endif\
\
%description -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME\
This is driver for MODULE_NAME for Linux.\
EOF\
%{nil}
-%{?with_kernel:%{expand:%kpkg}}
+%{?with_kernel:%{expand:%create_kernel_packages}}
%prep
%setup -q -n %{pname}-%{version}
EOF
%build
+%{?with_kernel:%{expand:%build_kernel_packages}}
+
%if %{with userspace}
%endif
-%{?with_kernel:%{expand:%bkpkg}}
-
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT
-%if %{with userspace}
-
-%endif
-
%if %{with kernel}
-%{expand:%ikpkg}
+%{expand:%install_kernel_packages}
cp -a installed/* $RPM_BUILD_ROOT
%endif
+%if %{with userspace}
+
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT