]> git.pld-linux.org Git - projects/template-specs.git/blame - kernel-module.spec
- tabs in preamble
[projects/template-specs.git] / kernel-module.spec
CommitLineData
f9ab3660 1#
5ff61201
AM
2# Replace MODULE_NAME with real module name and MODULE_DIR
3# with required directory name.
4#
f9ab3660
PS
5# Conditional build:
6%bcond_without dist_kernel # allow non-distribution kernel
7%bcond_without kernel # don't build kernel modules
00275440 8%bcond_without up # don't build UP module
f9ab3660 9%bcond_without smp # don't build SMP module
7f898902 10%bcond_without userspace # don't build userspace programs
f9ab3660 11%bcond_with verbose # verbose build (V=1)
4e1a22e1 12
46b67889 13%if %{without kernel}
4e1a22e1
PS
14%undefine with_dist_kernel
15%endif
16
f9ab3660
PS
17#
18# main package.
19#
1c63cb2c 20%define _rel 0.1
62d8299f 21Summary: -
ce39d734 22Summary(pl.UTF-8): -
62d8299f
PS
23Name: -
24Version: -
6e5f56d1 25Release: %{_rel}
96f971dd
ER
26Epoch: 0
27#License: - (enter GPL/LGPL/BSD/BSD-like/other license name here)
62d8299f 28Group: -
62d8299f
PS
29Source0: %{name}-%{version}.tar.gz
30# Source0-md5: -
96f971dd 31#Source1: -
62d8299f 32# Source1-md5: -
1c63cb2c 33#Patch0: %{name}-what.patch
96f971dd 34#URL: -
063b9033 35%if %{with kernel}
f84b0ee8 36%{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.14}
6af6106a 37BuildRequires: rpmbuild(macros) >= 1.330
063b9033 38%endif
96f971dd 39#BuildRequires: -
ecd953f6 40#Requires(postun): -
96f971dd
ER
41#Requires(pre,post): -
42#Requires(preun): -
96f971dd
ER
43#Requires: -
44#Provides: -
45#Obsoletes: -
46#Conflicts: -
62d8299f
PS
47BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48
49%description
50
9be49f18 51%description -l pl.UTF-8
f9ab3660
PS
52
53# kernel subpackages.
54
f84b0ee8 55%package -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME
96f971dd 56Summary: Linux driver for MODULE_NAME
ce39d734 57Summary(pl.UTF-8): Sterownik dla Linuksa do MODULE_NAME
f9ab3660
PS
58Release: %{_rel}@%{_kernel_ver_str}
59Group: Base/Kernel
f9ab3660 60Requires(post,postun): /sbin/depmod
8fad52ee 61%if %{with dist_kernel}
1c63cb2c
ER
62%requires_releq_kernel_up
63Requires(postun): %releq_kernel_up
8fad52ee 64%endif
f9ab3660 65
f84b0ee8 66%description -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME
96f971dd 67This is driver for MODULE_NAME for Linux.
f9ab3660
PS
68
69This package contains Linux module.
70
9be49f18 71%description -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME -l pl.UTF-8
96f971dd 72Sterownik dla Linuksa do MODULE_NAME.
f9ab3660 73
9be49f18 74Ten pakiet zawiera moduł jądra Linuksa.
f9ab3660 75
f84b0ee8 76%package -n kernel%{_alt_kernel}-smp-MODULE_DIR-MODULE_NAME
96f971dd 77Summary: Linux SMP driver for MODULE_NAME
ce39d734 78Summary(pl.UTF-8): Sterownik dla Linuksa SMP do MODULE_NAME
f9ab3660
PS
79Release: %{_rel}@%{_kernel_ver_str}
80Group: Base/Kernel
f9ab3660 81Requires(post,postun): /sbin/depmod
8fad52ee 82%if %{with dist_kernel}
1c63cb2c
ER
83%requires_releq_kernel_smp
84Requires(postun): %releq_kernel_smp
8fad52ee 85%endif
f9ab3660 86
f84b0ee8 87%description -n kernel%{_alt_kernel}-smp-MODULE_DIR-MODULE_NAME
96f971dd 88This is driver for MODULE_NAME for Linux.
f9ab3660
PS
89
90This package contains Linux SMP module.
91
9be49f18 92%description -n kernel%{_alt_kernel}-smp-MODULE_DIR-MODULE_NAME -l pl.UTF-8
96f971dd 93Sterownik dla Linuksa do MODULE_NAME.
f9ab3660 94
9be49f18 95Ten pakiet zawiera moduł jądra Linuksa SMP.
f9ab3660 96
61855f4e 97%prep
1e940dea 98# prepare makefile:
99cat > path/to/dir/Makefile << EOF
100
101obj-m += MODULE_NAME.o MODULE2.o
102
103MODULE_NAME-objs := file1.o file2.o \
104 file3.o file4.o file5.o
105
106MODULE2-objs := file6.o file7.o file8.o
107
108CFLAGS += -DCONFIG_MODULE_NAME_SOME_OPTION=1
109%{?debug:CFLAGS += -DCONFIG_MODULE_NAME_DEBUG=1}
110EOF
61855f4e 111
f9ab3660
PS
112%build
113%if %{with userspace}
114
115
116%endif
117
118%if %{with kernel}
da3ac6c9 119%build_kernel_modules -m MODULE_NAME
120
121# modules placed in subdirectory:
122%build_kernel_modules -C path/to/dir -m MODULE_NAME,MODULE2
123
124# need to pass additional options to make modules:
125%build_kernel_modules VAR1=value1 VAR2=value2 -m MODULE_NAME
126
127# optional patching:
128%build_kernel_modules -m MODULE_NAME <<'EOF'
129# Your script here:
130if grep -q "CONFIG_SOME_OPTION" o/.config; then
131 sed 's/some/change/' file.c.orig > file.c
132else
1e940dea 133 cat file.c.orig > file.c
da3ac6c9 134fi
135# Don't do it this way unless it depends on kernel options or something
136# you can't check before
137EOF
138
f9ab3660
PS
139%endif
140
141%install
142rm -rf $RPM_BUILD_ROOT
143
144%if %{with userspace}
145
146
147%endif
148
149%if %{with kernel}
da3ac6c9 150%install_kernel_modules -m MODULE_NAME -d MODULE_DIR
151
152# to avoid conflict with in-kernel modules, and prepare modprobe config:
153%install_kernel_modules -s current -n NAME -m MODULE_NAME -d MODULE_DIR
f9ab3660
PS
154%endif
155
156%clean
157rm -rf $RPM_BUILD_ROOT
158
f84b0ee8 159%post -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME
f9ab3660
PS
160%depmod %{_kernel_ver}
161
f84b0ee8 162%postun -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME
f9ab3660
PS
163%depmod %{_kernel_ver}
164
f84b0ee8 165%post -n kernel%{_alt_kernel}-smp-MODULE_DIR-MODULE_NAME
9624fc9c 166%depmod %{_kernel_ver}smp
f9ab3660 167
f84b0ee8 168%postun -n kernel%{_alt_kernel}-smp-MODULE_DIR-MODULE_NAME
9624fc9c 169%depmod %{_kernel_ver}smp
f9ab3660
PS
170
171%if %{with kernel}
00275440 172%if %{with up} || %{without dist_kernel}
f84b0ee8 173%files -n kernel%{_alt_kernel}-MODULE_DIR-MODULE_NAME
f9ab3660 174%defattr(644,root,root,755)
5ff61201 175/lib/modules/%{_kernel_ver}/MODULE_DIR/*.ko*
00275440 176%endif
f9ab3660
PS
177
178%if %{with smp} && %{with dist_kernel}
f84b0ee8 179%files -n kernel%{_alt_kernel}-smp-MODULE_DIR-MODULE_NAME
f9ab3660 180%defattr(644,root,root,755)
5ff61201 181/lib/modules/%{_kernel_ver}smp/MODULE_DIR/*.ko*
f9ab3660
PS
182%endif
183%endif
184
185%if %{with userspace}
e85ad390 186%files
f9ab3660
PS
187%defattr(644,root,root,755)
188
189%endif
This page took 0.067713 seconds and 4 git commands to generate.