File zfs-kmod.spec of Package zfs

# spec file for package zfs-kmod
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define pkg_name zfs

%bcond_with     debug
%bcond_with     debug_dmu_tx

Name:           %{pkg_name}-kmod
Version:        0.7.0
Release:        rc4
Summary:        Kernel module(s)
License:        CDDL-1.0
Group:          System/Filesystems
BuildRequires:  %{kernel_module_package_buildreqs}
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  kernel-syms
BuildRequires:  libtool
BuildRequires:  spl-kmod-devel = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%suse_kernel_module_package -n %{pkg_name} -p %{name}.preamble um xen

This package contains the ZFS kernel modules.

%package devel
Summary:        Headers and Symbols
Group:          Development/Libraries/C and C++
# The developments headers will conflict with the dkms packages.
Conflicts:      %{pkg_name}-dkms

%description devel
This package contains the header files and Module{s}.symvers
symbols needed for building additional modules.

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

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

%setup -q -n %{pkg_name}-%{pkg_name}-%{version}

mkdir -p ../obj
for flavor in %{flavors_to_build}; do
    krel=$(make -s -C %{_usrsrc}/linux-obj/%{_target_cpu}/$flavor kernelrelease)
    rm -rf ../obj/$flavor
    cp -r ../%{pkg_name}-%{pkg_name}-%{version} ../obj/$flavor
    pushd ../obj/$flavor
    %configure \
	--with-config=kernel \
	--with-linux=%{_usrsrc}/linux \
	--with-linux-obj=%{_usrsrc}/linux-obj/%{_target_cpu}/$flavor \
	--with-spl=%{_usrsrc}/spl-%{version} \
	--with-spl-obj=%{_usrsrc}/spl-%{version}/$krel \
	%{debug} \

    make %{?_smp_mflags}

for flavor in %{flavors_to_build}; do
    pushd ../obj/$flavor
    make DESTDIR=%{buildroot} install

%files devel