2
# build script to compile Aethercast for armhf devices
7
echo "usage: $(basename $0) [-a <arch>] [-c] [-h] [-d <dist>] [-u]"
8
echo " -a <arch> Specify target architecture (armhf/arm64/powerpc/ppc64el/amd64/i386/host)"
9
echo " -c Clean before building"
10
echo " -d <dist> Select the distribution to build for (vivid/wily/xenial)"
11
echo " -h This message"
12
echo " -u Update partial chroot directory"
20
# Default to a dist-agnostic directory name so as to not break Jenkins right now
21
BUILD_DIR=build-android-arm
22
NUM_JOBS=$(( $(grep -c ^processor /proc/cpuinfo) + 1 ))
25
# Default to vivid as we don't seem to have any working wily devices right now
32
while getopts "a:cd:hu" OPTNAME
54
echo "Parameter -${OPTARG} needs an argument"
59
echo "invalid option specified"
66
shift $((${OPTIND}-1))
68
if [ "${target_arch}" = "host" ]; then
69
target_arch=`dpkg-architecture -qDEB_HOST_ARCH`
72
if [ ${clean} -ne 0 ]; then
73
clean_build_dir ${BUILD_DIR}
76
if [ ${update_build_dir} -eq 1 ]; then
77
BUILD_DIR=build-${target_arch}-${dist}
80
if [ "${AC_NDK_PATH}" = "" ]; then
81
export AC_NDK_PATH=~/.cache/aethercast-${target_arch}-chroot-${dist}
84
if [ ! -d ${AC_NDK_PATH} ]; then
85
echo "no partial chroot dir detected. attempting to create one"
89
if [ ! -d ${BUILD_DIR} ]; then
93
echo "Building for distro: $dist"
94
echo "Using AC_NDK_PATH: ${AC_NDK_PATH}"
96
additional_repositories=
97
if [ ${dist} == "vivid" ] ; then
98
additional_repositories="-r http://ppa.launchpad.net/ci-train-ppa-service/stable-phone-overlay/ubuntu -r http://ppa.launchpad.net/ci-train-ppa-service/landing-000/ubuntu"
102
if [ "${dist}" = "vivid" ]; then
106
case ${target_arch} in
108
target_machine=arm-linux-gnueabihf
111
target_machine=x86_64-linux-gnu
114
target_machine=i386-linux-gnu
117
target_machine=aarch64-linux-gnu
120
target_machine=powerpc64le-linux-gnu
123
target_machine=powerpc-linux-gnu
126
# A good guess (assuming you have dpkg-architecture)
127
target_machine=`dpkg-architecture -A${target_arch} -qDEB_HOST_MULTIARCH` || {
128
echo "Unknown architecture ${target_arch}"
135
echo "Target architecture: ${target_arch}"
136
echo "Target machine: ${target_machine}"
138
if [ ${_do_update_chroot} -eq 1 ] ; then
139
pushd scripts > /dev/null
140
./setup-partial-armhf-chroot.sh -d ${dist} -a ${target_arch} ${additional_repositories} ${AC_NDK_PATH}
142
# force a clean build after an update, since CMake cache maybe out of date
143
clean_build_dir ${BUILD_DIR}
146
pushd ${BUILD_DIR} > /dev/null
148
export PKG_CONFIG_PATH="${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${target_machine}/pkgconfig"
149
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
150
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
151
export PKG_CONFIG_SYSROOT_DIR=$AC_NDK_PATH
152
export PKG_CONFIG_EXECUTABLE=`which pkg-config`
153
export AC_TARGET_MACHINE=${target_machine}
154
export AC_GCC_VARIANT=${gcc_variant}
155
echo "Using PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
156
echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE"
157
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \
160
make -j${NUM_JOBS} $@