2 # Replace MODULE_NAME with real module name and MODULE_DIR
3 # with required directory name.
6 %bcond_without dist_kernel # allow non-distribution kernel
7 %bcond_without kernel # don't build kernel modules
8 %bcond_without smp # don't build SMP module
9 %bcond_without userspace # don't build userspace module
10 %bcond_with verbose # verbose build (V=1)
14 Summary: GPIB Linux Support
15 Summary(pl): Sterowniki GPIB dkla Linuksa
25 Source0: http://dl.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
29 #Patch0: %{name}-what.patch
30 URL: http://linux-gpib.sourceforge.net/
32 %{?with_dist_kernel:BuildRequires: kernel-module-build >= 2.6.7}
33 BuildRequires: rpmbuild(macros) >= 1.153
35 BuildRequires: kernel-headers >= 2.6.8
37 Requires(pre,post): kernel >= 2.6.8
40 Requires: kernel_up >=2.6.8
44 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
58 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
62 install -d include/{linux,config}
63 ln -sf %{_kernelsrcdir}/config-$cfg .config
64 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
65 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
66 touch include/config/MARKER
68 # patching/creating makefile(s) (optional)
70 %{__make} -C %{_kernelsrcdir} clean \
71 RCS_FIND_IGNORE="-name '*.ko' -o" \
74 %{__make} -C %{_kernelsrcdir} modules \
75 CC="%{__cc}" CPP="%{__cpp}" \
79 mv MODULE_NAME{,-$cfg}.ko
84 rm -rf $RPM_BUILD_ROOT
92 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/MODULE_DIR
93 install MODULE_NAME-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
94 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/MODULE_DIR/MODULE_NAME.ko
95 %if %{with smp} && %{with dist_kernel}
96 install MODULE_NAME-smp.ko \
97 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/MODULE_DIR/MODULE_NAME.ko
102 rm -rf $RPM_BUILD_ROOT
104 %post -n kernel-MODULE_DIR-%{name}
105 %depmod %{_kernel_ver}
107 %postun -n kernel-MODULE_DIR-%{name}
108 %depmod %{_kernel_ver}
110 %post -n kernel-smp-MODULE_DIR-%{name}
111 %depmod %{_kernel_ver}smp
113 %postun -n kernel-smp-MODULE_DIR-%{name}
114 %depmod %{_kernel_ver}smp
117 %files -n kernel-MODULE_DIR-%{name}
118 %defattr(644,root,root,755)
119 /lib/modules/%{_kernel_ver}/MODULE_DIR/*.ko*
121 %if %{with smp} && %{with dist_kernel}
122 %files -n kernel-smp-MODULE_DIR-%{name}
123 %defattr(644,root,root,755)
124 /lib/modules/%{_kernel_ver}smp/MODULE_DIR/*.ko*
128 %if %{with userspace}
130 %defattr(644,root,root,755)