From 1755b5190721e6fe87a40971bc869f7a68ac7169 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 31 Aug 2020 14:13:15 -0700 Subject: anbox: Add recipe anbox lets run android in a box on linux Signed-off-by: Khem Raj --- .../anbox/0001-Disable-warnings-as-errors.patch | 33 +++++++++++++++++ ...itonally-use-native-sdbus-c-xml2cpp-for-x.patch | 28 +++++++++++++++ ...mugen-Sett-cmake-C-C-flags-to-host-cflags.patch | 26 ++++++++++++++ .../anbox/0004-Use-python3-during-build.patch | 20 +++++++++++ ...ine-sec-usec-based-on-platform-wordlength.patch | 30 ++++++++++++++++ ...06-Do-not-mark-includes-as-const-function.patch | 26 ++++++++++++++ .../anbox/0007-disable-tests-in-xdg-module.patch | 20 +++++++++++ ...ugl-Respect-flags-passed-from-environment.patch | 24 +++++++++++++ meta-oe/recipes-extended/anbox/anbox_git.bb | 42 ++++++++++++++++++++++ 9 files changed, 249 insertions(+) create mode 100644 meta-oe/recipes-extended/anbox/anbox/0001-Disable-warnings-as-errors.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0002-cmake-Condiitonally-use-native-sdbus-c-xml2cpp-for-x.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0003-emugen-Sett-cmake-C-C-flags-to-host-cflags.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0004-Use-python3-during-build.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0005-define-sec-usec-based-on-platform-wordlength.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0006-Do-not-mark-includes-as-const-function.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0007-disable-tests-in-xdg-module.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox/0008-android-emugl-Respect-flags-passed-from-environment.patch create mode 100644 meta-oe/recipes-extended/anbox/anbox_git.bb diff --git a/meta-oe/recipes-extended/anbox/anbox/0001-Disable-warnings-as-errors.patch b/meta-oe/recipes-extended/anbox/anbox/0001-Disable-warnings-as-errors.patch new file mode 100644 index 0000000000..1d3aa20049 --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0001-Disable-warnings-as-errors.patch @@ -0,0 +1,33 @@ +From aece5874f38bba0e45c85982611182a2424f6787 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:03:10 -0700 +Subject: [PATCH] Disable warnings as errors + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 713df49..9247eda 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,7 +39,7 @@ endif() + string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) + + if ("${cmake_build_type_lower}" STREQUAL "release" OR "${cmake_build_type_lower}" STREQUAL "relwithdebinfo") +- option(Werror "Treat warnings as errors" ON) ++ option(Werror "Treat warnings as errors" OFF) + else() + option(Werror "Treat warnings as errors" OFF) + endif() +@@ -136,7 +136,7 @@ set(ANBOX_STATEDIR_FULL "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/anbox") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/config.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/config.h) + +-add_subdirectory(external) ++add_subdirectory(external EXCLUDE_FROM_ALL) + add_subdirectory(src) + add_subdirectory(tests) + add_subdirectory(android) diff --git a/meta-oe/recipes-extended/anbox/anbox/0002-cmake-Condiitonally-use-native-sdbus-c-xml2cpp-for-x.patch b/meta-oe/recipes-extended/anbox/anbox/0002-cmake-Condiitonally-use-native-sdbus-c-xml2cpp-for-x.patch new file mode 100644 index 0000000000..b0910f325b --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0002-cmake-Condiitonally-use-native-sdbus-c-xml2cpp-for-x.patch @@ -0,0 +1,28 @@ +From 8cf0e87e4d810b0e910f1990a393b650d80931f7 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:04:00 -0700 +Subject: [PATCH] cmake: Condiitonally use native sdbus-c++-xml2cpp for xml2cpp + +This helps us define XML2CPP in yocto cross build env + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + src/CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index b40b7cc..686d4a3 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -59,7 +59,9 @@ 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) ++if ("${XML2CPP}" STREQUAL "") ++ set(XML2CPP ${CMAKE_BINARY_DIR}/external/sdbus-cpp/src/sdbus-cpp-build/tools/sdbus-c++-xml2cpp) ++endif() + + macro(DBusServer BaseName) + add_custom_command( diff --git a/meta-oe/recipes-extended/anbox/anbox/0003-emugen-Sett-cmake-C-C-flags-to-host-cflags.patch b/meta-oe/recipes-extended/anbox/anbox/0003-emugen-Sett-cmake-C-C-flags-to-host-cflags.patch new file mode 100644 index 0000000000..c9c6e5ef7e --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0003-emugen-Sett-cmake-C-C-flags-to-host-cflags.patch @@ -0,0 +1,26 @@ +From af0369f74181aa150cf304486f97d3b842aadf50 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:05:39 -0700 +Subject: [PATCH] emugen: Sett cmake C/C++ flags to host cflags + +This ensures that it does not use cross flags when building it for build +host + +Signed-off-by: Khem Raj +--- + external/android-emugl/host/tools/emugen/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/external/android-emugl/host/tools/emugen/CMakeLists.txt b/external/android-emugl/host/tools/emugen/CMakeLists.txt +index 8285126..83b8242 100644 +--- a/external/android-emugl/host/tools/emugen/CMakeLists.txt ++++ b/external/android-emugl/host/tools/emugen/CMakeLists.txt +@@ -1,5 +1,8 @@ + if (NOT "${HOST_CMAKE_CXX_COMPILER}" STREQUAL "") + set (CMAKE_CXX_COMPILER "${HOST_CMAKE_CXX_COMPILER}") ++ set(CMAKE_C_FLAGS "${HOST_CMAKE_C_FLAGS} -Wall") ++ set(CMAKE_CXX_FLAGS "${HOST_CMAKE_CXX_FLAGS} -std=c++11 -Wall") ++ set(CMAKE_CXX_LINK_FLAGS "${HOST_CMAKE_CXX_LINK_FLAGS}") + endif() + + set(SOURCES diff --git a/meta-oe/recipes-extended/anbox/anbox/0004-Use-python3-during-build.patch b/meta-oe/recipes-extended/anbox/anbox/0004-Use-python3-during-build.patch new file mode 100644 index 0000000000..24c489a9ff --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0004-Use-python3-during-build.patch @@ -0,0 +1,20 @@ +From 571ececa39711537d27bef46e5eb835b980aada2 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:06:32 -0700 +Subject: [PATCH] Use python3 during build + +Signed-off-by: Khem Raj +--- + scripts/gen-emugl-entries.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/gen-emugl-entries.py b/scripts/gen-emugl-entries.py +index b88137e..73ede51 100755 +--- a/scripts/gen-emugl-entries.py ++++ b/scripts/gen-emugl-entries.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + + # Copyright 2015 The Android Open Source Project + # diff --git a/meta-oe/recipes-extended/anbox/anbox/0005-define-sec-usec-based-on-platform-wordlength.patch b/meta-oe/recipes-extended/anbox/anbox/0005-define-sec-usec-based-on-platform-wordlength.patch new file mode 100644 index 0000000000..2611024089 --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0005-define-sec-usec-based-on-platform-wordlength.patch @@ -0,0 +1,30 @@ +From 91b643a9fd57d994ee8e5b25b2c8a4a81a973a00 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:07:21 -0700 +Subject: [PATCH] define sec/usec based on platform wordlength + +helps it compile and run on 32-bit arm + +Signed-off-by: Khem Raj +--- + src/anbox/input/device.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/anbox/input/device.cpp b/src/anbox/input/device.cpp +index 9efd347..43de9bb 100644 +--- a/src/anbox/input/device.cpp ++++ b/src/anbox/input/device.cpp +@@ -59,8 +59,13 @@ void Device::send_events(const std::vector &events) { + // NOTE: A bit dirty but as we're running currently a 64 bit container + // struct input_event has a different size. We rebuild the struct here + // to reach the correct size. ++#ifdef __LP64__ + std::uint64_t sec; + std::uint64_t usec; ++#else ++ std::uint32_t sec; ++ std::uint32_t usec; ++#endif + std::uint16_t type; + std::uint16_t code; + std::uint32_t value; diff --git a/meta-oe/recipes-extended/anbox/anbox/0006-Do-not-mark-includes-as-const-function.patch b/meta-oe/recipes-extended/anbox/anbox/0006-Do-not-mark-includes-as-const-function.patch new file mode 100644 index 0000000000..e6f9bd5bf5 --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0006-Do-not-mark-includes-as-const-function.patch @@ -0,0 +1,26 @@ +From e8509e9b6afbe95b32be643ca4722b8e41ff1d7a Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:08:09 -0700 +Subject: [PATCH] Do not mark includes as const function + +This uses unique_lock which could alter mutex variable +hence the function can not be const + +Signed-off-by: Khem Raj +--- + src/anbox/network/connections.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/anbox/network/connections.h b/src/anbox/network/connections.h +index f206a91..eb04726 100644 +--- a/src/anbox/network/connections.h ++++ b/src/anbox/network/connections.h +@@ -41,7 +41,7 @@ class Connections { + connections.erase(id); + } + +- bool includes(int id) const { ++ bool includes(int id) { + std::unique_lock lock(mutex); + return connections.find(id) != connections.end(); + } diff --git a/meta-oe/recipes-extended/anbox/anbox/0007-disable-tests-in-xdg-module.patch b/meta-oe/recipes-extended/anbox/anbox/0007-disable-tests-in-xdg-module.patch new file mode 100644 index 0000000000..b493a841ed --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0007-disable-tests-in-xdg-module.patch @@ -0,0 +1,20 @@ +From f0673d9c2168f94662da57ecf7b80eade4e35296 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:09:05 -0700 +Subject: [PATCH] disable tests in xdg module + +Signed-off-by: Khem Raj +--- + external/xdg/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/external/xdg/CMakeLists.txt b/external/xdg/CMakeLists.txt +index 249da48..8ad4f1d 100644 +--- a/external/xdg/CMakeLists.txt ++++ b/external/xdg/CMakeLists.txt +@@ -21,4 +21,4 @@ add_executable(xdg_test xdg_test.cpp) + set_property(TARGET xdg_test PROPERTY CXX_STANDARD 11) + target_link_libraries(xdg_test xdg ${Boost_LIBRARIES}) + +-add_test(xdg_test xdg_test) ++#add_test(xdg_test xdg_test) diff --git a/meta-oe/recipes-extended/anbox/anbox/0008-android-emugl-Respect-flags-passed-from-environment.patch b/meta-oe/recipes-extended/anbox/anbox/0008-android-emugl-Respect-flags-passed-from-environment.patch new file mode 100644 index 0000000000..d1704996c0 --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox/0008-android-emugl-Respect-flags-passed-from-environment.patch @@ -0,0 +1,24 @@ +From 072fdf9664dc0a2b302b9954e7cfcf7a3e3562d1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 31 Aug 2020 14:09:17 -0700 +Subject: [PATCH] android-emugl: Respect flags passed from environment + +Signed-off-by: Khem Raj +--- + external/android-emugl/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/external/android-emugl/CMakeLists.txt b/external/android-emugl/CMakeLists.txt +index 23173b3..f2e1c43 100644 +--- a/external/android-emugl/CMakeLists.txt ++++ b/external/android-emugl/CMakeLists.txt +@@ -1,7 +1,7 @@ + # Don't treat any warnings as error as we take the source directly from + # upstream and just compile it. +-set(CMAKE_C_FLAGS "-Wall") +-set(CMAKE_CXX_FLAGS "-std=c++11 -Wall") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") + + # Ensure -fPIC + set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/meta-oe/recipes-extended/anbox/anbox_git.bb b/meta-oe/recipes-extended/anbox/anbox_git.bb new file mode 100644 index 0000000000..7a8bc0841f --- /dev/null +++ b/meta-oe/recipes-extended/anbox/anbox_git.bb @@ -0,0 +1,42 @@ +LICENSE = "GPLv3 & Apache-2.0 & LGPLv2.1 & LGPLv3 & MIT" +LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=f27defe1e96c2e1ecd4e0c9be8967949 \ + file://android/audio/MODULE_LICENSE_APACHE2;md5=d41d8cd98f00b204e9800998ecf8427e \ + file://external/sdbus-cpp/COPYING;md5=1803fa9c2c3ce8cb06b4861d75310742 \ + file://external/sdbus-cpp/tools/COPYING;md5=1803fa9c2c3ce8cb06b4861d75310742 \ + file://external/xdg/LICENSE;md5=959bffe2993816eb32ec4bc1ec1d5875 \ + file://external/backward-cpp/LICENSE.txt;md5=74ea9734864a5514a5d672f385e3b382 \ + file://external/cpu_features/LICENSE;md5=175792518e4ac015ab6696d16c4f607e \ + file://external/process-cpp-minimal/COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = "gitsm://github.com/anbox/anbox;protocol=https \ + file://0001-Disable-warnings-as-errors.patch \ + file://0002-cmake-Condiitonally-use-native-sdbus-c-xml2cpp-for-x.patch \ + file://0003-emugen-Sett-cmake-C-C-flags-to-host-cflags.patch \ + file://0004-Use-python3-during-build.patch \ + file://0005-define-sec-usec-based-on-platform-wordlength.patch \ + file://0006-Do-not-mark-includes-as-const-function.patch \ + file://0007-disable-tests-in-xdg-module.patch \ + file://0008-android-emugl-Respect-flags-passed-from-environment.patch \ + " + +PV = "1.0+git${SRCPV}" +SRCREV = "c1e75506bad0c479c8591970ce422aa8646654ac" + +S = "${WORKDIR}/git" + +DEPENDS = "virtual/egl virtual/libgles2 virtual/libsdl2 \ + libsdl2-image boost protobuf elfutils gmock gtest lxc glm \ + properties-cpp sdbus-c++ libcap \ + sdbus-c++-tools-native protobuf-c-native" + +PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)}" + +PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND=ON,-DENABLE_WAYLAND=OFF,wayland" + +inherit cmake pkgconfig features_check systemd + +REQUIRED_DISTRO_FEATURES += "opengl" + +EXTRA_OECMAKE = "-DHOST_CMAKE_CXX_COMPILER='${BUILD_CXX}' -DHOST_CMAKE_CXX_FLAGS='${BUILD_CXXFLAGS}' -DXML2CPP=sdbus-c++-xml2cpp" + +RDEPENDS_${PN} += "libgles2" -- cgit 1.2.3-korg