aboutsummaryrefslogtreecommitdiffstats
path: root/rpm/redhat/zfs-kmod.spec.in
blob: 26d5b605405866b6d2077241d1154622c5a1f463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%bcond_with     debug
%bcond_with     debug_dmu_tx

Name:           @PACKAGE@-kmod
Version:        @VERSION@
Release:        @RELEASE@%{?dist}

Summary:        Kernel module(s)
Group:          System Environment/Kernel
License:        @ZFS_META_LICENSE@
URL:            http://zfsonlinux.org/
BuildRequires:  %kernel_module_package_buildreqs
BuildRequires:  kmod-spl-devel = %{version}
Source0:        @PACKAGE@-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# Additional dependency information for the kmod sub-package must be specified
# by generating a preamble text file which kmodtool can append to the spec file.
%(/bin/echo -e "\
Requires:       spl-kmod\n\
Requires:       @PACKAGE@ = %{version}\n\
Conflicts:      @PACKAGE@-dkms\n\n" > %{_sourcedir}/kmod-preamble)

# LDFLAGS are not sanitized by arch/*/Makefile for these architectures.
%ifarch ppc ppc64 ppc64le aarch64
%global __global_ldflags %{nil}
%endif

%description
This package contains the ZFS kernel modules.

%define kmod_name @PACKAGE@

%kernel_module_package -n %{kmod_name} -p %{_sourcedir}/kmod-preamble

%define ksrc %{_usrsrc}/kernels/%{kverrel}
%define kobj %{ksrc}
%define splsrc %{_usrsrc}/spl-%{version}
%define splobj %{splsrc}/%{kverrel}

%package -n kmod-%{kmod_name}-devel
Summary:        ZFS kernel module(s) devel common
Group:          System Environment/Kernel
Requires:       kmod-spl-devel = %{version}

%description -n  kmod-%{kmod_name}-devel
This package provides the header files and objects to build kernel modules
which depend on the spl kernel module.

%prep
if ! [ -d "%{ksrc}"  ]; then
        echo "Kernel build directory isn't set properly, cannot continue"
        exit 1
fi

%if %{with debug}
%define debug --enable-debug
%else
%define debug --disable-debug
%endif

%if %{with debug_dmu_tx}
%define debug_dmu_tx --enable-debug-dmu-tx
%else
%define debug_dmu_tx --disable-debug-dmu-tx
%endif

%setup -n %{kmod_name}-%{version}
%build
%configure \
        --with-config=kernel \
        --with-linux=%{ksrc} \
        --with-linux-obj=%{kobj} \
        --with-spl="%{splsrc}" \
        --with-spl-obj="%{splobj}" \
        %{debug} \
        %{debug_dmu_tx}
make %{?_smp_mflags}

%install
make install \
        DESTDIR=${RPM_BUILD_ROOT} \
        INSTALL_MOD_DIR=extra/%{kmod_name}
%{__rm} -f %{buildroot}/lib/modules/%{kverrel}/modules.*

# find-debuginfo.sh only considers executables
%{__chmod} u+x  %{buildroot}/lib/modules/%{kverrel}/extra/*/*/*

%clean
rm -rf $RPM_BUILD_ROOT

%files -n kmod-%{kmod_name}-devel
%{_usrsrc}/%{kmod_name}-%{version}