1 |
%define major 2 |
2 |
%define majorminor 2.1.2 |
3 |
%define libname %mklibname %{name} %{major} |
4 |
%define develname %mklibname %{name} -d |
5 |
|
6 |
# (cg) Should be same version and rel + 1 as module-init-tools. |
7 |
%define tools_ver 3.16 |
8 |
%define tools_rel 17 |
9 |
|
10 |
%bcond_without dietlibc |
11 |
%bcond_without tools |
12 |
|
13 |
Summary: Kernel modules management tools |
14 |
Name: kmod |
15 |
Version: 8 |
16 |
Release: %mkrel 2 |
17 |
Source0: http://packages.profusion.mobi/kmod/%{name}-%{version}.tar.xz |
18 |
%if %{with tools} |
19 |
Source1: modprobe.default |
20 |
Source2: modprobe.preload |
21 |
Source3: blacklist-mga.conf |
22 |
Source4: ipw-no-associate.conf |
23 |
# From Fedora module-init-tools package |
24 |
Source5: blacklist-compat.conf |
25 |
%endif |
26 |
Patch1: kmod-3-fix-diet-size_t.diff |
27 |
|
28 |
License: GPLv2+ |
29 |
Group: System/Kernel and hardware |
30 |
#Url1: http://www.politreco.com/2011/12/announce-kmod-1/ |
31 |
Url: http://git.profusion.mobi/cgit.cgi/kmod.git/ |
32 |
BuildRequires: zlib-devel |
33 |
BuildRequires: lzma-devel |
34 |
%if %{with dietlibc} |
35 |
BuildRequires: dietlibc-devel |
36 |
%endif |
37 |
Requires(pre): filesystem >= 2.1.9-18 |
38 |
%if %{with tools} |
39 |
Provides: module-init-tools = %{tools_ver}-%{tools_rel} |
40 |
Obsoletes: module-init-tools < %{tools_ver}-%{tools_rel} |
41 |
%endif |
42 |
|
43 |
%description |
44 |
Simple tools for managing kernel modules. |
45 |
|
46 |
%package -n %{libname} |
47 |
Summary: Kernel modules management library |
48 |
Group: System/Libraries |
49 |
License: LGPLv2+ |
50 |
Requires(pre): filesystem >= 2.1.9-18 |
51 |
|
52 |
%description -n %{libname} |
53 |
Dynamic libraries for %{name}. |
54 |
|
55 |
The goal of the libkmod library is to offer to other programs the |
56 |
needed flexibility and fine grained control over insertion, removal, |
57 |
configuration and listing of kernel modules. Using the library, with |
58 |
simple pieces of code it's possible to interact with kernel modules |
59 |
and then there's no need to rely on other tools for that. This is a |
60 |
thing lacking on Linux for a while and it's one of the items in the |
61 |
Plumber's Wish List for Linux. Quoting it: |
62 |
|
63 |
provide a proper libmodprobe.so from module-init-tools: |
64 |
Early boot tools, installers, driver install disks want to access |
65 |
information about available modules to optimize boot up handling. |
66 |
|
67 |
%package -n %{develname} |
68 |
Summary: Development files for %{name} |
69 |
Group: Development/C |
70 |
Requires(pre): filesystem >= 2.1.9-18 |
71 |
Requires: %{libname} = %{version}-%{release} |
72 |
Provides: %{name}-devel = %{version}-%{release} |
73 |
License: LGPLv2+ |
74 |
|
75 |
%description -n %{develname} |
76 |
Development files and headers for %{name}. |
77 |
|
78 |
|
79 |
|
80 |
%prep |
81 |
%setup -q |
82 |
%apply_patches |
83 |
|
84 |
%build |
85 |
%if %{with dietlibc} |
86 |
mkdir diet |
87 |
pushd diet |
88 |
CC="diet gcc" ../configure --with-zlib --with-xz --enable-static --disable-shared --disable-tools |
89 |
make V=1 LD="diet ld" CC="diet cc" CFLAGS="-Os -D_BSD_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_ATFILE_SOURCE -DO_CLOEXEC=0 -g -DUINT16_MAX=65535 -DINT32_MAX=2147483647" |
90 |
popd |
91 |
%endif |
92 |
|
93 |
%configure --with-zlib --with-xz |
94 |
%make |
95 |
|
96 |
%install |
97 |
rm -rf %{buildroot} |
98 |
%makeinstall_std |
99 |
rm -f %{buildroot}/%_libdir/libkmod.la |
100 |
|
101 |
%if %{with tools} |
102 |
mkdir -p %{buildroot}%{_sbindir} |
103 |
for tool in modprobe modinfo insmod rmmod depmod lsmod; do |
104 |
ln -sf ../bin/kmod %{buildroot}%{_sbindir}/$tool |
105 |
done |
106 |
|
107 |
install -d -m755 %{buildroot}%{_sysconfdir} |
108 |
install -d -m755 %{buildroot}%{_sysconfdir}/depmod.d |
109 |
install -d -m755 %{buildroot}%{_sysconfdir}/modprobe.d/ |
110 |
touch %{buildroot}%{_sysconfdir}/modprobe.conf |
111 |
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/modprobe.d/00_modprobe.conf |
112 |
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir} |
113 |
install -m 644 %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}/modprobe.d |
114 |
|
115 |
# (tmb) FIXME for mga3: mga tools still use /etc/modprobe.conf |
116 |
ln -s ../modprobe.conf %{buildroot}%{_sysconfdir}/modprobe.d/01_mga-config.conf |
117 |
|
118 |
%else |
119 |
rm -rf %{buildroot}%{_mandir} |
120 |
%endif |
121 |
|
122 |
%if %{with dietlibc} |
123 |
install -m644 ./diet/libkmod/.libs/libkmod.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/libkmod.a |
124 |
%endif |
125 |
|
126 |
%check |
127 |
#make test |
128 |
|
129 |
%clean |
130 |
rm -rf %{buildroot} |
131 |
|
132 |
%files |
133 |
%doc NEWS |
134 |
%_bindir/%{name} |
135 |
%if %{with tools} |
136 |
%dir /etc/depmod.d/ |
137 |
%config(noreplace) %{_sysconfdir}/modprobe.preload |
138 |
%config(noreplace) %{_sysconfdir}/modprobe.conf |
139 |
%dir %{_sysconfdir}/modprobe.d/ |
140 |
%config(noreplace) %{_sysconfdir}/modprobe.d/*.conf |
141 |
%_sbindir/* |
142 |
%_mandir/*/* |
143 |
%endif |
144 |
|
145 |
%files -n %{libname} |
146 |
%_libdir/libkmod.so.%major |
147 |
%_libdir/libkmod.so.%majorminor |
148 |
|
149 |
%files -n %{develname} |
150 |
%_libdir/pkgconfig/libkmod.pc |
151 |
%_includedir/libkmod.h |
152 |
%_libdir/*.so |
153 |
%if %{with dietlibc} |
154 |
%{_prefix}/lib/dietlibc/lib-%{_arch}/libkmod.a |
155 |
%endif |