1%bcond_with debug 2%bcond_with debuginfo 3 4Name: @PACKAGE@-kmod 5Version: @VERSION@ 6Release: @RELEASE@%{?dist} 7 8Summary: Kernel module(s) 9Group: System Environment/Kernel 10License: @ZFS_META_LICENSE@ 11URL: https://github.com/openzfs/zfs 12BuildRequires: %kernel_module_package_buildreqs 13Source0: @PACKAGE@-%{version}.tar.gz 14BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 15 16# Additional dependency information for the kmod sub-package must be specified 17# by generating a preamble text file which kmodtool can append to the spec file. 18%(/bin/echo -e "\ 19Requires: @PACKAGE@ = %{version}\n\ 20Conflicts: @PACKAGE@-dkms\n\ 21Obsoletes: kmod-spl\n\ 22Obsoletes: spl-kmod\n\n" > %{_sourcedir}/kmod-preamble) 23 24# LDFLAGS are not sanitized by arch/*/Makefile for these architectures. 25%ifarch ppc ppc64 ppc64le aarch64 26%global __global_ldflags %{nil} 27%endif 28 29%description 30This package contains the ZFS kernel modules. 31 32%define kmod_name @PACKAGE@ 33 34%kernel_module_package -n %{kmod_name} -p %{_sourcedir}/kmod-preamble 35 36%define ksrc %{_usrsrc}/kernels/%{kverrel} 37%define kobj %{ksrc} 38 39%package -n kmod-%{kmod_name}-devel 40Summary: ZFS kernel module(s) devel common 41Group: System Environment/Kernel 42Provides: kmod-spl-devel = %{version} 43 44%description -n kmod-%{kmod_name}-devel 45This package provides the header files and objects to build kernel modules. 46 47%prep 48if ! [ -d "%{ksrc}" ]; then 49 echo "Kernel build directory isn't set properly, cannot continue" 50 exit 1 51fi 52 53%if %{with debug} 54%define debug --enable-debug 55%else 56%define debug --disable-debug 57%endif 58 59%if %{with debuginfo} 60%define debuginfo --enable-debuginfo 61%else 62%define debuginfo --disable-debuginfo 63%endif 64 65%setup -n %{kmod_name}-%{version} 66%build 67%configure \ 68 --with-config=kernel \ 69 --with-linux=%{ksrc} \ 70 --with-linux-obj=%{kobj} \ 71 %{debug} \ 72 %{debuginfo} 73make %{?_smp_mflags} 74 75%install 76make install \ 77 DESTDIR=${RPM_BUILD_ROOT} \ 78 INSTALL_MOD_DIR=extra/%{kmod_name} 79%{__rm} -f %{buildroot}/lib/modules/%{kverrel}/modules.* 80 81# find-debuginfo.sh only considers executables 82%{__chmod} u+x %{buildroot}/lib/modules/%{kverrel}/extra/*/*/* 83 84%clean 85rm -rf $RPM_BUILD_ROOT 86 87%files -n kmod-%{kmod_name}-devel 88%{_usrsrc}/%{kmod_name}-%{version} 89%{_usrsrc}/spl-%{version} 90