BUILD: factor out Android environment setting

This commit is contained in:
Dries Harnie 2019-07-08 08:40:39 +02:00
parent 2981b3ce34
commit daa47787ee
5 changed files with 36 additions and 9 deletions

View File

@ -106,7 +106,7 @@ matrix:
- mkdir -p $ANDROID_HOME/licenses
- echo -e "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license
install: &android-install
- echo y | sdkmanager ndk-bundle >/dev/null 2>&1
- echo y | $ANDROID_HOME/tools/bin/sdkmanager ndk-bundle >/dev/null 2>&1
- ./.travis/build-android-deps.sh
before_cache: &android-before-cache
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

7
.travis/android-build Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
set -e
here=$(dirname "$0")
. "$here"/android-set-environment
./configure --enable-all-engines --enable-static --enable-opengl-shaders --with-jpeg-prefix=dependencies --with-freetype2-prefix=dependencies --host=${ANDROID_TARGET}
make -j4 libresidualvm.so
TERM=dumb make androidrelease

View File

@ -1,6 +1,6 @@
#!/bin/sh
root=$TRAVIS_BUILD_DIR/dependencies
root=$(realpath $(dirname $0)/..)
for flag in "$@"; do
case "$flag" in

View File

@ -0,0 +1,17 @@
#!/bin/sh
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
export ANDROID_LEVEL=${ANDROID_LEVEL:-26}
if [ "$CROSS_HOST" = "armv7a-linux-androideabi" ]; then
export AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
export RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
else
export AR=$TOOLCHAIN/bin/${CROSS_HOST}-ar
export RANLIB=$TOOLCHAIN/bin/${CROSS_HOST}-ranlib
fi
export AS=$TOOLCHAIN/bin/${CROSS_HOST}-as
export CC=$TOOLCHAIN/bin/${CROSS_HOST}${ANDROID_LEVEL}-clang
export CXX=$TOOLCHAIN/bin/${CROSS_HOST}${ANDROID_LEVEL}-clang++
export LD=$TOOLCHAIN/bin/${CROSS_HOST}-ld
export STRIP=$TOOLCHAIN/bin/${CROSS_HOST}-strip
export PATH=$TOOLCHAIN/bin:$ANDROID_NDK:$PATH
export CXXFLAGS=-Wno-inconsistent-missing-override

View File

@ -7,22 +7,25 @@ if [ -e dependencies/.done ] ; then
exit 0;
fi
mkdir -p dependencies
prefix=$(pwd)/dependencies
dot_travis=$(dirname "$0")
. "$dot_travis"/android-set-environment
echo ">>> Building libjpeg-turbo"
prefix=$(pwd)/dependencies/
mkdir -p $prefix
echo ">>> Building libjpeg-turbo for $CROSS_HOST"
git clone --depth 1 -b pie-release https://android.googlesource.com/platform/external/libjpeg-turbo
pushd libjpeg-turbo
autoreconf -fiv
./configure --host=$CROSS_HOST --prefix=$prefix --with-sysroot=$ANDROID_NDK/sysroot && make -j4 install
./configure --host=$CROSS_HOST --prefix=$prefix --without-turbojpeg --disable-shared && make -j4 install || false
popd
echo ">>> Building freetype"
echo ">>> Building freetype for $CROSS_HOST"
git clone --depth 1 -b pie-release https://android.googlesource.com/platform/external/freetype
pushd freetype
sh autogen.sh
./configure --host=$CROSS_HOST --with-harfbuzz=no --with-bzip2=no --with-png=no --prefix=$prefix --with-sysroot=$ANDROID_NDK/sysroot && make -j4 install
./configure --host=$CROSS_HOST --with-harfbuzz=no --with-bzip2=no --with-png=no --prefix=$prefix --disable-shared && make -j4 install || false
popd
cp -p .travis/android-freetype-config dependencies/bin/freetype-config
cp -p .travis/android-freetype-config $prefix/bin/freetype-config
touch dependencies/.done