]> git.pld-linux.org Git - projects/template-specs.git/blob - kernel-module.spec
- spaces->tabs
[projects/template-specs.git] / kernel-module.spec
1 #
2 # Replace MODULE_NAME with real module name and MODULE_DIR
3 # with required directory name.
4 #
5 # Conditional build:
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)
11 #
12 # main package.
13 #
14 Summary:        -
15 Summary(pl):    -
16 Name:           -
17 Version:        -
18 %define         _rel    0.x
19 Release:        %{_rel}
20 Epoch:          -
21 License:        - (enter GPL/LGPL/BSD/BSD-like/other license name here)
22 Group:          -
23 Vendor:         -
24 Icon:           -
25 Source0:        %{name}-%{version}.tar.gz
26 # Source0-md5:  -
27 Source1:        -
28 # Source1-md5:  -
29 Patch0:         %{name}-what.patch
30 URL:            -
31 %if %{with kernel}
32 %{?with_dist_kernel:BuildRequires:      kernel-module-build >= 2.6.7}
33 BuildRequires:  rpmbuild(macros) >= 1.153
34 %endif
35 BuildRequires:  -
36 PreReq:         -
37 Requires(pre,post):     -
38 Requires(preun):        -
39 Requires(postun):       -
40 Requires:       -
41 Provides:       -
42 Obsoletes:      -
43 Conflicts:      -
44 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
46 %description
47
48 %description -l pl
49
50 # kernel subpackages.
51
52 %package -n kernel-...
53 Summary:        Linux driver for ...
54 Summary(pl):    Sterownik dla Linuksa do ...
55 Release:        %{_rel}@%{_kernel_ver_str}
56 Group:          Base/Kernel
57 %{?with_dist_kernel:%requires_releq_kernel_up}
58 Requires(post,postun):  /sbin/depmod
59 %{?with_dist_kernel:Requires(postun):   kernel}
60
61 %description -n kernel-...
62 This is driver for ... for Linux.
63
64 This package contains Linux module.
65
66 %description -n kernel-... -l pl
67 Sterownik dla Linuksa do ...
68
69 Ten pakiet zawiera modu³ j±dra Linuksa.
70
71 %package -n kernel-smp-...
72 Summary:        Linux SMP driver for ...
73 Summary(pl):    Sterownik dla Linuksa SMP do ...
74 Release:        %{_rel}@%{_kernel_ver_str}
75 Group:          Base/Kernel
76 %{?with_dist_kernel:%requires_releq_kernel_smp}
77 Requires(post,postun):  /sbin/depmod
78 %{?with_dist_kernel:Requires(postun):   kernel-smp}
79
80 %description -n kernel-smp-...
81 This is driver for ... for Linux.
82
83 This package contains Linux SMP module.
84
85 %description -n kernel-smp-... -l pl
86 Sterownik dla Linuksa do ...
87
88 Ten pakiet zawiera modu³ j±dra Linuksa SMP.
89
90 %build
91 %if %{with userspace}
92
93
94 %endif
95
96 %if %{with kernel}
97 # kernel module(s)
98 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
99         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
100                 exit 1
101         fi
102         rm -rf include
103         install -d include/{linux,config}
104         ln -sf %{_kernelsrcdir}/config-$cfg .config
105         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
106         ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
107         touch include/config/MARKER
108 #
109 #       patching/creating makefile(s) (optional)
110 #
111         %{__make} -C %{_kernelsrcdir} clean \
112                 RCS_FIND_IGNORE="-name '*.ko' -o" \
113                 M=$PWD O=$PWD \
114                 %{?with_verbose:V=1}
115         %{__make} -C %{_kernelsrcdir} modules \
116                 CC="%{__cc}" CPP="%{__cpp}" \
117                 M=$PWD O=$PWD \
118                 %{?with_verbose:V=1}
119
120         mv MODULE_NAME{,-$cfg}.ko
121 done
122 %endif
123
124 %install
125 rm -rf $RPM_BUILD_ROOT
126
127 %if %{with userspace}
128
129
130 %endif
131
132 %if %{with kernel}
133 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/MODULE_DIR
134 install MODULE_NAME-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
135         $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/MODULE_DIR/MODULE_NAME.ko
136 %if %{with smp} && %{with dist_kernel}
137 install MODULE_NAME-smp.ko \
138         $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/MODULE_DIR/MODULE_NAME.ko
139 %endif
140 %endif
141
142 %clean
143 rm -rf $RPM_BUILD_ROOT
144
145 %post   -n kernel-...
146 %depmod %{_kernel_ver}
147
148 %postun -n kernel-...
149 %depmod %{_kernel_ver}
150
151 %post   -n kernel-smp-...
152 %depmod %{_kernel_ver}smp
153
154 %postun -n kernel-smp-...
155 %depmod %{_kernel_ver}smp
156
157 %if %{with kernel}
158 %files -n kernel-...
159 %defattr(644,root,root,755)
160 /lib/modules/%{_kernel_ver}/MODULE_DIR/*.ko*
161
162 %if %{with smp} && %{with dist_kernel}
163 %files -n kernel-smp-...
164 %defattr(644,root,root,755)
165 /lib/modules/%{_kernel_ver}smp/MODULE_DIR/*.ko*
166 %endif
167 %endif
168
169 %if %{with userspace}
170 %files ...
171 %defattr(644,root,root,755)
172
173 %endif
This page took 0.041539 seconds and 4 git commands to generate.