app-emulation/anbox: add anbox
Package-Manager: Portage-3.0.9, Repoman-3.0.2
This commit is contained in:
parent
eb81382242
commit
c98b907e36
2
app-emulation/anbox/Manifest
Normal file
2
app-emulation/anbox/Manifest
Normal file
@ -0,0 +1,2 @@
|
||||
DIST anbox-0_pre20201129.tar.gz 1024707 BLAKE2B 38153bdc3c011b726bbffefeb9ca439398988945a6f19265d2c6ebd424308a37fa321ab0685660cc67bedf7edbc8793c7cb0c179a5b31dd7aa640cc5286442eb SHA512 c4878745b62719c6cbecde047386858bd2ec7a5dbd37462967cab60fd118f31b89c157b4a00412b51bf130c7b46a83a3c3ab5162ee13baa0e789f773649e8745
|
||||
DIST cpu_features-b9593c8b395318bb2bc42683a94f962564cc4664.tar.gz 55211 BLAKE2B b49714863cbebfde09e6ab99f31d9aaace367d84df9ecb12989fffc1326c9c60cfa14d917e490332c2a0b2a3fe267b6327b719652afba9bfa1654fc2564408b8 SHA512 8c12b50741e2979a32b69c788934bee0d00811b7662006c8b493e98d5efeada67ed59460be40c234b2d3bafd85671cb1a1d7c1a6ee535a7fc1cc6ac56a754576
|
112
app-emulation/anbox/anbox-0_pre20201129.ebuild
Normal file
112
app-emulation/anbox/anbox-0_pre20201129.ebuild
Normal file
@ -0,0 +1,112 @@
|
||||
# Copyright 2020 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit linux-info systemd cmake
|
||||
|
||||
DESCRIPTION="Container-based approach to boot a full Android system"
|
||||
HOMEPAGE="https://anbox.io/"
|
||||
|
||||
if [[ "${PV}" == "9999" ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/anbox/anbox.git"
|
||||
EGIT_SUBMODULES=( 'external/cpu_features' )
|
||||
EGIT_COMMIT_DATE="${PV}"
|
||||
else
|
||||
COMMIT="6c10125a7f13908d2cbe56d2d9ab09872755f265" # 29.11.2020
|
||||
EXTCOMMIT="b9593c8b395318bb2bc42683a94f962564cc4664"
|
||||
SRC_URI="
|
||||
https://github.com/anbox/anbox/archive/"${COMMIT}".tar.gz -> "${P}".tar.gz
|
||||
https://github.com/google/cpu_features/archive/"${EXTCOMMIT}".tar.gz -> cpu_features-"${EXTCOMMIT}".tar.gz
|
||||
"
|
||||
S=""${WORKDIR}"/"${PN}"-"${COMMIT}""
|
||||
KEYWORDS="~amd64"
|
||||
fi
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0"
|
||||
IUSE="X wayland systemd"
|
||||
|
||||
DEPEND="
|
||||
>=app-emulation/lxc-3.0.0
|
||||
dev-libs/boost[threads]
|
||||
dev-libs/expat
|
||||
dev-libs/protobuf
|
||||
media-libs/libsdl2
|
||||
media-libs/glm
|
||||
sys-apps/dbus
|
||||
sys-libs/libcap
|
||||
|| ( sys-apps/systemd sys-auth/elogind )
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
CONFIG_CHECK="
|
||||
~ANDROID_BINDERFS
|
||||
~ANDROID_BINDER_IPC
|
||||
~ASHMEM
|
||||
~SQUASHFS
|
||||
~SQUASHFS_XZ
|
||||
~SQUASHFS_XATTR
|
||||
~TMPFS_XATTR
|
||||
"
|
||||
|
||||
PATCHES=( ""${FILESDIR}"/no_bundled_sdbus.patch" )
|
||||
|
||||
pkg_pretend() {
|
||||
if use !systemd; then
|
||||
# Needed for anbox-bridge.sh
|
||||
CONFIG_CHECK="
|
||||
~NETFILTER_XT_MATCH_COMMENT
|
||||
~NETFILTER_XT_TARGET_CHECKSUM
|
||||
"
|
||||
check_extra_config
|
||||
fi
|
||||
# Check if ANDROID_BINDER_DEVICES has binder string specicied in it
|
||||
linux_config_exists && grep -qE '(CONFIG_ANDROID_BINDER_DEVICES=*[^h][^w]binder)' "${KERNEL_DIR}"/.config || eerror " CONFIG_ANDROID_BINDER_DEVICES does not contain string 'binder'"
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
[[ "${PV}" == "9999" ]] || mv "${WORKDIR}"/cpu_features-"${EXTCOMMIT}"/* "${S}"/external/cpu_features || die
|
||||
use !systemd && eapply "${FILESDIR}"/elogind_instead_of_systemd_headers.patch
|
||||
cmake_src_prepare
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local mycmakeargs=(
|
||||
-DENABLE_X11=$(usex X)
|
||||
-DENABLE_WAYLAND=$(usex wayland)
|
||||
)
|
||||
[[ "${PV}" == "9999" ]] || mycmakeargs+=(-DANBOX_VERSION="${PV}")
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
newbin "${FILESDIR}"/anbox-launch.sh anbox-launch
|
||||
if use systemd; then
|
||||
systemd_dounit "${FILESDIR}"/anbox-{{container,session}-manager.service,bridge.net{dev,work}}
|
||||
else
|
||||
exeinto /usr/share/anbox
|
||||
doexe "scripts/anbox-bridge.sh"
|
||||
newinitd "${FILESDIR}"/anbox-container-manager.initd anbox-container-manager
|
||||
newconfd "${FILESDIR}"/anbox.confd anbox
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
einfo "Anbox requires a specially made android image installed to /usr/share/anbox/android.img. "
|
||||
einfo "You can either download it prebuilt from upstream:"
|
||||
einfo " https://build.anbox.io/android-images/"
|
||||
einfo "or to build it manually according to instructions:"
|
||||
einfo " https://github.com/anbox/anbox/blob/master/docs/build-android.md"
|
||||
einfo ""
|
||||
einfo "How to get it running:"
|
||||
einfo "First start the anbox-container-manager daemon"
|
||||
if use systemd; then
|
||||
einfo "# systemctl start anbox-container-manager"
|
||||
else
|
||||
einfo "# rc-service anbox-container-manager start"
|
||||
fi
|
||||
einfo "Then you can access the image"
|
||||
einfo "$ anbox-launch"
|
||||
}
|
112
app-emulation/anbox/anbox-9999.ebuild
Normal file
112
app-emulation/anbox/anbox-9999.ebuild
Normal file
@ -0,0 +1,112 @@
|
||||
# Copyright 2020 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit linux-info systemd cmake
|
||||
|
||||
DESCRIPTION="Container-based approach to boot a full Android system"
|
||||
HOMEPAGE="https://anbox.io/"
|
||||
|
||||
if [[ "${PV}" == "9999" ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/anbox/anbox.git"
|
||||
EGIT_SUBMODULES=( 'external/cpu_features' )
|
||||
EGIT_COMMIT_DATE="${PV}"
|
||||
else
|
||||
COMMIT="6c10125a7f13908d2cbe56d2d9ab09872755f265" # 29.11.2020
|
||||
EXTCOMMIT="b9593c8b395318bb2bc42683a94f962564cc4664"
|
||||
SRC_URI="
|
||||
https://github.com/anbox/anbox/archive/"${COMMIT}".tar.gz -> "${P}".tar.gz
|
||||
https://github.com/google/cpu_features/archive/"${EXTCOMMIT}".tar.gz -> cpu_features-"${EXTCOMMIT}".tar.gz
|
||||
"
|
||||
S=""${WORKDIR}"/"${PN}"-"${COMMIT}""
|
||||
KEYWORDS="~amd64"
|
||||
fi
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0"
|
||||
IUSE="X wayland systemd"
|
||||
|
||||
DEPEND="
|
||||
>=app-emulation/lxc-3.0.0
|
||||
dev-libs/boost[threads]
|
||||
dev-libs/expat
|
||||
dev-libs/protobuf
|
||||
media-libs/libsdl2
|
||||
media-libs/glm
|
||||
sys-apps/dbus
|
||||
sys-libs/libcap
|
||||
|| ( sys-apps/systemd sys-auth/elogind )
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
CONFIG_CHECK="
|
||||
~ANDROID_BINDERFS
|
||||
~ANDROID_BINDER_IPC
|
||||
~ASHMEM
|
||||
~SQUASHFS
|
||||
~SQUASHFS_XZ
|
||||
~SQUASHFS_XATTR
|
||||
~TMPFS_XATTR
|
||||
"
|
||||
|
||||
PATCHES=( ""${FILESDIR}"/no_bundled_sdbus.patch" )
|
||||
|
||||
pkg_pretend() {
|
||||
if use !systemd; then
|
||||
# Needed for anbox-bridge.sh
|
||||
CONFIG_CHECK="
|
||||
~NETFILTER_XT_MATCH_COMMENT
|
||||
~NETFILTER_XT_TARGET_CHECKSUM
|
||||
"
|
||||
check_extra_config
|
||||
fi
|
||||
# Check if ANDROID_BINDER_DEVICES has binder string specicied in it
|
||||
linux_config_exists && grep -qE '(CONFIG_ANDROID_BINDER_DEVICES=*[^h][^w]binder)' "${KERNEL_DIR}"/.config || eerror " CONFIG_ANDROID_BINDER_DEVICES does not contain string 'binder'"
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
[[ "${PV}" == "9999" ]] || mv "${WORKDIR}"/cpu_features-"${EXTCOMMIT}"/* "${S}"/external/cpu_features || die
|
||||
use !systemd && eapply "${FILESDIR}"/elogind_instead_of_systemd_headers.patch
|
||||
cmake_src_prepare
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local mycmakeargs=(
|
||||
-DENABLE_X11=$(usex X)
|
||||
-DENABLE_WAYLAND=$(usex wayland)
|
||||
)
|
||||
[[ "${PV}" == "9999" ]] || mycmakeargs+=(-DANBOX_VERSION="${PV}")
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
newbin "${FILESDIR}"/anbox-launch.sh anbox-launch
|
||||
if use systemd; then
|
||||
systemd_dounit "${FILESDIR}"/anbox-{{container,session}-manager.service,bridge.net{dev,work}}
|
||||
else
|
||||
exeinto /usr/share/anbox
|
||||
doexe "scripts/anbox-bridge.sh"
|
||||
newinitd "${FILESDIR}"/anbox-container-manager.initd anbox-container-manager
|
||||
newconfd "${FILESDIR}"/anbox.confd anbox
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
einfo "Anbox requires a specially made android image installed to /usr/share/anbox/android.img. "
|
||||
einfo "You can either download it prebuilt from upstream:"
|
||||
einfo " https://build.anbox.io/android-images/"
|
||||
einfo "or to build it manually according to instructions:"
|
||||
einfo " https://github.com/anbox/anbox/blob/master/docs/build-android.md"
|
||||
einfo ""
|
||||
einfo "How to get it running:"
|
||||
einfo "First start the anbox-container-manager daemon"
|
||||
if use systemd; then
|
||||
einfo "# systemctl start anbox-container-manager"
|
||||
else
|
||||
einfo "# rc-service anbox-container-manager start"
|
||||
fi
|
||||
einfo "Then you can access the image"
|
||||
einfo "$ anbox-launch"
|
||||
}
|
3
app-emulation/anbox/files/anbox-bridge.netdev
Normal file
3
app-emulation/anbox/files/anbox-bridge.netdev
Normal file
@ -0,0 +1,3 @@
|
||||
[NetDev]
|
||||
Name=anbox0
|
||||
Kind=bridge
|
7
app-emulation/anbox/files/anbox-bridge.network
Normal file
7
app-emulation/anbox/files/anbox-bridge.network
Normal file
@ -0,0 +1,7 @@
|
||||
[Match]
|
||||
Name=anbox0
|
||||
Driver=bridge
|
||||
|
||||
[Network]
|
||||
Address=192.168.250.1/24
|
||||
IPMasquerade=yes
|
38
app-emulation/anbox/files/anbox-container-manager.initd
Normal file
38
app-emulation/anbox/files/anbox-container-manager.initd
Normal file
@ -0,0 +1,38 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
supervisor=supervise-daemon
|
||||
|
||||
name="Anbox container manager"
|
||||
command=/usr/bin/anbox
|
||||
command_args="container-manager --daemon --privileged --data-path=/var/lib/anbox --android-image=/usr/share/anbox/android.img"
|
||||
|
||||
depend() {
|
||||
need localmount sysfs cgroups fuse
|
||||
use net
|
||||
after firewall
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
# that's all you need to avoid the lxc dependency
|
||||
checkpath --directory /usr/lib/lxc
|
||||
checkpath --directory /usr/lib/lxc/rootfs
|
||||
|
||||
modprobe loop
|
||||
modprobe tun
|
||||
|
||||
if ip link show anbox0 >/dev/null 2>&1; then
|
||||
ewarn "anbox0 network interface already exists"
|
||||
else
|
||||
ebegin "Creating anbox0 network interface"
|
||||
/usr/share/anbox/anbox-bridge.sh start
|
||||
eend $?
|
||||
fi
|
||||
}
|
||||
|
||||
stop_post() {
|
||||
if ip link show anbox0 >/dev/null 2>&1; then
|
||||
ebegin "Removing anbox0 network interface"
|
||||
/usr/share/anbox/anbox-bridge.sh stop
|
||||
eend $?
|
||||
fi
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Anbox Container Manager
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
23
app-emulation/anbox/files/anbox-launch.sh
Normal file
23
app-emulation/anbox/files/anbox-launch.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# https://gitlab.com/postmarketOS/pmaports/-/issues/479
|
||||
# EGL_PLATFORM=wayland is broken on desktop as
|
||||
# Anbox require PBuffer support but Wayland EGL
|
||||
# doesn't provide it. Unsetting this value
|
||||
# unbreaks Anbox on e.g. Plasma Mobile.
|
||||
if [ "$EGL_PLATFORM" = wayland ]; then
|
||||
export EGL_PLATFORM
|
||||
unset EGL_PLATFORM
|
||||
fi
|
||||
|
||||
# This breaks Anbox display if EGL_PLATFORM is not
|
||||
# set to wayland. Since EGL_PLATFORM is never set
|
||||
# to wayland, let's unset SDL_VIDEODRIVER if it is.
|
||||
if [ "$SDL_VIDEODRIVER" = wayland ]; then
|
||||
export SDL_VIDEODRIVER
|
||||
unset SDL_VIDEODRIVER
|
||||
fi
|
||||
|
||||
# We let Anbox autostart the session manager as this
|
||||
# provides a splash-screen
|
||||
anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
|
8
app-emulation/anbox/files/anbox-session-manager.service
Normal file
8
app-emulation/anbox/files/anbox-session-manager.service
Normal file
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Anbox Session Manager
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/anbox session-manager
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
8
app-emulation/anbox/files/anbox.confd
Normal file
8
app-emulation/anbox/files/anbox.confd
Normal file
@ -0,0 +1,8 @@
|
||||
# Sample conf.d file for alpine linux
|
||||
|
||||
#
|
||||
# Specify daemon options here.
|
||||
#
|
||||
|
||||
sample_opts=""
|
||||
sample_user=""
|
@ -0,0 +1,13 @@
|
||||
diff --git a/src/anbox/dbus/bus.h b/src/anbox/dbus/bus.h
|
||||
index 40b3d94..e798b4b 100644
|
||||
--- a/src/anbox/dbus/bus.h
|
||||
+++ b/src/anbox/dbus/bus.h
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
-#include <systemd/sd-bus.h>
|
||||
+#include <elogind/systemd/sd-bus.h>
|
||||
|
||||
namespace anbox::dbus {
|
||||
class Bus : public DoNotCopyOrMove {
|
58
app-emulation/anbox/files/no_bundled_sdbus.patch
Normal file
58
app-emulation/anbox/files/no_bundled_sdbus.patch
Normal file
@ -0,0 +1,58 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 713df49..1e8b462 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -59,6 +59,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
find_package(Boost COMPONENTS filesystem log serialization system thread program_options)
|
||||
find_package(PkgConfig)
|
||||
find_package(Threads)
|
||||
+find_package(SDBus-C++ REQUIRED)
|
||||
find_package(EGL REQUIRED)
|
||||
find_package(GLESv2 REQUIRED)
|
||||
find_package(Protobuf REQUIRED)
|
||||
@@ -68,7 +69,6 @@ pkg_check_modules(SDL2_IMAGE SDL2_image REQUIRED)
|
||||
pkg_check_modules(DBUS dbus-1 REQUIRED)
|
||||
pkg_check_modules(LXC lxc REQUIRED)
|
||||
pkg_check_modules(PROPERTIES_CPP properties-cpp REQUIRED)
|
||||
-pkg_check_modules(LIBSYSTEMD libsystemd REQUIRED)
|
||||
pkg_check_modules(LIBCAP libcap REQUIRED)
|
||||
|
||||
message(STATUS "LXC version: ${LXC_VERSION}")
|
||||
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
|
||||
index f677aa0..265a2eb 100644
|
||||
--- a/external/CMakeLists.txt
|
||||
+++ b/external/CMakeLists.txt
|
||||
@@ -6,12 +6,3 @@ add_subdirectory(backward-cpp)
|
||||
set(BUILD_TESTING OFF)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error")
|
||||
add_subdirectory(cpu_features)
|
||||
-include(ExternalProject)
|
||||
-ExternalProject_Add(sdbus-cpp
|
||||
- PREFIX sdbus-cpp
|
||||
- SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/sdbus-cpp"
|
||||
- INSTALL_COMMAND ""
|
||||
- CMAKE_CACHE_ARGS
|
||||
- -DBUILD_CODE_GEN:BOOL=ON
|
||||
- -DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
-)
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 796b881..a19da1b 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -26,7 +26,6 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/external/android-emugl/host/libs/renderControl_dec
|
||||
${CMAKE_BINARY_DIR}/external/android-emugl/host/libs/renderControl_dec
|
||||
${CMAKE_SOURCE_DIR}/external/cpu_features/include
|
||||
- ${CMAKE_SOURCE_DIR}/external/sdbus-cpp/include
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBINDERFS_PATH=\"\\\"${BINDERFS_PATH}\\\"\"")
|
||||
@@ -59,7 +58,7 @@ add_library(anbox-protobuf
|
||||
target_link_libraries(anbox-protobuf
|
||||
${PROTOBUF_LITE_LIBRARIES})
|
||||
|
||||
-set(XML2CPP ${CMAKE_BINARY_DIR}/external/sdbus-cpp/src/sdbus-cpp-build/tools/sdbus-c++-xml2cpp)
|
||||
+set(XML2CPP sdbus-c++-xml2cpp)
|
||||
|
||||
macro(DBusServer BaseName)
|
||||
add_custom_command(
|
11
app-emulation/anbox/metadata.xml
Normal file
11
app-emulation/anbox/metadata.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>parona@protonmail.com</email>
|
||||
<name>Alfred Wingate</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">anbox/anbox</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
Loading…
Reference in New Issue
Block a user