[packages/wl] - switch to macro driven module build for multiple kernel versions - rel 4

baggins baggins at pld-linux.org
Tue Oct 29 14:38:46 CET 2013


commit ed656948a789c5ce3e16a8b8734ea4a6346af4bc
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Oct 29 14:38:25 2013 +0100

    - switch to macro driven module build for multiple kernel versions
    - rel 4

 wl.spec | 132 +++++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 80 insertions(+), 52 deletions(-)
---
diff --git a/wl.spec b/wl.spec
index f5c60e3..9e16adc 100644
--- a/wl.spec
+++ b/wl.spec
@@ -2,18 +2,45 @@
 %bcond_without	dist_kernel	# allow non-distribution kernel
 %bcond_without	kernel		# don't build kernel modules
 %bcond_with	verbose		# verbose build (V=1)
-%bcond_with	dkms	# build dkms package
+%bcond_with	dkms		# build dkms package
+
+%if %{without kernel}
+%undefine	with_dist_kernel
+%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
+%global		_build_kernels		%{alt_kernel}
+%else
+%global		_build_kernels		%{?build_kernels:,%{?build_kernels}}
+%endif
 
 # nothing to be placed to debuginfo package
 %define		_enable_debug_packages	0
 
-%define		rel	3
+%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		rel	4
 %define		pname	wl
 %define		file_ver	%(echo %{version} | tr . _)
 Summary:	Broadcom 802.11 a/b/g/n hybrid Linux networking device driver
 Name:		%{pname}%{_alt_kernel}
 Version:	6.30.223.141
-Release:	%{rel}
+Release:	%{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
 License:	other
 Group:		Base/Kernel
 Source0:	http://www.broadcom.com/docs/linux_sta/hybrid-v35-nodebug-pcoem-%{file_ver}.tar.gz
@@ -25,13 +52,8 @@ Source2:	http://www.broadcom.com/docs/linux_sta/README.txt
 Source3:	dkms.conf
 Patch0:		broadcom-sta-6.30.223.141-kernel-3.10.patch
 URL:		http://www.broadcom.com/support/802.11/linux_sta.php
-%{?with_dist_kernel:BuildRequires:	kernel%{_alt_kernel}-module-build >= 3:2.6.20.2}
-BuildRequires:	rpmbuild(macros) >= 1.379
-Requires(post,postun):	/sbin/depmod
-%if %{with dist_kernel}
-%requires_releq_kernel
-Requires(postun):	%releq_kernel
-%endif
+BuildRequires:	rpmbuild(macros) >= 1.678
+%{?with_dist_kernel:%{expand:%kbrs}}
 ExclusiveArch:	%{ix86} %{x8664}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -44,25 +66,6 @@ BCM43228-based hardware.
 This is an Official Release of Broadcom's hybrid Linux driver for use
 with Broadcom based hardware.
 
-%package -n kernel%{_alt_kernel}-net-wl
-Summary:	Broadcom 802.11 a/b/g/n hybrid Linux networking device driver
-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}-net-wl
-These packages contain Broadcom's IEEE 802.11a/b/g/n hybrid Linux
-device driver for use with Broadcom's BCM4311-, BCM4312-, BCM4313-,
-BCM4321-, BCM4322-, BCM43224-, and BCM43225-, BCM43227- and
-BCM43228-based hardware.
-
-This is an Official Release of Broadcom's hybrid Linux driver for use
-with Broadcom based hardware.
-
 %package -n dkms-%{pname}
 Summary:	DKMS-ready driver for Broadcom WL driver
 Group:		Base/Kernel
@@ -76,6 +79,51 @@ BuildArch:	noarch
 %description -n dkms-%{pname}
 This package contains a DKMS-ready driver for Broadcom WL driver.
 
