diff options
Diffstat (limited to 'spl-modules.spec.in')
-rw-r--r-- | spl-modules.spec.in | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/spl-modules.spec.in b/spl-modules.spec.in index c27d0a5f9..044225098 100644 --- a/spl-modules.spec.in +++ b/spl-modules.spec.in @@ -44,6 +44,17 @@ %endif %endif +# Set using 'rpmbuild ... --with kernel-dkms ...', defaults to disabled. +%if %{defined _with_kernel_dkms} + %define with_kernel_dkms 1 +%else + %if %{defined _without_kernel_dkms} + %define with_kernel_dkms 0 + %else + %define with_kernel_dkms 0 + %endif +%endif + # Set using 'rpmbuild ... --with debug ...', defaults to disabled. %if %{defined _with_debug} %define kdebug --enable-debug @@ -118,12 +129,15 @@ %define kpkg_kern kernel-%{kverextra} %define kpkg_dbug %{nil} + %define kpkg_dkms dkms %define kdevpkg_kern kernel-source %define kdevpkg_dbug %{nil} + %define kdevpkg_dkms dkms %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/-%{kverextra}//g') %define kverpkg_dbug %{nil} + %define kverpkg_dkms 2.2.0.2 # The kernel and rpm versions do not strictly match under SLES11 # e.g. kernel version 2.6.27.19-5 != rpm version 2.6.27.19-5.1 @@ -165,10 +179,13 @@ %define kpkg_kern kernel %define kpkg_dbug kernel-debug + %define kpkg_dkms dkms %define kdevpkg_kern kernel-devel %define kdevpkg_dbug kernel-debug-devel + %define kdevpkg_dkms dkms + %define kverpkg_dkms 2.2.0.2 %if %{defined el6} || %{defined ch5} %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g') %define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g') @@ -216,10 +233,13 @@ %define kpkg_kern kernel %define kpkg_dbug kernel-debug + %define kpkg_dkms dkms %define kdevpkg_kern kernel-devel %define kdevpkg_dbug kernel-debug-devel + %define kdevpkg_dkms dkms + %define kverpkg_dkms 2.2.0.2 %define kverpkg_kern %(echo %{kver_kern} | %{__sed} -e 's/.%{_target_cpu}//g') %define kverpkg_dbug %(echo %{kver_dbug} | %{__sed} -e 's/.%{_target_cpu}//g' | %{__sed} -e 's/.debug//g') @@ -253,6 +273,7 @@ %define kverpkg_kern %{kver_kern} %define kverpkg_dbug %{nil} + %define kverpkg_dkms %{nil} %if %{undefined kdir} %define kdir_kern /lib/modules/%{kver_kern}/build @@ -285,12 +306,16 @@ %if %{defined build_src_rpm} %define rel_kern @SPL_META_RELEASE@ %define rel_dbug @SPL_META_RELEASE@ +%define rel_dkms @SPL_META_RELEASE@ %if %{defined kpkg_kern} %define req_kern %{kpkg_kern} %endif %if %{defined kpkg_dbug} %define req_dbug %{kpkg_dbug} %endif +%if %{defined kpkg_dkms} +%define req_dkms %{kpkg_dkms} +%endif %if %{defined kdevpkg_kern} %define devreq_kern %{kdevpkg_kern} %endif @@ -302,12 +327,16 @@ %define relext_dbug %(echo %{kverpkg_dbug} | %{__sed} -e 's/-/_/g') %define rel_kern @SPL_META_RELEASE@_%{relext_kern} %define rel_dbug @SPL_META_RELEASE@_%{relext_dbug} +%define rel_dkms @SPL_META_RELEASE@ %if %{defined kpkg_kern} %define req_kern %{kpkg_kern} %{koppkg} %{kverpkg_kern} %endif %if %{defined kpkg_dbug} %define req_dbug %{kpkg_dbug} %{koppkg} %{kverpkg_dbug} %endif +%if %{defined kpkg_dkms} +%define req_dkms %{kpkg_dkms} >= %{kverpkg_dkms} +%endif %if %{defined kdevpkg_kern} %define devreq_kern %{kdevpkg_kern} %{koppkg} %{kverpkg_kern} %endif @@ -398,6 +427,30 @@ Module{s}.symvers symbols needed for building additional modules which use %{name}-debug. %endif +%if %{?with_kernel_dkms} + +%package dkms +Summary: Solaris Porting Layer Modules (DKMS) +Group: Utilities/System +Release: %{rel_dkms} +Provides: %{name} +BuildArch: noarch +%if %{defined req_dkms} +Requires: %{req_dkms} +%endif +%if %{defined kdevpkg_dkms} +BuildRequires: %{kdevpkg_dkms} +%endif + +%description dkms +The %{name}-dkms package contains all the necessary pieces to build and +install Solaris Porting Layer (SPL) kernel modules with Dynamic Kernel +Modules Support (DKMS). The SPL modules emulate Solaris style primatives +in the the linux kernel. They include, but are not limited to: atomic, +condvar, debug, error, memory, kobject, kstat, mutex, rwlock, taskq, +thread, time, and vnode APIs. + +%endif %prep %setup -n @PACKAGE@-%{version} @@ -422,6 +475,16 @@ make make DESTDIR=$RPM_BUILD_ROOT install %endif +%if %{?with_kernel_dkms} + +%configure --with-config=kernel \ + %{kdebug} %{kdebug_log} %{kdebug_kmem} %{kdebug_kmem_tracking} +make dist +mkdir -p $RPM_BUILD_ROOT/%{_prefix}/src +tar -xf @PACKAGE@-%{version}.tar.gz -C $RPM_BUILD_ROOT/%{_prefix}/src +cp -af dkms.conf $RPM_BUILD_ROOT/%{_prefix}/src/@PACKAGE@-%{version} + +%endif %clean rm -rf $RPM_BUILD_ROOT @@ -476,3 +539,30 @@ else fi %endif +%if %{?with_kernel_dkms} + +%files dkms +%defattr(-,root,root) +%{_prefix}/src/@PACKAGE@-%{version}/* + +%post dkms +for POSTINST in %{_prefix}/lib/dkms/common.postinst; do + if [ -f $POSTINST ]; then + $POSTINST @PACKAGE@ %{version} + exit $? + fi + echo "WARNING: $POSTINST does not exist." +done +echo -e "ERROR: DKMS version is too old and @PACKAGE@ was not" +echo -e "built with legacy DKMS support." +echo -e "You must either rebuild @PACKAGE@ with legacy postinst" +echo -e "support or upgrade DKMS to a more current version." +exit 1 + +%preun dkms +echo -e +echo -e "Uninstall of @PACKAGE@ module (version %{version}) beginning:" +dkms remove -m @PACKAGE@ -v %{version} --all --rpm_safe_upgrade +exit 0 + +%endif |