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