%define major 1 %define libname %mklibname %{name} %{major} %define develname %mklibname %{name} -d %bcond_without dietlibc Summary: Kernel modules management tools Name: kmod Version: 4 Release: %mkrel 1 Source0: http://packages.profusion.mobi/kmod/%{name}-%{version}.tar.xz # dietlibc has no support for this fine timing: Patch0: 0001-Check-if-struct-stat-has-mtim-member.patch # fix headers: Patch1: kmod-3-WEXIT-needs-wait_h.diff # fix more headers: Patch4: kmod-3-fix-diet-size_t.diff License: GPLv2+ Group: System/Kernel and hardware #Url1: http://www.politreco.com/2011/12/announce-kmod-1/ Url: http://git.profusion.mobi/cgit.cgi/kmod.git/ BuildRequires: zlib-devel BuildRequires: lzma-devel %if %{with dietlibc} BuildRequires: dietlibc-devel %endif %description Simple tools for managing kernel modules. %package -n %{libname} Summary: Kernel modules management library Group: System/Libraries License: LGPLv2+ %description -n %{libname} Dynamic libraries for %{name}. The goal of the libkmod library is to offer to other programs the needed flexibility and fine grained control over insertion, removal, configuration and listing of kernel modules. Using the library, with simple pieces of code it's possible to interact with kernel modules and then there's no need to rely on other tools for that. This is a thing lacking on Linux for a while and it's one of the items in the Plumber's Wish List for Linux. Quoting it: provide a proper libmodprobe.so from module-init-tools: Early boot tools, installers, driver install disks want to access information about available modules to optimize boot up handling. %package -n %{develname} Summary: Development files for %{name} Group: Development/C Requires: %{libname} = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} License: LGPLv2+ %description -n %{develname} Development files and headers for %{name}. %prep %setup -q %apply_patches %build mkdir diet pushd diet %if %{with dietlibc} CC="diet gcc" ../configure --with-zlib --with-xz --enable-static --disable-shared --disable-tools 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" %endif popd %configure --with-zlib --with-xz %make %install rm -rf %{buildroot} %makeinstall_std rm -f %buildroot/%_libdir/libkmod.la %if %{with dietlibc} install -m644 ./diet/libkmod/.libs/libkmod.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/libkmod.a %endif %check make test %clean rm -rf %{buildroot} %files %_bindir/* %_mandir/*/* %files -n %{libname} %_libdir/libkmod.so.%major %_libdir/libkmod.so.%major.* %files -n %{develname} %_libdir/pkgconfig/libkmod.pc %_includedir/libkmod.h %_libdir/*.so %if %{with dietlibc} %{_prefix}/lib/dietlibc/lib-%{_arch}/libkmod.a %endif