3 %bcond_without dist_kernel # allow non-distribution kernel
4 %bcond_without smp # don't build SMP module
5 %bcond_with verbose # verbose build (V=1)
9 Summary: Linux drivers for ThinkPad laptops
10 Summary(pl.UTF-8): Sterowniki dla Linuksa do laptopów ThinkPad
11 Name: kernel%{_alt_kernel}-misc-thinkpad
13 Release: %{_rel}@%{_kernel_ver_str}
16 Source0: http://dl.sourceforge.net/tpctl/%{_name}_%{version}.tar.gz
17 # Source0-md5: d6549f4fe51f594a20d1498f06def010
18 URL: http://tpctl.sourceforge.net/
19 BuildRequires: rpmbuild(macros) >= 1.308
20 %if %{with dist_kernel}
21 BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.14}
22 %requires_releq_kernel_up
23 Requires(postun): %releq_kernel_up
25 Requires(post,postun): /sbin/depmod
26 ExclusiveArch: %{ix86}
27 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30 These are drivers for ThinkPad laptops for Linux.
32 This package contains Linux modules.
34 %description -l pl.UTF-8
35 Sterowniki dla Linuksa do laptopów ThinkPad.
37 Ten pakiet zawiera moduły jądra Linuksa.
39 %package -n kernel%{_alt_kernel}-smp-misc-thinkpad
40 Summary: Linux SMP drivers for ThinkPad laptops
41 Summary(pl.UTF-8): Sterowniki dla Linuksa SMP do laptotów ThinkPad
43 Requires(post,postun): /sbin/depmod
44 %if %{with dist_kernel}
45 %requires_releq_kernel_smp
46 Requires(postun): %releq_kernel_smp
48 Requires(post,postun): /sbin/depmod
50 %description -n kernel%{_alt_kernel}-smp-misc-thinkpad
51 These are drivers for ThinkPad laptops for Linux.
53 This package contains Linux SMP modules.
55 %description -n kernel%{_alt_kernel}-smp-misc-thinkpad -l pl.UTF-8
56 Sterowniki dla Linuksa do laptopów ThinkPad.
58 Ten pakiet zawiera moduły jądra Linuksa SMP.
61 %setup -q -n %{_name}-%{version}
67 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
68 if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
71 install -d o/include/linux
72 ln -sf %{_kernelsrcdir}/config-$cfg o/.config
73 ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers
74 ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h
75 ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} o/include/asm
76 %if %{with dist_kernel}
77 %{__make} -j1 -C %{_kernelsrcdir} O=$PWD/o prepare scripts
79 install -d o/include/config
80 touch o/include/config/MARKER
81 ln -sf %{_kernelsrcdir}/scripts o/scripts
84 # patching/creating makefile(s) (optional)
86 %{__make} -C %{_kernelsrcdir} clean \
87 RCS_FIND_IGNORE="-name '*.ko' -o -name '*.s' -o" \
88 SYSSRC=%{_kernelsrcdir} \
92 %{__make} -C %{_kernelsrcdir} modules \
93 EXTRA_CFLAGS="-I$PWD/../include -DLINUX" \
94 CC="%{__cc}" CPP="%{__cpp}" \
95 SYSSRC=%{_kernelsrcdir} \
100 mv thinkpad{,-$cfg}.ko
102 mv superio{,-$cfg}.ko
103 mv rtcmosram{,-$cfg}.ko
108 rm -rf $RPM_BUILD_ROOT
109 install -d $RPM_BUILD_ROOT%{_mandir}/man4
110 install man/thinkpad.4 $RPM_BUILD_ROOT%{_mandir}/man4
112 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc/thinkpad
113 install 2.6/drivers/thinkpad-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
114 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/thinkpad/thinkpad.ko
115 install 2.6/drivers/smapi-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
116 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/thinkpad/smapi.ko
117 install 2.6/drivers/superio-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
118 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/thinkpad/superio.ko
119 install 2.6/drivers/rtcmosram-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \
120 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/thinkpad/rtcmosram.ko
121 %if %{with smp} && %{with dist_kernel}
122 install 2.6/driver/thinkpad-smp.ko \
123 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/thinkpad/thinkpad.ko
124 install 2.6/driver/smapi-smp.ko \
125 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/thinkpad/smapi.ko
126 install 2.6/driver/superio-smp.ko \
127 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/thinkpad/superio.ko
128 install 2.6/driver/rtcmosram-smp.ko \
129 $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/thinkpad/rtcmosram.ko
133 rm -rf $RPM_BUILD_ROOT
136 %depmod %{_kernel_ver}
139 %depmod %{_kernel_ver}
141 %post -n kernel%{_alt_kernel}-smp-misc-thinkpad
142 %depmod %{_kernel_ver}smp
144 %postun -n kernel%{_alt_kernel}-smp-misc-thinkpad
145 %depmod %{_kernel_ver}smp
148 %defattr(644,root,root,755)
149 %doc AUTHORS ChangeLog README SUPPORTED-MODELS TECHNOTES
150 /lib/modules/%{_kernel_ver}/misc/thinkpad
151 %{_mandir}/man4/thinkpad.4*
153 %if %{with smp} && %{with dist_kernel}
154 %files -n kernel%{_alt_kernel}-smp-misc-thinkpad
155 %defattr(644,root,root,755)
156 %doc AUTHORS ChangeLog README SUPPORTED-MODELS TECHNOTES
157 /lib/modules/%{_kernel_ver}smp/misc/thinkpad
158 # i know it would get double packed when up & smp installed, but rpm handles this
159 %{_mandir}/man4/thinkpad.4*