xref: /freebsd/sys/contrib/openzfs/rpm/redhat/zfs-kmod.spec.in (revision d485c77f203fb0f4cdc08dea5ff81631b51d8809)
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\n" > %{_sourcedir}/kmod-preamble\n\
21Obsoletes:      spl-kmod)
22
23# LDFLAGS are not sanitized by arch/*/Makefile for these architectures.
24%ifarch ppc ppc64 ppc64le aarch64
25%global __global_ldflags %{nil}
26%endif
27
28%description
29This package contains the ZFS kernel modules.
30
31%define kmod_name @PACKAGE@
32
33%kernel_module_package -n %{kmod_name} -p %{_sourcedir}/kmod-preamble
34
35%define ksrc %{_usrsrc}/kernels/%{kverrel}
36%define kobj %{ksrc}
37
38%package -n kmod-%{kmod_name}-devel
39Summary:        ZFS kernel module(s) devel common
40Group:          System Environment/Kernel
41Provides:       kmod-spl-devel = %{version}
42
43%description -n  kmod-%{kmod_name}-devel
44This package provides the header files and objects to build kernel modules.
45
46%prep
47if ! [ -d "%{ksrc}"  ]; then
48        echo "Kernel build directory isn't set properly, cannot continue"
49        exit 1
50fi
51
52%if %{with debug}
53%define debug --enable-debug
54%else
55%define debug --disable-debug
56%endif
57
58%if %{with debuginfo}
59%define debuginfo --enable-debuginfo
60%else
61%define debuginfo --disable-debuginfo
62%endif
63
64%setup -n %{kmod_name}-%{version}
65%build
66%configure \
67        --with-config=kernel \
68        --with-linux=%{ksrc} \
69        --with-linux-obj=%{kobj} \
70        %{debug} \
71        %{debuginfo}
72make %{?_smp_mflags}
73
74%install
75make install \
76        DESTDIR=${RPM_BUILD_ROOT} \
77        INSTALL_MOD_DIR=extra/%{kmod_name}
78%{__rm} -f %{buildroot}/lib/modules/%{kverrel}/modules.*
79
80# find-debuginfo.sh only considers executables
81%{__chmod} u+x  %{buildroot}/lib/modules/%{kverrel}/extra/*/*/*
82
83%clean
84rm -rf $RPM_BUILD_ROOT
85
86%files -n kmod-%{kmod_name}-devel
87%{_usrsrc}/%{kmod_name}-%{version}
88%{_usrsrc}/spl-%{version}
89