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