Merge pull request #32 from morphis/feature/improve-cross-build-setup

Improve cross-build setup
This commit is contained in:
Simon Fels 2017-01-29 14:52:47 +01:00 committed by GitHub
commit 32478856ee
7 changed files with 63 additions and 11 deletions

View file

@ -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()

View file

@ -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})

View file

@ -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 <http://www.gnu.org/licenses/>.
#
# 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}

11
debian/control vendored
View file

@ -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

View file

@ -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

View file

@ -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 <http://www.gnu.org/licenses/>.
#
# 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

View file

@ -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