]> git.pld-linux.org Git - projects/template-specs.git/blob - kernel-module.spec
- sorted BRs
[projects/template-specs.git] / kernel-module.spec
1 #
2 # Conditional build:
3 %bcond_without  dist_kernel     # allow non-distribution kernel
4 %bcond_without  kernel          # don't build kernel modules
5 %bcond_without  smp             # don't build SMP module
6 %bcond_without  userspace       # don't build userspace module
7 %bcond_with     verbose         # verbose build (V=1)
8
9 #
10 # main package.
11 #
12 %if %{with kernel}
13 %{?with_dist_kernel:BuildRequires:      kernel-module-build >= 2.6.7}
14 BuildRequires:  rpmbuild(macros) >= 1.153
15 %endif
16
17 # kernel subpackages.
18
19 %package -n kernel-...
20 Summary:        Linux driver for ...
21 Summary(pl):    Sterownik dla Linuksa do ...
22 Release:        %{_rel}@%{_kernel_ver_str}
23 Group:          Base/Kernel
24 %{?with_dist_kernel:%requires_releq_kernel_up}
25 Requires(post,postun):  /sbin/depmod
26
27 %description -n kernel-smp-...
28 This is driver for ... for Linux.
29
30 This package contains Linux module.
31
32 %description -n kernel-smp-... -l pl
33 Sterownik dla Linuksa do ...
34
35 Ten pakiet zawiera modu³ j±dra Linuksa.
36
37 %package -n kernel-smp-...
38 Summary:        Linux SMP driver for ...
39 Summary(pl):    Sterownik dla Linuksa SMP do ...
40 Release:        %{_rel}@%{_kernel_ver_str}
41 Group:          Base/Kernel
42 %{?with_dist_kernel:%requires_releq_kernel_smp}
43 Requires(post,postun):  /sbin/depmod
44
45 %description -n kernel-smp-...
46 This is driver for ... for Linux.
47
48 This package contains Linux SMP module.
49
50 %description -n kernel-smp-... -l pl
51 Sterownik dla Linuksa do ...
52
53 Ten pakiet zawiera modu³ j±dra Linuksa SMP.
54
55 %build
56 %if %{with userspace}
57
58
59 %endif
60
61 %if %{with kernel}
62 # kernel module(s)
63 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
64     if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
65         exit 1
66     fi
67     rm -rf include
68     install -d include/{linux,config}
69     ln -sf %{_kernelsrcdir}/config-$cfg .config
70     ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
71     ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
72     touch include/config/MARKER
73 #
74 #       patching/creating makefile(s) (optional)
75 #
76     %{__make} -C %{_kernelsrcdir} clean \
77         RCS_FIND_IGNORE="-name '*.ko' -o" \
78         M=$PWD O=$PWD \
79         %{?with_verbose:V=1}
80     %{__make} -C %{_kernelsrcdir} modules \
81         CC="%{__cc}" CPP="%{__cpp}" \
82         M=$PWD O=$PWD \
83         %{?with_verbose:V=1}
84     mv $mod_name{,-$cfg}.ko
85 done
86 %endif
87
88 %install
89 rm -rf $RPM_BUILD_ROOT
90
91 %if %{with userspace}
92
93
94 %endif
95
96 %if %{with kernel}
97 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/$dir
98 install $mod_name-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
99         $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/$dir/$mod_name.ko
100 %if %{with smp} && %{with dist_kernel}
101 install $mod_name-smp.ko \
102         $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/$dir/$mod_name.ko
103 %endif
104 %endif
105
106 %clean
107 rm -rf $RPM_BUILD_ROOT
108
109 %post
110 %depmod %{_kernel_ver}
111
112 %postun
113 %depmod %{_kernel_ver}
114
115 %post -n kernel-smp-...
116 %depmod %{_kernel_ver}smp
117
118 %postun -n kernel-smp-...
119 %depmod %{_kernel_ver}smp
120
121 %if %{with kernel}
122 %files -n kernel-...
123 %defattr(644,root,root,755)
124 /lib/modules/%{_kernel_ver}/$dir/*.ko*
125
126 %if %{with smp} && %{with dist_kernel}
127 %files -n kernel-smp-...
128 %defattr(644,root,root,755)
129 /lib/modules/%{_kernel_ver}smp/$dir/*.ko*
130 %endif
131 %endif
132
133 %if %{with userspace}
134 %files ...
135 %defattr(644,root,root,755)
136
137 %endif
This page took 0.046938 seconds and 4 git commands to generate.