anbox/anbox.spec
2021-01-02 15:45:19 +03:00

150 lines
5.2 KiB
RPMSpec

%define commit 6c10125a7f13908d2cbe56d2d9ab09872755f265
%define commit_short %(echo %{commit} | head -c 6)
Summary: Android in a box
Name: anbox
Version: 0.0
Release: 0.git%{commit_short}.2
License: GPLv3
Group: Emulators
Url: https://anbox.io
Source0: https://github.com/anbox/anbox/archive/%{commit}.tar.gz?/%{name}-%{commit}.tar.gz
# Additional stuff from Debian
Source10: anbox-container-manager.service
Source11: org.anbox.service
Source12: anbox.desktop
Source13: anbox.1
Source14: README.ROSA
# Patches from Debian
Patch0001: 0001-fix-spelling-errors-in-external-libraries.patch
Patch0002: 0002-exclude-external-from-all-target.patch
Patch0003: 0003-pass-dpkg-buildflags-to-external-android-emugl.patch
# ROSA patches
Patch0004: 0004-Use-system-cpu_features-and-sdbus-cpp.patch
Patch0005: 0005-Off-Werror.patch
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: egl-devel
BuildRequires: glm-devel
BuildRequires: git-core
BuildRequires: protobuf-compiler
BuildRequires: python3
BuildRequires: systemd-units
BuildRequires: /usr/bin/sdbus-c++-xml2cpp
BuildRequires: cmake(CpuFeatures)
BuildRequires: pkgconfig(dri)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libcap)
# TODO: lxc v2 is very old, update it to v4
BuildRequires: pkgconfig(lxc)
# build of tests is disabled in %%prep, but headers are needed
BuildRequires: pkgconfig(gmock)
BuildRequires: pkgconfig(properties-cpp)
BuildRequires: pkgconfig(protobuf)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(SDL2_image)
BuildRequires: pkgconfig(sdbus-c++)
BuildRequires: pkgconfig(systemd)
# In Debian it is like this...
#ExclusiveArch: %{x86_64} %{armx} %{arm}
Requires: lxc
Requires: iptables
# adb to install android apps
Recommends: android-tools
# Description is from Debian package by Shengjing Zhu <zhsj@debian.org>
# https://salsa.debian.org/zhsj/anbox
%description
Anbox is a container-based approach to boot a full Android system on a
regular GNU/Linux system.
In other words: Anbox will let you run Android on your Linux system
without the slowness of virtualization.
Anbox 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 inside the container has no direct access to any hardware. All
hardware access is going through the anbox daemon on the host. It reuses
what Android implemented within the QEMU-based emulator for OpenGL ES
accelerated rendering. The Android system inside the container uses
different pipes to communicate with the host system and sends all hardware
access commands through these.
This package needs Android kernel modules and rootfs image,
download it from https://build.anbox.io/android-images
and put to /var/lib/anbox/android.img.
See %{_docdir}/anbox/README.ROSA for more information.
%files
%doc README.ROSA
%{_bindir}/anbox
%{_bindir}/anbox-shell
%{_bindir}/anbox-bridge
%{_bindir}/anbox-bridge
%{_datadir}/anbox
%{_datadir}/dbus-1/interfaces/org.anbox.ApplicationManager.xml
%{_datadir}/dbus-1/interfaces/org.anbox.Gps.xml
%{_datadir}/dbus-1/interfaces/org.anbox.Sensors.xml
%{_datadir}/dbus-1/services/org.anbox.service
%{_datadir}/pixmaps/anbox.png
%{_datadir}/applications/anbox.desktop
%{_mandir}/man1/anbox.1*
%{_unitdir}/anbox-container-manager.service
%dir /var/lib/anbox
%post
%systemd_post anbox-container-manager.service
%preun
%systemd_preun anbox-container-manager.service
#------------------------------------------------------------------
%prep
%autosetup -p1 -S git_am -n %{name}-%{commit}
# (From AUR) Don't build tests
#truncate -s 0 cmake/FindGMock.cmake
truncate -s 0 tests/CMakeLists.txt
# Use system libraries
rm -fvr external/sdbus-cpp
rm -fvr external/cpu_features
cp %{SOURCE14} README.ROSA
%build
%cmake \
-DENABLE_TOUCH_INPUT=ON \
-DENABLE_WAYLAND=OFF \
-DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-DANBOX_VERSION=%{version}-%{release} \
-DANBOX_VERSION_SUFFIX=%{vendor} \
-DCMAKE_BUILD_TYPE=Release
%make
%install
%makeinstall_std -C build
install -m0644 -D snap/gui/icon.png %{buildroot}%{_datadir}/pixmaps/anbox.png
install -m0644 -D %{SOURCE10} %{buildroot}%{_unitdir}/anbox-container-manager.service
install -m0644 -D %{SOURCE11} %{buildroot}%{_datadir}/dbus-1/services/org.anbox.service
install -m0644 -D %{SOURCE12} %{buildroot}%{_datadir}/applications/anbox.desktop
install -m0644 -D %{SOURCE13} %{buildroot}%{_mandir}/man1/anbox.1
install -m0755 -D scripts/anbox-bridge.sh %{buildroot}%{_datadir}/anbox/anbox-bridge.sh
install -m0755 -D scripts/anbox-shell.sh %{buildroot}%{_datadir}/anbox/anbox-shell.sh
mkdir -p %{buildroot}%{_bindir}
( cd %{buildroot}%{_bindir}
ln -s %{_datadir}/anbox/anbox-shell.sh anbox-shell
ln -s %{_datadir}/anbox/anbox-bridge.sh anbox-bridge
)
mkdir -p %{buildroot}/var/lib/anbox
# XXX Is it needed? Added by commit 4b033022eb318, but is not installed.
install -m0644 -D src/anbox/dbus/gps.xml %{buildroot}%{_datadir}/dbus-1/interfaces/org.anbox.Gps.xml
# The same, do they have to be installed?
install -m0644 -D src/anbox/dbus/application_manager.xml %{buildroot}%{_datadir}/dbus-1/interfaces/org.anbox.ApplicationManager.xml
install -m0644 -D src/anbox/dbus/sensors.xml %{buildroot}%{_datadir}/dbus-1/interfaces/org.anbox.Sensors.xml