File anbox-modules.spec of Package anbox-modules

#
# spec file for package anbox-kmp
#
# 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 http://bugs.opensuse.org/
#

Name:		anbox-modules
Version:	0
Release:	0
Summary:	Ashmem anb Binder modules
License:	GPL-2.0
Group:		System/Kernel
Url:		https://github.com/anbox/anbox
Source0:	%{name}-%{version}.tar.gz
Source1:	anbox-kmp-preamble
BuildRequires:	kernel-syms
BuildRequires:	kernel-source
BuildRequires:	libelf-devel
BuildRequires:	module-init-tools
BuildRequires:	systemd
BuildRequires:	udev
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%kernel_module_package -n anbox -p anbox-kmp-preamble

%description
Anbox ashmem and binder out-of-tree kernel modules.

%prep
%setup -q

%build
for module_name in binder ashmem; do
	pushd $module_name
	for flavor in %{flavors_to_build}; do
		cp -a . "../obj-$module_name-$flavor/"
		pushd "../obj-$module_name-$flavor/"
		make -C %{kernel_source $flavor} modules M=$PWD
		popd
	done
	popd
done


%install

install -m644 anbox.conf -Dt %{buildroot}%{_prefix}/lib/modules-load.d/
install -m644 99-anbox.rules -Dt %{buildroot}%{_prefix}/lib/udev/rules.d/

export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=misc

for module_name in binder ashmem; do
	pushd $module_name
	for flavor in %{flavors_to_build}; do
		pushd "../obj-$module_name-$flavor/"
		make -C %{kernel_source $flavor} modules_install M=$PWD
		popd
	done
	popd
done
echo ashmem_linux >> /etc/modules-load.d/anbox.conf
echo binder_linux >> /etc/modules-load.d/anbox.conf

%files
%{_prefix}/lib/modules-load.d/anbox.conf
%{_prefix}/lib/udev/rules.d/99-anbox.rules

%changelog
openSUSE Build Service is sponsored by