diff --git a/CMakeLists.txt b/CMakeLists.txt index cb40de8..2f8de6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,3 +100,8 @@ add_subdirectory(external) add_subdirectory(src) add_subdirectory(tests) add_subdirectory(android) + +if (NOT "${HOST_CMAKE_C_COMPILER}" STREQUAL "") + message(STATUS "Host C compiler: ${HOST_CMAKE_C_COMPILER}") + message(STATUS "Host C compiler: ${HOST_CMAKE_CXX_COMPILER}") +endif() diff --git a/cmake/LinuxCrossCompile.cmake b/cmake/LinuxCrossCompile.cmake index d279424..956249d 100644 --- a/cmake/LinuxCrossCompile.cmake +++ b/cmake/LinuxCrossCompile.cmake @@ -10,6 +10,9 @@ if (NOT DEFINED AC_GCC_VARIANT) set(AC_GCC_VARIANT $ENV{AC_GCC_VARIANT} CACHE STRING "gcc variant required") endif() +set(HOST_CMAKE_C_COMPILER /usr/bin/cc) +set(HOST_CMAKE_CXX_COMPILER /usr/bin/c++) + set(CMAKE_C_COMPILER /usr/bin/${AC_TARGET_MACHINE}-gcc${AC_GCC_VARIANT}) set(CMAKE_CXX_COMPILER /usr/bin/${AC_TARGET_MACHINE}-g++${AC_GCC_VARIANT}) diff --git a/cross-compile-chroot.sh b/cross-compile-chroot.sh index 2dc8790..15f8e35 100755 --- a/cross-compile-chroot.sh +++ b/cross-compile-chroot.sh @@ -1,6 +1,21 @@ #!/bin/bash -# build script to compile anbox for armhf devices # +# Copyright © 2016 Canonical Ltd. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License version 3, +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# Taken from the Mir Project (https://launchpad.net/mir) + set -e usage() { @@ -135,7 +150,7 @@ echo "Target machine: ${target_machine}" if [ ${_do_update_chroot} -eq 1 ] ; then pushd scripts > /dev/null - ./setup-partial-armhf-chroot.sh -d ${dist} -a ${target_arch} ${additional_repositories} ${AC_NDK_PATH} + ./setup-partial-chroot.sh -d ${dist} -a ${target_arch} ${additional_repositories} ${AC_NDK_PATH} popd > /dev/null # force a clean build after an update, since CMake cache maybe out of date clean_build_dir ${BUILD_DIR} diff --git a/debian/control b/debian/control index 3604bf9..c754c38 100644 --- a/debian/control +++ b/debian/control @@ -14,6 +14,7 @@ Build-Depends: cmake, libboost-iostreams-dev, libboost-program-options-dev, libboost-system-dev, + libboost-test-dev, # boost log needs exactly one symbol from boost-thread for resolving # thread-specific storage locations. libboost-thread-dev, @@ -25,6 +26,8 @@ Build-Depends: cmake, libglib2.0-dev, libgtest-dev, libprotobuf-dev, + libsdl2-dev, + lxc-dev, pkg-config, protobuf-compiler Standards-Version: 3.9.4 @@ -37,13 +40,7 @@ Vcs-Browser: https://git.launchpad.net/anbox Package: anbox Architecture: i386 amd64 armhf arm64 Depends: ${misc:Depends}, - ${shlibs:Depends}, -# Provides newuidmap/newgidmap setuid helpers to initialize -# a user namespace. - uidmap, -# We depend on lxc-usernsexec as helper to spawn up the user -# namespace for our container. - lxc + ${shlibs:Depends} Description: Android in a Box Runtime for Android applications which runs a full Android system in a container using Linux namespaces (user, ipc, net, mount) to diff --git a/external/android-emugl/host/tools/emugen/CMakeLists.txt b/external/android-emugl/host/tools/emugen/CMakeLists.txt index dbdca59..8285126 100644 --- a/external/android-emugl/host/tools/emugen/CMakeLists.txt +++ b/external/android-emugl/host/tools/emugen/CMakeLists.txt @@ -1,3 +1,7 @@ +if (NOT "${HOST_CMAKE_CXX_COMPILER}" STREQUAL "") + set (CMAKE_CXX_COMPILER "${HOST_CMAKE_CXX_COMPILER}") +endif() + set(SOURCES ApiGen.cpp EntryPoint.cpp diff --git a/scripts/setup-partial-armhf-chroot.sh b/scripts/setup-partial-chroot.sh similarity index 79% rename from scripts/setup-partial-armhf-chroot.sh rename to scripts/setup-partial-chroot.sh index b298cf6..983a649 100755 --- a/scripts/setup-partial-armhf-chroot.sh +++ b/scripts/setup-partial-chroot.sh @@ -1,7 +1,20 @@ #!/bin/bash # -# TODO: Rename this file without "armhf" when it's safe to do so. +# Copyright © 2016 Canonical Ltd. # +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License version 3, +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# Taken from the Mir Project (https://launchpad.net/mir) set -e @@ -114,13 +127,25 @@ arch=${arch} directory=${directory} unpack=false noauth=true -bootstrap=Ubuntu ${sources} +bootstrap=Ubuntu UbuntuUpdates UbuntuSecurity ${sources} [Ubuntu] packages=${builddeps} source=${source_url} suite=${dist} components=main universe + +[UbuntuUpdates] +packages=${builddeps} +source=${source_url} +suite=${dist}-updates +components=main universe + +[UbuntuSecurity] +packages=${builddeps} +source=${source_url} +suite=${dist}-security +components=main universe " > mstrap.conf sourceid=0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c54501..461b906 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -196,8 +196,11 @@ add_library(anbox-core ${SOURCES}) target_link_libraries(anbox-core ${Boost_LDFLAGS} ${Boost_LIBRARIES} + ${DBUS_CPP_LDFLAGS} ${DBUS_CPP_LIBRARIES} + ${SDL2_LDFLAGS} ${SDL2_LIBRARIES} + ${LXC_LDFLAGS} ${LXC_LIBRARIES} pthread process-cpp