File anbox-modules.spec of Package anbox-modules

#
# spec file for package anbox-modules
#
# Copyright (c) 2022 Florian "sp1rit" <packaging@sp1rit.anonaddy.me>
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           anbox-modules
Version:        0+git20211129~8148a16
Release:        0
Summary:        Anbox kernel modules
Group:          System/Kernel
License:        GPL-2.0-only
URL:            https://github.com/choff/anbox-modules/
#BuildArch:      noarch
Source0:        %{name}-%{version}.tar.xz
Source99:       preamble
Patch1:         patches-for-5_18-kernel.patch
BuildRequires:  %{kernel_module_package_buildreqs}
BuildRequires:  systemd-rpm-macros
Requires:       kmod(ashmem_linux.ko)
Requires:       kmod(binder_linux.ko)

%kernel_module_package -p %{_sourcedir}/preamble

%description
The kernel modules necessary to run the Anbox Android container runtime. They're split out of the original Anbox repository to make packaging in various Linux distributions easier.

%define _build_module() %{expand:
	rm -rf obj/%1/$flavor
	mkdir -p obj/%1
	cp -r %1 obj/%1/$flavor
	make %{?_smp_mflags} -C %{kernel_source $flavor} %{?linux_make_arch} modules M=$PWD/obj/%1/$flavor
}
%define _install_module() %{expand:
	make -C %{kernel_source $flavor} modules_install M=$PWD/obj/%1/$flavor
}

%prep
%autosetup -p1

%build
echo %flavors_to_build
for flavor in %flavors_to_build; do
	%_build_module ashmem
	%_build_module binder
done

%install
export INSTALL_MOD_PATH='%{buildroot}'
export INSTALL_MOD_DIR='%{kernel_module_package_moddir}'
# needssslcertforbuild
export BRP_PESIGN_FILES='*.ko'
for flavor in %flavors_to_build; do
	%_install_module ashmem
	%_install_module binder
done

install -m644 99-anbox.rules -Dt %{buildroot}%{_udevrulesdir}/

%files
%{_udevrulesdir}/99-anbox.rules

%changelog
openSUSE Build Service is sponsored by