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