+%define	kernel_pkg()\
+%package -n kernel%{_alt_kernel}-net-wl\
+Summary:	Broadcom 802.11 a/b/g/n hybrid Linux networking device driver\
+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}-net-wl\
+These packages contain Broadcom's IEEE 802.11a/b/g/n hybrid Linux\
+device driver for use with Broadcom's BCM4311-, BCM4312-, BCM4313-,\
+BCM4321-, BCM4322-, BCM43224-, and BCM43225-, BCM43227- and\
+BCM43228-based hardware.\
+\
+This is an Official Release of Broadcom's hybrid Linux driver for use\
+with Broadcom based hardware.\
+\
+%files -n kernel%{_alt_kernel}-net-wl\
+%defattr(644,root,root,755)\
+%doc lib/LICENSE.txt README.txt\
+/lib/modules/%{_kernel_ver}/kernel/drivers/net/wireless/*.ko*\
+\
+%post -n kernel%{_alt_kernel}-net-wl\
+%depmod %{_kernel_ver}\
+\
+%posttrans -n kernel%{_alt_kernel}-net-wl\
+%banner -e kernel%{_alt_kernel}-net-wl <<EOF\
+WARNING! This kernel module is not GPL licensed.\
+Before using it be sure to accept license: %{_docdir}/kernel%{_alt_kernel}-net-wl-%{version}/LICENSE.txt*\
+EOF\
+\
+%postun -n kernel%{_alt_kernel}-net-wl\
+%depmod %{_kernel_ver}\
+%{nil}
+
+%define build_kernel_pkg()\
+%build_kernel_modules -m wl\
+%install_kernel_modules -D installed -m wl -d kernel/drivers/net/wireless\
+%{nil}
+
+%{?with_kernel:%{expand:%kpkg}}
+
 %prep
 %ifarch %{x8664}
 %define src 1
@@ -106,14 +154,13 @@ EXTRA_LDFLAGS	:= $(KBUILD_EXTMOD)/lib/wlc_hybrid.o_shipped
 EOF
 
 %build
-%if %{with kernel}
-%build_kernel_modules -m wl
-%endif
+%{?with_kernel:%{expand:%bkpkg}}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 %if %{with kernel}
-%install_kernel_modules -m wl -d kernel/drivers/net/wireless
+install -d $RPM_BUILD_ROOT
+cp -a installed/* $RPM_BUILD_ROOT
 %endif
 
 %if %{with dkms}
@@ -126,18 +173,6 @@ sed -e 's|@pname@|%{pname}|g' -e 's|@MODVERSION@|%{version}-%{rel}|g' \
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post -n kernel%{_alt_kernel}-net-wl
-%depmod %{_kernel_ver}
-
-%posttrans -n kernel%{_alt_kernel}-net-wl
-%banner -e kernel%{_alt_kernel}-net-wl <<EOF
-WARNING! This kernel module is not GPL licensed.
-Before using it be sure to accept license: %{_docdir}/kernel%{_alt_kernel}-net-wl-%{version}/LICENSE.txt*
-EOF
-
-%postun -n kernel%{_alt_kernel}-net-wl
-%depmod %{_kernel_ver}
-
 %post -n dkms-%{pname}
 %{_sbindir}/dkms add -m %{pname} -v %{version}-%{rel} --rpm_safe_upgrade && \
 %{_sbindir}/dkms build -m %{pname} -v %{version}-%{rel} --rpm_safe_upgrade && \
@@ -146,13 +181,6 @@ EOF
 %preun -n dkms-%{pname}
 %{_sbindir}/dkms remove -m %{pname} -v %{version}-%{rel} --rpm_safe_upgrade --all || :
 
-%if %{with kernel}
-%files -n kernel%{_alt_kernel}-net-wl
-%defattr(644,root,root,755)
-%doc lib/LICENSE.txt README.txt
-/lib/modules/%{_kernel_ver}/kernel/drivers/net/wireless/*.ko*
-%endif
-
 %if %{with dkms}
 %files -n dkms-%{pname}
 %defattr(644,root,root,755)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/wl.git/commitdiff/ed656948a789c5ce3e16a8b8734ea4a6346af4bc



More information about the pld-cvs-commit mailing list