Merge branch 'anbox' into 'master'

Improve anbox ebuild + bump snapshot

See merge request src_prepare/src_prepare-overlay!240
This commit is contained in:
Parona 2021-11-26 11:18:17 +00:00
commit b1ec979ae2
8 changed files with 212 additions and 38 deletions

View File

@ -1,3 +1,3 @@
DIST anbox-0_pre20201129.tar.gz 1024707 BLAKE2B 38153bdc3c011b726bbffefeb9ca439398988945a6f19265d2c6ebd424308a37fa321ab0685660cc67bedf7edbc8793c7cb0c179a5b31dd7aa640cc5286442eb SHA512 c4878745b62719c6cbecde047386858bd2ec7a5dbd37462967cab60fd118f31b89c157b4a00412b51bf130c7b46a83a3c3ab5162ee13baa0e789f773649e8745
DIST anbox-0_pre20210320.tar.gz 1024515 BLAKE2B 7e25e15ee598dafc5fd3918e59bdd7808ca32f0a7546316529b145fe8cf985cf77ecf3a95a735b2885676aa759ba4bd4801322e69cbf32590119ea62ecf7cf73 SHA512 89d31043047c1e25b2789638dddd5ea49d9fd754e0baa573c073c3c454e3a6e6f1e3bea6e4a632d6c3942d3a206741bc62f7db6e435c8be34856915dc4b27464
DIST anbox-20211020.tar.gz 1025857 BLAKE2B e5c7d9d17751ecd5d52ef6db1f48c0a3a3b0398dd3e0cfce974e5743bcd58c1dc4e72a6eac719fc4a56f297917da56340bf45cda247c31f45c0001420e0188c1 SHA512 9092a212b6662b84becf86c96a001090187763003a3c16d4fd4d7b4d31cc6bb92be240cbba1593b89e39637cb43da19f8f91567a578c7626709addb96be16809
DIST cpu_features-b9593c8b395318bb2bc42683a94f962564cc4664.tar.gz 55211 BLAKE2B b49714863cbebfde09e6ab99f31d9aaace367d84df9ecb12989fffc1326c9c60cfa14d917e490332c2a0b2a3fe267b6327b719652afba9bfa1654fc2564408b8 SHA512 8c12b50741e2979a32b69c788934bee0d00811b7662006c8b493e98d5efeada67ed59460be40c234b2d3bafd85671cb1a1d7c1a6ee535a7fc1cc6ac56a754576

View File

