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