xref: /freebsd/sys/contrib/openzfs/rpm/generic/zfs-dkms.spec.in (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1%{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
2
3%if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
4%define not_rpm 1
5%endif
6
7# Exclude input files from mangling
8%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
9
10%define module  @PACKAGE@
11%define mkconf  scripts/dkms.mkconf
12
13Name:           %{module}-dkms
14
15Version:        @VERSION@
16Release:        @RELEASE@%{?dist}
17Summary:        Kernel module(s) (dkms)
18
19Group:          System Environment/Kernel
20License:        @ZFS_META_LICENSE@
21URL:            https://github.com/openzfs/zfs
22Source0:        %{module}-%{version}.tar.gz
23BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
24BuildArch:      noarch
25
26Requires:       dkms >= 2.2.0.3
27Requires(post): dkms >= 2.2.0.3
28Requires(preun): dkms >= 2.2.0.3
29Requires:       gcc, make, perl, diffutils
30Requires(post): gcc, make, perl, diffutils
31%if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
32Requires:       kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
33Requires(post): kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
34Obsoletes:      spl-dkms
35%endif
36Provides:       %{module}-kmod = %{version}
37AutoReqProv:    no
38
39%if (0%{?fedora}%{?suse_version}) || (0%{?rhel} && 0%{?rhel} < 9)
40# We don't directly use it, but if this isn't installed, rpmbuild as root can
41# crash+corrupt rpmdb
42# See issue #12071
43BuildRequires:  ncompress
44%endif
45
46%description
47This package contains the dkms ZFS kernel modules.
48
49%prep
50%setup -q -n %{module}-%{version}
51
52%build
53%{mkconf} -n %{module} -v %{version} -f dkms.conf
54
55%install
56if [ "$RPM_BUILD_ROOT" != "/" ]; then
57    rm -rf $RPM_BUILD_ROOT
58fi
59mkdir -p $RPM_BUILD_ROOT/usr/src/
60cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
61
62%clean
63if [ "$RPM_BUILD_ROOT" != "/" ]; then
64    rm -rf $RPM_BUILD_ROOT
65fi
66
67%files
68%defattr(-,root,root)
69/usr/src/%{module}-%{version}
70
71%preun
72dkms remove -m %{module} -v %{version} --all
73
74%posttrans
75/usr/lib/dkms/common.postinst %{module} %{version}
76
77