@ -1,26 +1,25 @@
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
EAPI=8
inherit linux-info systemd cmake
DESCRIPTION="Container-based approach to boot a full Android system"
HOMEPAGE="https://anbox.io/"
if [[ "${PV}" == "9999" ]]; then
if [[ "${PV}" == "99999999" ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/anbox/anbox.git"
EGIT_SUBMODULES=( 'external/cpu_features' )
EGIT_COMMIT_DATE="${PV}"
else
COMMIT="9de4e87cdd05135e1c71e6eadb68bf82719cebdf" # 20.03.2021
COMMIT="84f0268012cbe322ad858d76613f4182074510ac" # 20.10.2021
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
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}""
S="${WORKDIR}/${PN}-${COMMIT}"
KEYWORDS="~amd64"
fi
@ -33,17 +32,20 @@ DEPEND="
dev-cpp/properties-cpp
dev-cpp/sdbus-cpp
dev-cpp/gtest
dev-libs/boost[threads]
dev-libs/boost[threads(+)]
dev-libs/expat
dev-libs/protobuf
media-libs/libsdl2
media-libs/glm
media-libs/mesa[egl,gles2]
media-libs/mesa[egl(+),gles2]
media-libs/sdl2-image
sys-apps/dbus
sys-fs/fuse:3
sys-libs/libcap
|| ( sys-apps/systemd sys-auth/elogind )
|| (
sys-apps/systemd
sys-auth/elogind
)
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
@ -60,7 +62,10 @@ CONFIG_CHECK="
~TMPFS_XATTR
"
PATCHES=( ""${FILESDIR}"/no_bundled_sdbus-r1.patch" ""${FILESDIR}"/lxc.patch" )
PATCHES=(
"${FILESDIR}/lxc.patch"
"${FILESDIR}/no_bundled_sdbus-r1.patch"
)
pkg_pretend() {
if use !systemd; then
@ -72,13 +77,22 @@ pkg_pretend() {
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'"
if ! linux_config_exists && grep -qE '(CONFIG_ANDROID_BINDER_DEVICES=*[^h][^w]binder)' "${KERNEL_DIR}"/.config; then
eerror " CONFIG_ANDROID_BINDER_DEVICES does not contain string 'binder'"
fi
}
src_prepare() {
cp "${FILESDIR}"/FindGMock.cmake "${S}"/cmake
[[ "${PV}" == "9999" ]] || mv "${WORKDIR}"/cpu_features-"${EXTCOMMIT}"/* "${S}"/external/cpu_features || die
use !systemd && eapply "${FILESDIR}"/remove_systemd_dependency.patch
cp "${FILESDIR}/FindGMock.cmake" "${S}/cmake" || die
if [[ "${PV}" != "99999999" ]]; then
mv "${WORKDIR}"/cpu_features-"${EXTCOMMIT}"/* "${S}"/external/cpu_features || die
fi
if use !systemd; then
eapply "${FILESDIR}"/remove_systemd_dependency-r1.patch
fi
cmake_src_prepare
}
@ -89,21 +103,26 @@ src_configure() {
-DENABLE_WAYLAND=$(usex wayland)
-DBUILD_SHARED_LIBS=OFF
)
[[ "${PV}" == "9999" ]] || mycmakeargs+=(-DANBOX_VERSION="${PV}")
if [[ "${PV}" != "99999999" ]]; then
mycmakeargs+=(-DANBOX_VERSION="${PV} (${COMMIT})")
fi
cmake_src_configure
}
src_install() {
cmake_src_install
newbin "${FILESDIR}"/anbox-launch.sh anbox-launch
if use systemd; then
systemd_dounit "${FILESDIR}"/anbox-{container-manager.service,bridge.net{dev,work}}
systemd_douserunit "${FILESDIR}"/anbox-session-manager.service
else
exeinto /usr/share/anbox
doexe "scripts/anbox-bridge.sh"
newinitd "${FILESDIR}"/anbox-container-manager.initd anbox-container-manager
newconfd "${FILESDIR}"/anbox.confd anbox
doexe scripts/anbox-bridge.sh
newinitd "${FILESDIR}"/anbox-container-manager-r1.initd anbox-container-manager
newconfd "${FILESDIR}"/anbox-container-manager.confd anbox-container-manager
fi
}

View File

@ -1,26 +1,25 @@
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
EAPI=8
inherit linux-info systemd cmake
DESCRIPTION="Container-based approach to boot a full Android system"
HOMEPAGE="https://anbox.io/"
if [[ "${PV}" == "9999" ]]; then
if [[ "${PV}" == "99999999" ]]; 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
COMMIT="84f0268012cbe322ad858d76613f4182074510ac" # 20.10.2021
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
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}""
S="${WORKDIR}/${PN}-${COMMIT}"
KEYWORDS="~amd64"
fi
@ -33,17 +32,20 @@ DEPEND="
dev-cpp/properties-cpp
dev-cpp/sdbus-cpp
dev-cpp/gtest
dev-libs/boost[threads]
dev-libs/boost[threads(+)]
dev-libs/expat
dev-libs/protobuf
media-libs/libsdl2
media-libs/glm
media-libs/mesa[egl,gles2]
media-libs/mesa[egl(+),gles2]
media-libs/sdl2-image
sys-apps/dbus
sys-fs/fuse:3
sys-libs/libcap
|| ( sys-apps/systemd sys-auth/elogind )
|| (
sys-apps/systemd
sys-auth/elogind
)
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
@ -60,7 +62,10 @@ CONFIG_CHECK="
~TMPFS_XATTR
"
PATCHES=( ""${FILESDIR}"/no_bundled_sdbus.patch" ""${FILESDIR}"/lxc.patch" )
PATCHES=(
"${FILESDIR}/lxc.patch"
"${FILESDIR}/no_bundled_sdbus-r1.patch"
)
pkg_pretend() {
if use !systemd; then
@ -72,12 +77,22 @@ pkg_pretend() {
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'"
if ! linux_config_exists && grep -qE '(CONFIG_ANDROID_BINDER_DEVICES=*[^h][^w]binder)' "${KERNEL_DIR}"/.config; then
eerror " CONFIG_ANDROID_BINDER_DEVICES does not contain string 'binder'"
fi
}
src_prepare() {
[[ "${PV}" == "9999" ]] || mv "${WORKDIR}"/cpu_features-"${EXTCOMMIT}"/* "${S}"/external/cpu_features || die
use !systemd && eapply "${FILESDIR}"/remove_systemd_dependency.patch
cp "${FILESDIR}/FindGMock.cmake" "${S}/cmake" || die
if [[ "${PV}" != "99999999" ]]; then
mv "${WORKDIR}"/cpu_features-"${EXTCOMMIT}"/* "${S}"/external/cpu_features || die
fi
if use !systemd; then
eapply "${FILESDIR}"/remove_systemd_dependency-r1.patch
fi
cmake_src_prepare
}
@ -86,22 +101,28 @@ src_configure() {
-DCMAKE_BUILD_TYPE=Release
-DENABLE_X11=$(usex X)
-DENABLE_WAYLAND=$(usex wayland)
-DBUILD_SHARED_LIBS=OFF
)
[[ "${PV}" == "9999" ]] || mycmakeargs+=(-DANBOX_VERSION="${PV}")
if [[ "${PV}" != "99999999" ]]; then
mycmakeargs+=(-DANBOX_VERSION="${PV} (${COMMIT})")
fi
cmake_src_configure
}
src_install() {
cmake_src_install
newbin "${FILESDIR}"/anbox-launch.sh anbox-launch
if use systemd; then
systemd_dounit "${FILESDIR}"/anbox-{container-manager.service,bridge.net{dev,work}}
systemd_douserunit "${FILESDIR}"/anbox-session-manager.service
else
exeinto /usr/share/anbox
doexe "scripts/anbox-bridge.sh"
newinitd "${FILESDIR}"/anbox-container-manager.initd anbox-container-manager
newconfd "${FILESDIR}"/anbox.confd anbox
doexe scripts/anbox-bridge.sh
newinitd "${FILESDIR}"/anbox-container-manager-r1.initd anbox-container-manager
newconfd "${FILESDIR}"/anbox-container-manager.confd anbox-container-manager
fi
}

View File

@ -0,0 +1,46 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
name="Anbox container manager"
ANDROID_IMAGE="${ANDROID_IMAGE:-"/usr/share/andbox/android.img"}"
DATA_PATH="${DATA_PATH:-"/var/lib/anbox"}"
command=/usr/bin/anbox
command_args="container-manager --daemon --privileged --data-path=${DATA_PATH} --android-image=${ANDROID_IMAGE}"
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
modprobe binder_linux
if ! [[ -d /dev/binderfs ]] && grep -vq "binder on /dev/binderfs"; then
mkdir /dev/binderfs
mount -t binder binder /dev/binderfs
fi
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
}

View File

@ -0,0 +1,4 @@
# /etc/conf.d/anbox-container-manager: config file for /etc/init.d/anbox-container-manager
DATA_PATH="/var/lib/anbox"
ANDROID_IMAGE="/usr/share/anbox/android.img"

View File

@ -0,0 +1,38 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 713df49..8ef4633 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,7 +68,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/src/anbox/cmds/launch.h b/src/anbox/cmds/launch.h
index 5238982..2d388f5 100644
--- a/src/anbox/cmds/launch.h
+++ b/src/anbox/cmds/launch.h
@@ -21,7 +21,7 @@
#include <functional>
#include <iostream>
#include <memory>
-#include <systemd/sd-bus.h>
+#include <elogind/systemd/sd-bus.h>
#include "anbox/android/intent.h"
#include "anbox/wm/stack.h"
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 {

View File

@ -1,2 +1,3 @@
DIST sdbus-cpp-0.8.3.tar.gz 190124 BLAKE2B ad7d3872016471c7b8db0f20609e8debb13d155492655561675add60c9c1e9089553c31f7375136ba696112d17a4bd92a947a600a2c9f2842f7c0ba79f38046d SHA512 bdaccd686aeba9f24284c796fac7d0b6d514365e0b757db91e209e1e15c928d9de8ab1d5f5d21671896b07ea762ab4b7c6a5ce0850b17ad08bacb0f1a668cfb2
DIST sdbus-cpp-1.0.0.tar.gz 202061 BLAKE2B 38a73b4c538e4bc64a21cabb1a5e3abdfca52b0d5785e11a55aef59271e772435c6d6844e605ebebb398d09ace565b13f201cd62217a7174a4d9d9be24ef8e6b SHA512 dc6b6c4945f5203ad5e4d86ae78088ce367a5ee28f3bb1c17c116c0755d9b221685a92b32dd9e354351067b012768e8d42ebe5dac93199d1384b9b4dadec09ef
DIST systemd-stable-242.tar.gz 7831827 BLAKE2B cdcb2cb2b2b7b05eb8509faaf9bd5c11fdbab316c4ae61492e1eb5f405c9b2c527acc7105efad13cde1e877febe401a313e3dd43cec4f04aa5a4ea939f20f9a3 SHA512 607d41ce212ea320f51ad3729d86b4b2fb6a3ed78ff493ffe095ac9a7d7b27e56910c1b941c15c2e574b5e8fd8e72ab1d53870112ce604958a717a2f870290ff

View File

@ -0,0 +1,45 @@
# Copyright 2020-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
DESCRIPTION="High-level C++ D-Bus library for Linux"
HOMEPAGE="https://github.com/Kistler-Group/sdbus-cpp/"
SYSTEMDVER="242"
SRC_URI="
https://github.com/Kistler-Group/sdbus-cpp/archive/v${PV}.tar.gz -> sdbus-cpp-"${PV}".tar.gz
!systemd? ( https://github.com/systemd/systemd-stable/archive/v"${SYSTEMDVER}".tar.gz -> systemd-stable-"${SYSTEMDVER}".tar.gz )
"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
IUSE="systemd"
RDEPEND="
systemd? ( sys-apps/systemd )
"
DEPEND="
${RDEPEND}
virtual/pkgconfig
"
CMAKE_MAKEFILE_GENERATOR=emake # ninja cant handle external projects for some reason
PATCHES=( "${FILESDIR}/remove_download_from_external_project.patch" )
src_prepare() {
cmake_src_prepare
use systemd || mv "${WORKDIR}"/systemd-stable-"${SYSTEMDVER}" "${S}"_build/systemd || die
}
src_configure() {
local mycmakeargs=(
-DBUILD_CODE_GEN=ON # possibly could be use controlled instead
-DBUILD_LIBSYSTEMD=$(usex !systemd)
)
cmake_src_configure
}