# # Replace MODULE_NAME with real module name and MODULE_DIR # with required directory name. # # Conditional build: %bcond_without dist_kernel # allow non-distribution kernel %bcond_without kernel # don't build kernel modules %bcond_without smp # don't build SMP module %bcond_without userspace # don't build userspace module %bcond_with verbose # verbose build (V=1) %if %{without kernel} %undefine with_dist_kernel %endif # # main package. # Summary: - Summary(pl): - Name: - Version: - %define _rel 0.1 Release: %{_rel} Epoch: 0 #License: - (enter GPL/LGPL/BSD/BSD-like/other license name here) Group: - Vendor: - Icon: - Source0: %{name}-%{version}.tar.gz # Source0-md5: - #Source1: - # Source1-md5: - #Patch0: %{name}-what.patch #URL: - %if %{with kernel} %{?with_dist_kernel:BuildRequires: kernel-module-build >= 2.6.7} BuildRequires: rpmbuild(macros) >= 1.217 %endif #BuildRequires: - #PreReq: - #Requires(pre,post): - #Requires(preun): - #Requires(postun): - #Requires: - #Provides: - #Obsoletes: - #Conflicts: - BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description %description -l pl # kernel subpackages. %package -n kernel-MODULE_DIR-MODULE_NAME Summary: Linux driver for MODULE_NAME Summary(pl): Sterownik dla Linuksa do MODULE_NAME Release: %{_rel}@%{_kernel_ver_str} Group: Base/Kernel Requires(post,postun): /sbin/depmod %if %{with dist_kernel} %requires_releq_kernel_up Requires(postun): %releq_kernel_up %endif %description -n kernel-MODULE_DIR-MODULE_NAME This is driver for MODULE_NAME for Linux. This package contains Linux module. %description -n kernel-MODULE_DIR-MODULE_NAME -l pl Sterownik dla Linuksa do MODULE_NAME. Ten pakiet zawiera moduł jądra Linuksa. %package -n kernel-smp-MODULE_DIR-MODULE_NAME Summary: Linux SMP driver for MODULE_NAME Summary(pl): Sterownik dla Linuksa SMP do MODULE_NAME Release: %{_rel}@%{_kernel_ver_str} Group: Base/Kernel Requires(post,postun): /sbin/depmod %if %{with dist_kernel} %requires_releq_kernel_smp Requires(postun): %releq_kernel_smp %endif %description -n kernel-smp-MODULE_DIR-MODULE_NAME This is driver for MODULE_NAME for Linux. This package contains Linux SMP module. %description -n kernel-smp-MODULE_DIR-MODULE_NAME -l pl Sterownik dla Linuksa do MODULE_NAME. Ten pakiet zawiera moduł jądra Linuksa SMP. %prep %build %if %{with userspace} %endif %if %{with kernel} # kernel module(s) for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then exit 1 fi rm -rf include install -d include/{linux,config} ln -sf %{_kernelsrcdir}/config-$cfg .config ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm touch include/config/MARKER # # patching/creating makefile(s) (optional) # %{__make} -C %{_kernelsrcdir} clean \ RCS_FIND_IGNORE="-name '*.ko' -o" \ M=$PWD O=$PWD \ %{?with_verbose:V=1} %{__make} -C %{_kernelsrcdir} modules \ CC="%{__cc}" CPP="%{__cpp}" \ M=$PWD O=$PWD \ %{?with_verbose:V=1} mv MODULE_NAME{,-$cfg}.ko done %endif %install rm -rf $RPM_BUILD_ROOT %if %{with userspace} %endif %if %{with kernel} install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/MODULE_DIR install MODULE_NAME-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \ $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/MODULE_DIR/MODULE_NAME.ko %if %{with smp} && %{with dist_kernel} install MODULE_NAME-smp.ko \ $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/MODULE_DIR/MODULE_NAME.ko %endif %endif %clean rm -rf $RPM_BUILD_ROOT %post -n kernel-MODULE_DIR-MODULE_NAME %depmod %{_kernel_ver} %postun -n kernel-MODULE_DIR-MODULE_NAME %depmod %{_kernel_ver} %post -n kernel-smp-MODULE_DIR-MODULE_NAME %depmod %{_kernel_ver}smp %postun -n kernel-smp-MODULE_DIR-MODULE_NAME %depmod %{_kernel_ver}smp %if %{with kernel} %files -n kernel-MODULE_DIR-MODULE_NAME %defattr(644,root,root,755) /lib/modules/%{_kernel_ver}/MODULE_DIR/*.ko* %if %{with smp} && %{with dist_kernel} %files -n kernel-smp-MODULE_DIR-MODULE_NAME %defattr(644,root,root,755) /lib/modules/%{_kernel_ver}smp/MODULE_DIR/*.ko* %endif %endif %if %{with userspace} %files %defattr(644,root,root,755) %endif