[packages/r8168] - switch to macro driven module build for multiple kernel versions - rel 8
baggins
baggins at pld-linux.org
Tue Oct 29 13:09:25 CET 2013
commit 2a8f34f5a8494f072743d58bc41842654b20ae7f
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Tue Oct 29 13:08:54 2013 +0100
- switch to macro driven module build for multiple kernel versions
- rel 8
r8168.spec | 96 +++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 61 insertions(+), 35 deletions(-)
---
diff --git a/r8168.spec b/r8168.spec
index 417981a..862ce14 100644
--- a/r8168.spec
+++ b/r8168.spec
@@ -2,13 +2,30 @@
%bcond_without dist_kernel # allow non-distribution kernel
%bcond_with verbose # verbose build (V=1)
-%define rel 7
+%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 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 8
%define pname r8168
Summary: Linux driver for RTL8111/8168B PCI Express Gigabit Ethernet controllers
Summary(pl.UTF-8): Linuksowy sterownik dla kart sieciowych RTL8111/8168B PCI Express Gigabit Ethernet
Name: %{pname}%{_alt_kernel}
Version: 8.036.00
-Release: %{rel}
+Release: %{rel}%{?_pld_builder:@%{_kernel_ver_str}}
License: GPL
Group: Base/Kernel
URL: http://www.realtek.com.tw/
@@ -18,10 +35,8 @@ URL: http://www.realtek.com.tw/
Source0: %{pname}-%{version}.tar.bz2
# Source0-md5: a9a5b238f59cc30eefa5917d7f6b728e
Patch0: linux-3.10.patch
-%if %{with dist_kernel}
-BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.33
-%endif
-BuildRequires: rpmbuild(macros) >= 1.379
+BuildRequires: rpmbuild(macros) >= 1.678
+%{?with_dist_kernel:%{expand:%kbrs}}
BuildRoot: %{tmpdir}/%{pname}-%{version}-root-%(id -u -n)
%description
@@ -32,46 +47,57 @@ Ethernet controllers.
Sterownik (moduł jądra Linuksa) dla kart sieciowych RTL8111/8168B PCI
Express Gigabit Ethernet.
-%package -n kernel%{_alt_kernel}-net-r8168
-Summary: Linux kernel module for RTL8111/8168B PCI Express Gigabit Ethernet controllers
-Summary(pl.UTF-8): Moduł jądra Linuksa dla kart sieciowych RTL8111/8168B PCI Express Gigabit Ethernet
-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
+%define kernel_pkg()\
+%package -n kernel%{_alt_kernel}-net-r8168\
+Summary: Linux kernel module for RTL8111/8168B PCI Express Gigabit Ethernet controllers\
+Summary(pl.UTF-8): Moduł jądra Linuksa dla kart sieciowych RTL8111/8168B PCI Express Gigabit Ethernet\
+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-r8168\
+Driver (Linux kernel module) for RTL8111/8168B PCI Express Gigabit\
+Ethernet controllers.\
+\
+%description -n kernel%{_alt_kernel}-net-r8168 -l pl.UTF-8\
+Sterownik (moduł jądra Linuksa) dla kart sieciowych RTL8111/8168B PCI\
+Express Gigabit Ethernet.\
+\
+%files -n kernel%{_alt_kernel}-net-r8168\
+%defattr(644,root,root,755)\
+%doc README\
+/lib/modules/%{_kernel_ver}/kernel/drivers/net/*.ko*\
+\
+%post -n kernel%{_alt_kernel}-net-r8168\
+%depmod %{_kernel_ver}\
+\
+%postun -n kernel%{_alt_kernel}-net-r8168\
+%depmod %{_kernel_ver}\
+%{nil}
-%description -n kernel%{_alt_kernel}-net-r8168
-Driver (Linux kernel module) for RTL8111/8168B PCI Express Gigabit
-Ethernet controllers.
+%define build_kernel_pkg()\
+%build_kernel_modules -m r8168 -C src KERNELRELEASE=%{_kernel_ver}\
+%install_kernel_modules -D installed -m src/r8168 -d kernel/drivers/net\
+%{nil}
-%description -n kernel%{_alt_kernel}-net-r8168 -l pl.UTF-8
-Sterownik (moduł jądra Linuksa) dla kart sieciowych RTL8111/8168B PCI
-Express Gigabit Ethernet.
+%{expand:%kpkg}
%prep
%setup -q -n %{pname}-%{version}
%patch0 -p1
%build
-%build_kernel_modules -m r8168 -C src KERNELRELEASE=%{_kernel_ver}
+%{expand:%bkpkg}
%install
rm -rf $RPM_BUILD_ROOT
-%install_kernel_modules -m src/r8168 -d kernel/drivers/net
+install -d $RPM_BUILD_ROOT
+
+cp -a installed/* $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
-
-%post -n kernel%{_alt_kernel}-net-r8168
-%depmod %{_kernel_ver}
-
-%postun -n kernel%{_alt_kernel}-net-r8168
-%depmod %{_kernel_ver}
-
-%files -n kernel%{_alt_kernel}-net-r8168
-%defattr(644,root,root,755)
-%doc README
-/lib/modules/%{_kernel_ver}/kernel/drivers/net/*.ko*
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/r8168.git/commitdiff/2a8f34f5a8494f072743d58bc41842654b20ae7f
More information about the pld-cvs-commit
mailing list