diff --git a/.travis.yml b/.travis.yml index beefb791..2406e4b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ install: before_script: - if test "${COMMIT_MESSAGE#*'[publish]'}" != "$COMMIT_MESSAGE"; then echo "publishing" && export PUBLISH=true; else echo "not publishing"; fi; - + - if test "${MASON_PLATFORM}" == "ArmLinux"; then source osx/ArmLinux_setup.sh; fi; + script: - - source ./build.sh - - ${TARGET} + - $COMPILE_ENV ./wrapper.sh diff --git a/build.sh b/build.sh index 29850181..1587f5c8 100755 --- a/build.sh +++ b/build.sh @@ -58,7 +58,7 @@ function upgrade_gcc { fi echo "updating apt" sudo apt-get update -y - if [[ $(lsb_release --id) =~ "Ubuntu" ]]; then + if [[ $(lsb_release --id) =~ "Ubuntu" ]] || [[ $(lsb_release --id) =~ "Raspbian" ]]; then echo "installing C++11 compiler" sudo apt-get install -qq -y gcc-4.8 g++-4.8 export CC="gcc-4.8" @@ -91,6 +91,8 @@ function upgrade_clang { sudo apt-get install -y software-properties-common sudo add-apt-repository "deb http://llvm.org/apt/unstable/ llvm-toolchain-${CLANG_VERSION} main" fi + fi + if [[ $(lsb_release --id) =~ "Debian" ]] || [[ $(lsb_release --id) =~ "Raspbian" ]]; then echo "updating apt" sudo apt-get update -y echo 'upgrading libstdc++' diff --git a/osx/ArmLinux.sh b/osx/ArmLinux.sh new file mode 100644 index 00000000..48a6c99c --- /dev/null +++ b/osx/ArmLinux.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -u + +export MASON_PLATFORM="ArmLinux" +export HOST_PLATFORM="Linux" +export BOOST_ARCH="arm" +export ARCH_NAME="armv7" +export HOST_ARG="" +export CXX="g++" +export CC="gcc" +export MAKE="make" +# default to C++11 for this platform +if [[ "${CXX11:-false}" == false ]]; then + export CXX11=true +fi +source $(dirname "$BASH_SOURCE")/settings.sh diff --git a/osx/ArmLinux_fake_sudo.sh b/osx/ArmLinux_fake_sudo.sh new file mode 100755 index 00000000..d1a04c67 --- /dev/null +++ b/osx/ArmLinux_fake_sudo.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +$@ diff --git a/osx/ArmLinux_setup.sh b/osx/ArmLinux_setup.sh new file mode 100644 index 00000000..3d6719c0 --- /dev/null +++ b/osx/ArmLinux_setup.sh @@ -0,0 +1,23 @@ +CHROOT_BASE=. # This makes Travis CI environment easier + +MASON_PLATFORM=${MASON_PLATFORM-ArmLinux} +CXX11=${CXX11-true} +TARGET=${TARGET-build_mapnik} +QUIET=${QUIET-true} +MAPNIK_BRANCH=${MAPNIK_BRANCH-master} + +# select g++/gcc here because upgrade_(compiler) is called before platorm script +CXX=g++ +CC=gcc + +export COMPILE_ENV="sudo chroot $CHROOT_BASE /usr/bin/env MASON_PLATFORM=${MASON_PLATFORM} CXX11=${CXX11} TARGET=${TARGET} QUIET=${QUIET} MAPNIK_BRANCH=${MAPNIK_BRANCH} CXX=${CXX} CC=${CC}" + +# setup chroot/qemu +sudo apt-get install debootstrap qemu-user-static +sudo debootstrap --foreign --variant=minbase --arch armhf --include=locales testing `pwd`/$CHROOT_BASE http://mirrordirector.raspbian.org/raspbian +sudo cp /usr/bin/qemu-arm-static $CHROOT_BASE/usr/bin/ +sudo cp osx/ArmLinux_setup_stage2.sh $CHROOT_BASE/tmp/setup.sh +sudo cp osx/ArmLinux_fake_sudo.sh $CHROOT_BASE/usr/bin/sudo + +# enter chroot/qemu +$COMPILE_ENV /tmp/setup.sh diff --git a/osx/ArmLinux_setup_stage2.sh b/osx/ArmLinux_setup_stage2.sh new file mode 100755 index 00000000..2e8f690c --- /dev/null +++ b/osx/ArmLinux_setup_stage2.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +LANG=${LANG-'en_US.UTF-8'} + +# finish debootstrap process +./debootstrap/debootstrap --second-stage +export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true +cat <<'EOF' > /tmp/preseed.txt +locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8 +locales locales/default_environment_locale select en_US.UTF-8 +tzdata tzdata/Areas select US +tzdata tzdata/Zones/US select Central +EOF +debconf-set-selections /tmp/preseed.txt +export LANGUAGE=$LANG +export LANG=$LANG +export LC_ALL=$LANG +locale-gen $LANG +dpkg-reconfigure tzdata locales + +# set up apt-get +echo "deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi" > /etc/apt/sources.list + +apt-get update +apt-get install -q -y lsb-release wget + +# mount proc for 'free' +mount proc /proc -t proc diff --git a/osx/settings.sh b/osx/settings.sh index 69f5140c..4102d243 100644 --- a/osx/settings.sh +++ b/osx/settings.sh @@ -209,6 +209,24 @@ elif [[ ${MASON_PLATFORM} == 'Linaro-softfp' ]]; then fi export ZLIB_PATH="${SYSROOT}/usr" +elif [[ ${MASON_PLATFORM} == 'ArmLinux' ]]; then + export EXTRA_CFLAGS="" + export EXTRA_LDFLAGS="" + export EXTRA_CXXFLAGS="" + export EXTRA_CPPFLAGS="" + export CORE_CXX="g++" + export CORE_CC="gcc" + export ARCH_FLAGS="" + export STDLIB="libstdcpp" + export STDLIB_CXXFLAGS="" + export STDLIB_LDFLAGS="" + export CXX_VISIBILITY_FLAGS="" + if [[ "${CXX11}" == true ]]; then + export STDLIB="libstdcpp" + export STDLIB_CXXFLAGS="-std=c++11 -DBOOST_SPIRIT_USE_PHOENIX_V3=1" + export STDLIB_LDFLAGS="" + fi + export SDK_PATH="" elif [[ ${MASON_PLATFORM} == 'Android' ]]; then export CXX_VISIBILITY_FLAGS="" export alias ldconfig=true diff --git a/wrapper.sh b/wrapper.sh new file mode 100755 index 00000000..5e31a2a2 --- /dev/null +++ b/wrapper.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo "Initial environment:" +env + +echo "Sourcing build.sh for build functions ..." +source ./build.sh + +echo "Post-build.sh environment:" +env + +echo "Running '${TARGET}' as build target ..." +${TARGET}