[packages/vpb-driver] - switch to macro driven module build for multiple kernel versions - rel 8
baggins
baggins at pld-linux.org
Tue Oct 29 12:05:47 CET 2013
commit 40b8f1d36004ac506c19d8d7e9370c317f81cbc6
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Tue Oct 29 12:05:21 2013 +0100
- switch to macro driven module build for multiple kernel versions
- rel 8
vpb-driver.spec | 151 ++++++++++++++++++++++++++++++++++----------------------
1 file changed, 93 insertions(+), 58 deletions(-)
---
diff --git a/vpb-driver.spec b/vpb-driver.spec
index b3b30f6..de676dc 100644
--- a/vpb-driver.spec
+++ b/vpb-driver.spec
@@ -5,34 +5,60 @@
%bcond_without userspace # don't build userspace package
%bcond_without static_libs # don't build static libraries
%bcond_with pri # ISDN devices support (modified libpri)
-#
+
+%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
%undefine with_userspace
+%global _build_kernels %{alt_kernel}
+%else
+%global _build_kernels %{?build_kernels:,%{?build_kernels}}
%endif
-%if %{without kernel}
-%undefine with_dist_kernel
+
+%if %{without userspace}
+# nothing to be placed to debuginfo package
+%define _enable_debug_packages 0
%endif
-%define rel 7
+%define _duplicate_files_terminate_build 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 vpb-driver
Summary: Voicetronix voice processing board (VPB) driver software
Summary(pl.UTF-8): Oprogramowanie sterowników dla kart przetwarzających głos (VPB) Voicetronix
-Name: %{pname}%{_alt_kernel}
+Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
Version: 4.2.57
-Release: %{rel}
+Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
License: LGPL v2.1+ (libraries), GPL v2+ (libpri library, kernel module)
Group: Libraries
Source0: http://www.voicetronix.com.au/Downloads/vpb-driver-4.x/%{pname}-%{version}.tar.gz
# Source0-md5: 35d0ea8ab7a6bda267603ca7c9b78671
Patch0: %{pname}-make.patch
URL: http://www.voicetronix.com.au/downloads.htm#linux
-%if %{with dist_kernel}
-BuildRequires: kernel%{_alt_kernel}-module-build
-%endif
+BuildRequires: rpmbuild(macros) >= 1.678
+%{?with_dist_kernel:%{expand:%kbrs}}
BuildRequires: autoconf >= 2.59
BuildRequires: libstdc++-devel
BuildRequires: pciutils-devel
-BuildRequires: rpmbuild(macros) >= 1.379
BuildRequires: sed >= 4.0
BuildRequires: zlib-devel
Requires: vpb-libs = %{version}-%{rel}
@@ -83,23 +109,54 @@ Static VPD libraries.
%description -n vpb-static -l pl.UTF-8
Statyczne biblioteki VPD.
-%package -n kernel%{_alt_kernel}-telephony-vpb
-Summary: Linux kernel driver for Voicetronix Voice Processing Board (VPB)
-Summary(pl.UTF-8): Sterownik jądra Linuksa do kart VPB firmy Voicetronix
-Release: %{rel}@%{_kernel_ver_str}
-License: GPL v2+
-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}-telephony-vpb
-Linux kernel driver for Voicetronix Voice Processing Board (VPB).
-
-%description -n kernel%{_alt_kernel}-telephony-vpb -l pl.UTF-8
-Sterownik jądra Linuksa do kart VPB firmy Voicetronix.
+%define kernel_pkg()\
+%package -n kernel%{_alt_kernel}-telephony-vpb\
+Summary: Linux kernel driver for Voicetronix Voice Processing Board (VPB)\
+Summary(pl.UTF-8): Sterownik jądra Linuksa do kart VPB firmy Voicetronix\
+Release: %{rel}@%{_kernel_ver_str}\
+License: GPL v2+\
+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}-telephony-vpb\
+Linux kernel driver for Voicetronix Voice Processing Board (VPB).\
+\
+%description -n kernel%{_alt_kernel}-telephony-vpb -l pl.UTF-8\
+Sterownik jądra Linuksa do kart VPB firmy Voicetronix.\
+\
+%files -n kernel%{_alt_kernel}-telephony-vpb\
+%defattr(644,root,root,755)\
+%dir /lib/modules/%{_kernel_ver}/kernel/drivers/telephony\
+/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vpb.ko*\
+/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vtcore.ko*\
+/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vtopenpci.ko*\
+/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vtopenswitch.ko*\
+%config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/blunt-axe.conf\
+\
+%post -n kernel%{_alt_kernel}-telephony-vpb\
+%depmod %{_kernel_ver}\
+\
+%postun -n kernel%{_alt_kernel}-telephony-vpb\
+%depmod %{_kernel_ver}\
+%{nil}
+
+%define build_kernel_pkg()\
+%{__make} -C src/vtcore KSRC=%{_kernelsrcdir} \
+%{__make} -C src/vpb KSRC=%{_kernelsrcdir} \
+p=`pwd`\
+%{__make} -C src/vtcore install \\\
+ DESTDIR=$p/installed \\\
+ KSRC=%{_kernelsrcdir}\
+%{__make} -C src/vpb install \\\
+ DESTDIR=$p/installed \\\
+ KSRC=%{_kernelsrcdir}\
+%{nil}
+
+%{?with_kernel:%{expand:%kpkg}}
%prep
%setup -q -n %{pname}-%{version}
@@ -126,36 +183,31 @@ cd build-static
VPATH=%{_libdir}
cd ..
%endif
+
%configure \
%{?with_pri:--with-pri} \
--enable-shared
-%if %{without userspace}
-%{__make} -C src \
- %{?with_kernel:KSRC=%{_kernelsrcdir}} \
- VPATH=%{_libdir}
-%else
+%if %{with userspace}
%{__make} \
- %{?with_kernel:KSRC=%{_kernelsrcdir}} \
VPATH=%{_libdir}
%endif
+%{?with_kernel:%{expand:%bkpkg}}
+
%install
rm -rf $RPM_BUILD_ROOT
-%if %{without userspace}
-%{__make} -C src install \
- DESTDIR=$RPM_BUILD_ROOT \
- %{?with_kernel:KSRC=%{_kernelsrcdir}}
-
+%if %{with kernel}
install -d $RPM_BUILD_ROOT/etc/modprobe.d
install src/libvpb/blunt-axe.conf $RPM_BUILD_ROOT/etc/modprobe.d
-%else
+cp -a installed/* $RPM_BUILD_ROOT
+%endif
+%if %{with userspace}
%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT \
- %{?with_kernel:KSRC=%{_kernelsrcdir}}
+ DESTDIR=$RPM_BUILD_ROOT
# let rpm generate dependencies
chmod 755 $RPM_BUILD_ROOT%{_libdir}/lib*.so*
@@ -176,12 +228,6 @@ rm -rf $RPM_BUILD_ROOT
%post -n vpb-libs -p /sbin/ldconfig
%postun -n vpb-libs -p /sbin/ldconfig
-%post -n kernel%{_alt_kernel}-telephony-vpb
-%depmod %{_kernel_ver}
-
-%postun -n kernel%{_alt_kernel}-telephony-vpb
-%depmod %{_kernel_ver}
-
%if %{with userspace}
%files
%defattr(644,root,root,755)
@@ -215,14 +261,3 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libvpb.a
%endif
%endif
-
-%if %{with kernel}
-%files -n kernel%{_alt_kernel}-telephony-vpb
-%defattr(644,root,root,755)
-%dir /lib/modules/%{_kernel_ver}/kernel/drivers/telephony
-/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vpb.ko*
-/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vtcore.ko*
-/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vtopenpci.ko*
-/lib/modules/%{_kernel_ver}/kernel/drivers/telephony/vtopenswitch.ko*
-%config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/blunt-axe.conf
-%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/vpb-driver.git/commitdiff/40b8f1d36004ac506c19d8d7e9370c317f81cbc6
More information about the pld-cvs-commit
mailing list