File exfat-kmp.spec of Package exfat-kmp

%define bname exfat
Name: %bname-kmp
Version: 1.2.9
Release: 8
Summary: Linux read/write kernel driver for the exFAT file system
License: GPL-2.0
Group: System/Kernel
Url: https://github.com/rxrz/%bname-nofuse
#Git-Clone: git://github.com/rxrz/exfat-nofuse.git
Source: %bname-%version.tar.xz
Patch: %bname-%version-git.patch
Patch0: exfat-kernel-4.4-opensuse-leap-42.3.patch
Patch1: 0001-Linux-4.1.37-have-setattr_prepare.patch
Patch2: 0002-exfat-fix-for-4.1-compat.patch
Patch3: exfat-kernel-4.4-opensuse-leap-42.3.patch
BuildRequires: kernel-syms >= 2.6.20
BuildRequires: modutils

%define strip_mod_opts --strip-unneeded -R .comment

%description
Linux read/write kernel driver for the exFAT file system.


%package KMP
Summary: Linux read/write kernel driver for the exFAT file system
Group: System/Kernel

%description KMP
Linux read/write kernel driver for the exFAT file system.


%kernel_module_package -n %bname -p %name-preamble


%prep
echo %flavors_to_build
%setup -cT -a0
cd %{bname}*
%patch -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1 -F1
cd -
for flavor in %flavors_to_build; do
	mkdir obj-$flavor
	cp -al %{bname}* obj-$flavor/
done
rm -rf %{bname}*


%build
cat <<"__EOF__" | make %{?_smp_mflags} -f - all
all: %flavors_to_build

%flavors_to_build:
	$(MAKE) -C obj-$@/%{bname}* KDIR="/usr/src/linux-obj/%_target_cpu/$@"
__EOF__


%install
for flavor in %flavors_to_build; do
	cd obj-$flavor/%{bname}*
	make -C /usr/src/linux-obj/%_target_cpu/$flavor \
		INSTALL_MOD_PATH="%buildroot" \
		INSTALL_MOD_DIR=fs \
		%{!?_enable_debug:%{?strip_mod_opts:INSTALL_MOD_STRIP="%strip_mod_opts"}} \
		SUBDIRS=$PWD \
		modules_install
	cd -
done


%changelog