File waydroid.spec of Package waydroid
#
# spec file for package waydroid
#
# Copyright (c) 2021 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: waydroid
Version: 1.2.1
Release: 0
Summary: Uses a container-based approach to boot a full Android system
License: GPL-3.0-or-later AND BSD-3-Clause
URL: https://github.com/waydroid/waydroid
Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: README_SUSE.md
# Adding gbinder.conf to source tree so we can put it into /etc
# preventing "Failed to get service waydroidplatform, trying again..."
Patch1: add_gbinder_conf
Patch2: fix-net.patch
BuildRequires: fdupes
BuildRequires: update-desktop-files
Requires: lxc
Requires: python3-gbinder
Requires: python3-gobject
Requires: python3-pyclipper
#commenting out to prevent explicit-lib-dependency error
#Requires: libgbinder1
#Requires: libglibutil1
BuildArch: noarch
%{?systemd_requires}
%description
Waydroid uses Linux namespaces (user, pid, uts, net, mount, ipc) to run a full Android system
in a container and provide Android applications on any GNU/Linux-based platform.
The Android system inside the container has direct access to any needed hardware.
The Android runtime environment ships with a minimal customized Android system image based on LineageOS.
The image is currently based on Android 10.
%prep
%autosetup -p1
rm -rf debian/{compat,control,rules}
rm -rf debian/waydroid.dirs
rm -rf debian/waydroid.install
rm -rf debian/waydroid.links
rm -rf debian/waydroid.postinst
rm -rf debian/source
sed -i -e '1d;2i#!/usr/bin/python3' waydroid.py
sed -i "s|anbox-||g" gbinder/anbox.conf
%build
%install
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_sysconfdir}/gbinder.d/
install -d %{buildroot}%{_prefix}/lib
install -d %{buildroot}%{_prefix}/lib/%{name}
install -d %{buildroot}/%{_datadir}/applications/
install -d %{buildroot}%{_unitdir}/
cp -R * %{buildroot}%{_prefix}/lib/%{name}/
ln -sf %{_prefix}/lib/%{name}/%{name}.py %{buildroot}%{_bindir}/%{name}
cp %{buildroot}%{_prefix}/lib/%{name}/gbinder/anbox.conf %{buildroot}%{_sysconfdir}/gbinder.d/anbox.conf
install -m 0775 data/Waydroid.desktop %{buildroot}%{_datadir}/applications/Waydroid.desktop
find %{buildroot}%{_datadir}/applications/. -type f -executable -exec chmod -x "{}" \;
install -m 0644 gbinder.conf %{buildroot}%{_sysconfdir}/gbinder.conf
install -m 0644 debian/%{name}-container.service %{buildroot}%{_unitdir}/%{name}-container.service
mkdir -p %{buildroot}%{_datadir}/doc/packages/%{name}/
install -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/doc/packages/%{name}/README_SUSE.md
ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}-container
%fdupes %{buildroot}/%{_prefix}
%pre
%service_add_pre %{name}-container.service
%post
%service_add_post %{name}-container.service
%preun
%service_del_preun %{name}-container.service
%postun
%service_del_postun %{name}-container.service
%files
%license LICENSE debian/copyright
%doc README.md debian/changelog README_SUSE.md
%{_bindir}/%{name}
%{_sbindir}/rc%{name}-container
%dir %{_sysconfdir}/gbinder.d/
%config %{_sysconfdir}/gbinder.d/anbox.conf
%config %{_sysconfdir}/gbinder.conf
%{_datadir}/applications/Waydroid.desktop
%{_prefix}/lib/%{name}
%{_unitdir}/%{name}-container.service
%changelog