Commit 42cc40da authored by Antoine Fontaine's avatar Antoine Fontaine Committed by Rasmus Thomsen
Browse files

testing/anbox: new aports

parent ebf3f2ec
# Contributor: Bart Ribbers <bribbers@disroot.org>
# Contributor: Grant Miller <GrantM11235@gmail.com>
# Contributor: Antoine Fontaine <antoine.fontaine@epfl.ch>
# Maintainer:
pkgname=anbox
pkgver=0_git20200102
pkgrel=0
_commit="b18e62218af49ee882abd00da2ef540142e59784"
_cpu_features_commit="b5c271c53759b2b15ff91df19bd0b32f2966e275"
pkgdesc="Android in a box"
url="https://github.com/anbox/anbox"
arch="x86_64 armhf armv7 aarch64"
license="GPL-3.0-or-later"
options="!check" # TODO: make checks work
subpackages="$pkgname-openrc $pkgname-networkmanager"
install="$pkgname.post-install"
depends="
dbus
dbus-libs
mesa-gles
mesa-egl
fuse3
lxc
"
makedepends="
mesa-dev
python2
cmake
cmake-extras
lxc-dev
sdl2-dev
sdl2_image-dev
boost-dev
dbus-dev
libcap-dev
libdwarf-dev
protobuf-dev
elogind-dev
properties-cpp-dev
libexecinfo-dev
"
source="
$pkgname-$_commit.tar.gz::https://github.com/anbox/anbox/archive/$_commit.tar.gz
cpu_features-$_cpu_features_commit.tar.gz::https://github.com/google/cpu_features/archive/$_cpu_features_commit.tar.gz
anbox-container-manager.initd
anbox.confd
disable-tests.patch
musl-fixes.patch
fix-arm-build.patch
give-more-time-to-start.patch
anbox-launch.sh
anbox.desktop
"
builddir="$srcdir/$pkgname-$_commit"
prepare() {
default_prepare
rm -rf external/cpu_features
cp -r $srcdir/cpu_features-*/ external/cpu_features
mkdir -p "$builddir"/build
}
build() {
cd "$builddir"/build
cmake "$builddir" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=OFF \
-DWerror=OFF
make
}
package() {
cd "$builddir"/build
DESTDIR="$pkgdir" make install
install -m755 -D "$srcdir"/anbox-container-manager.initd \
"$pkgdir"/etc/init.d/anbox-container-manager
install -m644 -D "$srcdir"/$pkgname.confd \
"$pkgdir"/etc/conf.d/$pkgname
install -m755 -D "$srcdir"/$pkgname-launch.sh \
"$pkgdir"/usr/bin/$pkgname-launch
install -m644 -D "$srcdir"/$pkgname.desktop \
"$pkgdir"/usr/share/applications/$pkgname.desktop
install -m755 -D "$builddir"/scripts/anbox-bridge.sh \
"$pkgdir"/usr/share/anbox/anbox-bridge.sh
}
networkmanager() {
#install_if="$pkgname networkmanager" # causes issues, let's keep it installed manually for now
depends="$pkgname networkmanager"
install="$pkgname-networkmanager.post-install $pkgname-networkmanager.post-deinstall"
pkgdesc="$pkgdesc, internet access support"
mkdir "$subpkgdir"
}
sha512sums="5abf2191968a68f2d9fcde5e85a9d174212506d3c848115e0859b2c41baadaeab08a6828449e3edd5023829432698aa8bbd9c6e16c8ce8560974db1403bbd556 anbox-b18e62218af49ee882abd00da2ef540142e59784.tar.gz
c0ec9b603cec2cc9049923e15ef50c85806bc0a0ffe57b63348631061aeddb73c1eca910b25696cf5eac2606aec3f86db29e8a01e01cf438bfee86edfe909e4a cpu_features-b5c271c53759b2b15ff91df19bd0b32f2966e275.tar.gz
5a8e76fd636670bdfcbf45c290c06f9399df7831af121e0a6238cc5d7d57d6f7036bca2d457c07f3f694df6f7a574a4e5ace6b1ad3a5e17a68fd638a299faa99 anbox-container-manager.initd
6a3bc88142c5287ec54d481a4788eceb7772d9974af950b5286ce63a49d05d9d49fce5ba1d02b4b1c9893896fd4ba218fd4d39b8e640bdd61ad196b5d5c9a021 anbox.confd
3351edbd50370f514e405f10584264b110cd3d5eff766185b23d4c7e885933f0378330df5222fbd4b5161ff81f292ea63b4940f4afb1c457a2511fe8b5110195 disable-tests.patch
401669509e05eb586ad40fc9e8f4284b52183f06c60e87bf4e923be165a72f10263daf226db7fd610ef6ff25d09abd140ca2d59187e2d1b85a0bd6ae887dd944 musl-fixes.patch
897a6f0fddd9d963f6c66e4561f5b468856dd94c8df500f27b08b2bfcef8c0d253f985333b501447afbe3e2abf5d354523b1db0304b87e762abcd4f1d8cac2e7 fix-arm-build.patch
4f4439a0f991a77a157464280fd9d43fcff1319effc9bdd235fc61f16c3fbef59d8585ae363326179dd4b1f71e4d206498844361d1418846eb42c5a0d40db33b give-more-time-to-start.patch
d88bc45b681b6ed318279ee4485ae0d47fd648f207722c094906b61c74d7c373762cdaba890fa577467da99204681cd502051071ee61b2c1c555732e403b4e15 anbox-launch.sh
bc3bec88f271484ef66afb862e517b614568270a4047e400995f73b08ce05cb4faa18a746db161711ec91ef125f0063127e4027699921302406405bbb778583d anbox.desktop"
#!/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"
depend() {
need localmount sysfs cgroups fuse
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
/usr/share/anbox/anbox-bridge.sh start
}
stop_post() {
# ideally, we would stop it _after_ shutting down
# the container manager.
/usr/share/anbox/anbox-bridge.sh stop
}
#!/bin/sh
#if [ -z "$(ps aux | grep 'anbox session-manager' | grep -v grep)" ]; then
# anbox session-manager &
# sleep 5s
#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
#!/bin/sh
nmcli connection delete anbox-net
#!/bin/sh
nmcli connection add type bridge ifname anbox0 -- connection.id anbox-net ipv4.method shared ipv4.addresses 192.168.250.1/24
# Alternatively, we could use the anbox-bridge script
# that relies on iptables.
# https://github.com/anbox/anbox/blob/master/scripts/anbox-bridge.sh
# Sample conf.d file for alpine linux
#
# Specify daemon options here.
#
sample_opts=""
sample_user=""
[Desktop Entry]
Name=Anbox
GenericName=Android in a box
Version=1.0
Type=Application
Icon=anbox
TryExec=anbox
Exec=anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Terminal=false
#!/bin/sh
cat <<EOT
Anbox needs an adapted android image installed to /var/lib/anbox/android.img.
You can build one using the instructions here:
https://github.com/anbox/anbox/blob/master/docs/build-android.md.
Alternatively, you can use a prebuilt one by upstream:
https://build.anbox.io/android-images/
EOT
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ee5b98..8aaa3db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
project(anbox C CXX)
cmake_minimum_required(VERSION 2.8.2)
-include(CTest)
include(GNUInstallDirs)
if (NOT CMAKE_BUILD_TYPE)
@@ -91,8 +90,6 @@ IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
-find_package(GMock)
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fPIC")
set(ANBOX_TRANSLATOR_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/anbox/translators)
@@ -113,7 +110,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/config.h.in
add_subdirectory(external)
add_subdirectory(src)
-add_subdirectory(tests)
add_subdirectory(android)
if (NOT "${HOST_CMAKE_C_COMPILER}" STREQUAL "")
diff --git a/external/android-emugl/googletest.mk b/external/android-emugl/googletest.mk
deleted file mode 100644
index 9d8e5c0..0000000
--- a/external/android-emugl/googletest.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# This contains common definitions used to define a host module
-# to link GoogleTest with the EmuGL test programs.
-#
-# This is used instead of including external/gtest/Android.mk to
-# be able to build both the 32-bit and 64-bit binaries while
-# building a 32-bit only SDK (sdk-eng, sdk_x86-eng, sdk_mips-eng).
-
-
-LOCAL_PATH := $(EMULATOR_GTEST_SOURCES_DIR)
-
-common_SRC_FILES := \
- src/gtest-all.cc \
- src/gtest_main.cc
-
-common_CFLAGS := -O0
-
-ifneq (windows,$(BUILD_TARGET_OS))
- common_LDLIBS += -lpthread
-endif
-
-$(call emugl-begin-host-static-library,libemugl_gtest)
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_CFLAGS += $(common_CFLAGS)
-LOCAL_CPP_EXTENSION := .cc
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
-$(call emugl-export,LDLIBS,$(common_LDLIBS))
-$(call emugl-end-module)
-
-$(call emugl-begin-host-static-library,libemugl_gtest_host)
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_CFLAGS += $(common_CFLAGS)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
-LOCAL_CPP_EXTENSION := .cc
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
-$(call emugl-export,LDLIBS,$(common_LDLIBS) -lpthread)
-LOCAL_HOST_BUILD := true
-$(call emugl-end-module)
diff --git a/external/android-emugl/shared/emugl/common/CMakeLists.txt b/external/android-emugl/shared/emugl/common/CMakeLists.txt
index 09388c6..c4f659d 100644
--- a/external/android-emugl/shared/emugl/common/CMakeLists.txt
+++ b/external/android-emugl/shared/emugl/common/CMakeLists.txt
@@ -11,7 +11,6 @@ set(COMMON_SOURCES
message_channel.cpp
message_channel.h
mutex.h
- mutex_unittest.cpp
pod_vector.cpp
pod_vector.h
scoped_pointer_vector.h
@@ -25,7 +24,6 @@ set(COMMON_SOURCES
thread_pthread.cpp
thread_store.cpp
thread_store.h
- thread_unittest.cpp
unique_integer_map.h)
add_library(emugl_common STATIC ${COMMON_SOURCES})
--- a/src/anbox/cmds/system_info.cpp
+++ b/src/anbox/cmds/system_info.cpp
@@ -31,7 +31,9 @@
#include "OpenGLESDispatch/EGLDispatch.h"
#include "cpu_features_macros.h"
+#if defined(CPU_FEATURES_ARCH_X86)
#include "cpuinfo_x86.h"
+#endif
namespace fs = boost::filesystem;
--- a/src/anbox/cmds/check_features.cpp
+++ b/src/anbox/cmds/check_features.cpp
@@ -19,7 +19,9 @@
#include "anbox/utils.h"
#include "cpu_features_macros.h"
+#if defined(CPU_FEATURES_ARCH_X86)
#include "cpuinfo_x86.h"
+#endif
namespace {
std::vector<std::string> cpu_whitelist = {
Anbox tend not to leave enough time for Android to start.
This patch gives more breathing room.
--- a/src/anbox/cmds/launch.cpp
+++ a/src/anbox/cmds/launch.cpp
@@ -35,7 +35,7 @@ namespace fs = boost::filesystem;
namespace {
constexpr unsigned int max_session_mgr_wait_attempts{10};
-const std::chrono::seconds session_mgr_wait_interval{5};
+const std::chrono::seconds session_mgr_wait_interval{25};
constexpr unsigned int max_dbus_service_wait_attempts{10};
const std::chrono::seconds dbus_service_wait_interval{5};
diff --git a/external/process-cpp-minimal/include/core/posix/standard_stream.h b/external/process-cpp-minimal/include/core/posix/standard_stream.h
index f50a9b7..4a67a80 100644
--- a/external/process-cpp-minimal/include/core/posix/standard_stream.h
+++ b/external/process-cpp-minimal/include/core/posix/standard_stream.h
@@ -23,6 +23,10 @@
#include <cstdint>
+#undef stdin
+#undef stdout
+#undef stderr
+
namespace core
{
namespace posix
diff --git a/external/process-cpp-minimal/src/CMakeLists.txt b/external/process-cpp-minimal/src/CMakeLists.txt
index dec4659..20c9053 100644
--- a/external/process-cpp-minimal/src/CMakeLists.txt
+++ b/external/process-cpp-minimal/src/CMakeLists.txt
@@ -46,4 +46,5 @@ target_link_libraries(
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
+ execinfo
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment