File tp_smapi-kmp.spec of Package tp_smapi-kmp

#
# spec file for package tp_smapi-kmp
#
# Copyright (c) 2015 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 http://bugs.opensuse.org/
#


Name:           tp_smapi-kmp
Version:        0.43
Release:        0
Summary:        Kernel Modules implementing smapi on ThinkPads
License:        GPL-2.0+
Group:          System/Kernel
Url:            https://github.com/evgeni/tp_smapi
Source:         https://github.com/evgeni/tp_smapi/releases/download/tp-smapi/%{version}/tp_smapi-%{version}.tgz
BuildRequires:  -pesign
BuildRequires:  -pesign-obs-integration
BuildRequires:  kernel-source
BuildRequires:  kernel-syms
BuildRequires:  module-init-tools
BuildRequires:  libelf-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64
%suse_kernel_module_package -n tp_smapi kdump um xen -p %{_sourcedir}/preamble

%description
The tp_smapi kernel module exposes some features of the ThinkPad hardware/firmware via a sysfs interface.
Currently, the main implemented functionality is control of battery charging and extended battery status.
The underlying hardware interfaces are SMAPI and direct access to the embedded controller.

It also includes an improved version of the HDAPS driver.
%prep
%setup -q -n tp_smapi-%{version}

set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
for flavor in %{flavors_to_build}; do
    rm -rf obj/$flavor
    cp -r source obj/$flavor
    krel=$(make -s -C /usr/src/linux-obj/%{_target_cpu}/$flavor kernelrelease)
    cd obj/$flavor
    make KVER=${krel} KSRC=/usr/src/linux KBUILD=/usr/src/linux-obj/%{_target_cpu}/$flavor M=$PWD/obj/$flavor HDAPS=1
    cd -
done

%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
for flavor in %{flavors_to_build}; do
    make -C /usr/src/linux-obj/%{_target_cpu}/$flavor modules_install M=$PWD/obj/$flavor
done
cd source

%changelog