2015-03-09 19:28:54 +00:00
|
|
|
#!/bin/bash
|
2017-01-02 12:46:51 +00:00
|
|
|
#
|
|
|
|
# Filesystem layout considerations...
|
|
|
|
# for this explanation I assume that your Subsurface sources are in
|
|
|
|
# ~/src/subsurface
|
|
|
|
#
|
|
|
|
# You need to have a version of Qt that contains the Android bits
|
|
|
|
# installed. You should be able to find the correct installer for
|
|
|
|
# Linux or Mac here:
|
|
|
|
# http://download.qt.io/official_releases/qt/5.7/
|
|
|
|
# make sure you pick one with 'android' in its name.
|
|
|
|
#
|
|
|
|
# Install this wherever you want - and then have a link named ~/src/Qt that
|
|
|
|
# points to it.
|
|
|
|
# So let's assume that you are installing the package above in ~/Qt5.7.1
|
|
|
|
# (which I think is the default location), then simply do
|
|
|
|
# cd ~/src
|
|
|
|
# ln -s ~/Qt5.7.1 Qt
|
|
|
|
#
|
|
|
|
# you also need to have the current Android SDK and NDK installed under ~/src
|
|
|
|
#
|
2015-03-09 19:28:54 +00:00
|
|
|
set -e
|
2015-07-20 09:13:00 +00:00
|
|
|
PLATFORM=$(uname)
|
2015-07-08 22:42:09 +00:00
|
|
|
# (trick to get the absolute path, either if we're called with a
|
|
|
|
# absolute path or a relative path)
|
2017-01-03 08:00:52 +00:00
|
|
|
pushd "$(dirname "$0")/../../"
|
2015-07-08 22:42:09 +00:00
|
|
|
export SUBSURFACE_SOURCE=$PWD
|
|
|
|
popd
|
2015-12-24 17:41:39 +00:00
|
|
|
|
|
|
|
# is this a release or debug build
|
|
|
|
BUILD_TYPE=Debug
|
|
|
|
if [ "$1" = "release" ] || [ "$1" = "Release" ] ; then
|
|
|
|
shift
|
|
|
|
BUILD_TYPE=Release
|
|
|
|
fi
|
|
|
|
if [ "$1" = "debug" ] || [ "$1" = "Debug" ] ; then
|
|
|
|
# this is the default - still need to eat the argument if given
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2016-03-06 05:23:27 +00:00
|
|
|
if [ "$1" = "-buildnr" ] ; then
|
|
|
|
shift
|
|
|
|
BUILD_NR="\"$1\""
|
|
|
|
shift
|
2016-04-12 14:56:26 +00:00
|
|
|
else
|
|
|
|
BUILD_NR="\"0\""
|
2016-03-06 05:23:27 +00:00
|
|
|
fi
|
|
|
|
|
2015-03-09 19:28:54 +00:00
|
|
|
# Configure where we can find things here
|
2016-12-28 22:22:32 +00:00
|
|
|
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT-$SUBSURFACE_SOURCE/../android-ndk-r13b}
|
2016-03-03 22:32:23 +00:00
|
|
|
|
2016-06-23 20:56:31 +00:00
|
|
|
if [ ! -z "$QT5_ANDROID" ] ; then
|
|
|
|
echo "Using Qt5 in $QT5_ANDROID"
|
2016-06-22 20:25:26 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.7" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.7
|
2016-06-23 20:56:31 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.6" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.6
|
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.5" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.5
|
2016-03-03 22:32:23 +00:00
|
|
|
else
|
2016-06-23 20:56:31 +00:00
|
|
|
echo "Cannot find Qt 5.7, 5.6 or 5.5 under $SUBSURFACE_SOURCE/../Qt"
|
2016-03-03 22:32:23 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ "$PLATFORM" = "Darwin" ] ; then
|
2017-01-03 08:05:04 +00:00
|
|
|
export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT-$SUBSURFACE_SOURCE/../android-sdk-macosx}
|
|
|
|
export ANDROID_NDK_HOST=darwin-x86_64
|
2015-07-20 09:13:00 +00:00
|
|
|
else
|
2017-01-03 08:05:04 +00:00
|
|
|
export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT-$SUBSURFACE_SOURCE/../android-sdk-linux}
|
|
|
|
export ANDROID_NDK_HOST=linux-x86
|
2015-07-20 09:13:00 +00:00
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
|
|
|
# Which versions are we building against?
|
2016-06-23 20:56:37 +00:00
|
|
|
SQLITE_VERSION=3130000
|
|
|
|
LIBXML2_VERSION=2.9.4
|
|
|
|
LIBXSLT_VERSION=1.1.29
|
|
|
|
LIBZIP_VERSION=1.1.3
|
|
|
|
LIBGIT2_VERSION=0.24.1
|
|
|
|
LIBUSB_VERSION=1.0.20
|
|
|
|
OPENSSL_VERSION=1.0.2h
|
|
|
|
LIBFTDI_VERSION=1.3
|
2015-03-09 19:28:54 +00:00
|
|
|
|
|
|
|
# arm or x86
|
2015-12-24 17:49:05 +00:00
|
|
|
if [ "$1" = "arm" ] || [ "$1" = "x86" ] ; then
|
|
|
|
export ARCH=$1
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
export ARCH=arm
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
|
|
|
if [ "$ARCH" = "arm" ] ; then
|
|
|
|
QT_ARCH="armv7"
|
|
|
|
BUILDCHAIN=arm-linux-androideabi
|
2015-07-15 22:59:32 +00:00
|
|
|
OPENSSL_MACHINE="armv7"
|
2015-03-09 19:28:54 +00:00
|
|
|
elif [ "$ARCH" = "x86" ] ; then
|
|
|
|
QT_ARCH=$ARCH
|
|
|
|
BUILDCHAIN=i686-linux-android
|
2015-07-15 22:59:32 +00:00
|
|
|
OPENSSL_MACHINE="i686"
|
2015-03-09 19:28:54 +00:00
|
|
|
fi
|
|
|
|
export QT5_ANDROID_BIN=${QT5_ANDROID}/android_${QT_ARCH}/bin
|
|
|
|
|
|
|
|
if [ ! -e ndk-$ARCH ] ; then
|
2017-01-03 08:00:52 +00:00
|
|
|
"$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch=$ARCH --install-dir=ndk-$ARCH --api=16
|
2015-03-09 19:28:54 +00:00
|
|
|
fi
|
|
|
|
export BUILDROOT=$PWD
|
|
|
|
export PATH=${BUILDROOT}/ndk-$ARCH/bin:$PATH
|
|
|
|
export PREFIX=${BUILDROOT}/ndk-$ARCH/sysroot/usr
|
2017-01-03 08:00:52 +00:00
|
|
|
export PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig
|
2015-07-01 15:08:37 +00:00
|
|
|
export CC=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-gcc
|
|
|
|
export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-g++
|
2015-07-15 17:32:48 +00:00
|
|
|
# autoconf seems to get lost without this
|
|
|
|
export SYSROOT=${BUILDROOT}/ndk-$ARCH/sysroot
|
|
|
|
export CFLAGS="--sysroot=${SYSROOT}"
|
|
|
|
export CPPFLAGS="--sysroot=${SYSROOT}"
|
|
|
|
export CXXFLAGS="--sysroot=${SYSROOT}"
|
2015-07-08 22:42:12 +00:00
|
|
|
# Junk needed for qt-android-cmake
|
|
|
|
export ANDROID_STANDALONE_TOOLCHAIN=${BUILDROOT}/ndk-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ "$PLATFORM" = "Darwin" ] ; then
|
2015-07-20 09:13:00 +00:00
|
|
|
JAVA_HOME=$(/usr/libexec/java_home)
|
|
|
|
export JAVA_HOME
|
|
|
|
else
|
|
|
|
export JAVA_HOME=/usr
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
|
|
|
if [ ! -e sqlite-autoconf-${SQLITE_VERSION}.tar.gz ] ; then
|
2016-06-23 20:56:37 +00:00
|
|
|
wget http://www.sqlite.org/2016/sqlite-autoconf-${SQLITE_VERSION}.tar.gz
|
2015-03-09 19:28:54 +00:00
|
|
|
fi
|
|
|
|
if [ ! -e sqlite-autoconf-${SQLITE_VERSION} ] ; then
|
|
|
|
tar -zxf sqlite-autoconf-${SQLITE_VERSION}.tar.gz
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/sqlite3.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p sqlite-build-$ARCH
|
|
|
|
pushd sqlite-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
../sqlite-autoconf-${SQLITE_VERSION}/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared
|
2015-07-08 22:42:10 +00:00
|
|
|
make
|
2015-03-09 19:28:54 +00:00
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e libxml2-${LIBXML2_VERSION}.tar.gz ] ; then
|
|
|
|
wget ftp://xmlsoft.org/libxml2/libxml2-${LIBXML2_VERSION}.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -e libxml2-${LIBXML2_VERSION} ] ; then
|
|
|
|
tar -zxf libxml2-${LIBXML2_VERSION}.tar.gz
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libxml-2.0.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p libxml2-build-$ARCH
|
|
|
|
pushd libxml2-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
../libxml2-${LIBXML2_VERSION}/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --without-python --without-iconv --enable-static --disable-shared
|
2015-03-09 19:28:54 +00:00
|
|
|
perl -pi -e 's/runtest\$\(EXEEXT\)//' Makefile
|
|
|
|
perl -pi -e 's/testrecurse\$\(EXEEXT\)//' Makefile
|
2015-07-08 22:42:10 +00:00
|
|
|
make
|
2015-03-09 19:28:54 +00:00
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e libxslt-${LIBXSLT_VERSION}.tar.gz ] ; then
|
|
|
|
wget ftp://xmlsoft.org/libxml2/libxslt-${LIBXSLT_VERSION}.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -e libxslt-${LIBXSLT_VERSION} ] ; then
|
|
|
|
tar -zxf libxslt-${LIBXSLT_VERSION}.tar.gz
|
|
|
|
# libxslt have too old config.sub for android
|
|
|
|
cp libxml2-${LIBXML2_VERSION}/config.sub libxslt-${LIBXSLT_VERSION}
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libxslt.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p libxslt-build-$ARCH
|
|
|
|
pushd libxslt-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
../libxslt-${LIBXSLT_VERSION}/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --with-libxml-prefix="$PREFIX" --without-python --without-crypto --enable-static --disable-shared
|
2015-03-09 19:28:54 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e libzip-${LIBZIP_VERSION}.tar.gz ] ; then
|
|
|
|
wget http://www.nih.at/libzip/libzip-${LIBZIP_VERSION}.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -e libzip-${LIBZIP_VERSION} ] ; then
|
|
|
|
tar -zxf libzip-${LIBZIP_VERSION}.tar.gz
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libzip.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p libzip-build-$ARCH
|
|
|
|
pushd libzip-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
../libzip-${LIBZIP_VERSION}/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared
|
2015-03-09 19:28:54 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2015-07-13 21:25:31 +00:00
|
|
|
if [ ! -e openssl-${OPENSSL_VERSION}.tar.gz ] ; then
|
|
|
|
wget -O openssl-${OPENSSL_VERSION}.tar.gz http://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -e openssl-build-$ARCH ] ; then
|
|
|
|
tar -zxf openssl-${OPENSSL_VERSION}.tar.gz
|
|
|
|
mv openssl-${OPENSSL_VERSION} openssl-build-$ARCH
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libssl.pc" ] ; then
|
2015-07-13 21:25:31 +00:00
|
|
|
pushd openssl-build-$ARCH
|
|
|
|
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
|
2015-07-15 22:59:32 +00:00
|
|
|
# Use env to make all these temporary, so they don't pollute later builds.
|
|
|
|
env SYSTEM=android \
|
|
|
|
CROSS_COMPILE="${BUILDCHAIN}-" \
|
|
|
|
MACHINE=$OPENSSL_MACHINE \
|
|
|
|
HOSTCC=gcc \
|
|
|
|
CC=gcc \
|
2017-01-03 08:00:52 +00:00
|
|
|
ANDROID_DEV="$PREFIX" \
|
|
|
|
bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir="$PREFIX"
|
2016-08-29 02:14:06 +00:00
|
|
|
# sed -i.bak -e 's/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB/g' Makefile.shared
|
2015-07-13 21:25:31 +00:00
|
|
|
make depend
|
|
|
|
make
|
2016-04-20 18:45:28 +00:00
|
|
|
make install_sw
|
2015-07-13 21:25:31 +00:00
|
|
|
popd
|
|
|
|
fi
|
2015-07-15 22:59:35 +00:00
|
|
|
|
2015-03-09 19:28:54 +00:00
|
|
|
if [ ! -e libgit2-${LIBGIT2_VERSION}.tar.gz ] ; then
|
|
|
|
wget -O libgit2-${LIBGIT2_VERSION}.tar.gz https://github.com/libgit2/libgit2/archive/v${LIBGIT2_VERSION}.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -e libgit2-${LIBGIT2_VERSION} ] ; then
|
|
|
|
tar -zxf libgit2-${LIBGIT2_VERSION}.tar.gz
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libgit2.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p libgit2-build-$ARCH
|
|
|
|
pushd libgit2-build-$ARCH
|
2015-07-13 21:25:31 +00:00
|
|
|
cmake -DCMAKE_SYSTEM_NAME=Android -DSHA1_TYPE=builtin \
|
|
|
|
-DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=OFF \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
2015-07-13 21:25:31 +00:00
|
|
|
-DCURL=OFF \
|
2016-08-29 02:14:06 +00:00
|
|
|
-DUSE_SSH=OFF \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DOPENSSL_SSL_LIBRARY="$PREFIX"/lib/libssl.so \
|
|
|
|
-DOPENSSL_CRYPTO_LIBRARY="$PREFIX"/lib/libcrypto.so \
|
|
|
|
-DOPENSSL_INCLUDE_DIR="$PREFIX"/include/openssl \
|
2015-07-13 21:25:31 +00:00
|
|
|
-D_OPENSSL_VERSION=1.0.1p \
|
|
|
|
../libgit2-${LIBGIT2_VERSION}/
|
2015-03-09 19:28:54 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
# Patch away pkg-config dependency to zlib, its there, i promise
|
2017-01-03 08:00:52 +00:00
|
|
|
perl -pi -e 's/^(Requires.private:.*)zlib(.*)$/$1 $2/' "$PKG_CONFIG_LIBDIR"/libgit2.pc
|
2015-03-09 19:28:54 +00:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e libusb-${LIBUSB_VERSION}.tar.gz ] ; then
|
|
|
|
wget -O libusb-${LIBUSB_VERSION}.tar.gz https://github.com/libusb/libusb/archive/v${LIBUSB_VERSION}.tar.gz
|
|
|
|
fi
|
|
|
|
if [ ! -e libusb-${LIBUSB_VERSION} ] ; then
|
|
|
|
tar -zxf libusb-${LIBUSB_VERSION}.tar.gz
|
|
|
|
fi
|
2015-08-20 22:19:37 +00:00
|
|
|
if ! grep -q libusb_set_android_open_callback libusb-${LIBUSB_VERSION}/libusb/libusb.h ; then
|
|
|
|
# Patch in our libusb callback
|
|
|
|
pushd libusb-${LIBUSB_VERSION}
|
2017-01-03 08:00:52 +00:00
|
|
|
patch -p1 < "$SUBSURFACE_SOURCE"/packaging/android/patches/libusb-android.patch
|
2015-08-20 22:19:37 +00:00
|
|
|
popd
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
if [ ! -e libusb-${LIBUSB_VERSION}/configure ] ; then
|
|
|
|
pushd libusb-${LIBUSB_VERSION}
|
|
|
|
mkdir m4
|
|
|
|
autoreconf -i
|
|
|
|
popd
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libusb-1.0.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p libusb-build-$ARCH
|
|
|
|
pushd libusb-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
../libusb-${LIBUSB_VERSION}/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared --disable-udev --enable-system-log
|
2015-08-20 22:19:38 +00:00
|
|
|
# --enable-debug-log
|
2015-03-09 19:28:54 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2015-08-20 22:19:45 +00:00
|
|
|
if [ ! -e libftdi1-${LIBFTDI_VERSION}.tar.bz2 ] ; then
|
|
|
|
wget -O libftdi1-${LIBFTDI_VERSION}.tar.bz2 http://www.intra2net.com/en/developer/libftdi/download/libftdi1-${LIBFTDI_VERSION}.tar.bz2
|
|
|
|
fi
|
|
|
|
if [ ! -e libftdi1-${LIBFTDI_VERSION} ] ; then
|
|
|
|
tar -jxf libftdi1-${LIBFTDI_VERSION}.tar.bz2
|
|
|
|
fi
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libftdi1.pc" ] && [ "$PLATFORM" != "Darwin" ] ; then
|
2015-08-20 22:19:45 +00:00
|
|
|
mkdir -p libftdi1-build-$ARCH
|
|
|
|
pushd libftdi1-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
cmake ../libftdi1-${LIBFTDI_VERSION} -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" -DSTATICLIBS=ON -DPYTHON_BINDINGS=OFF -DDOCUMENTATION=OFF -DFTDIPP=OFF -DBUILD_TESTS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
|
2015-08-20 22:19:45 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
# Blast away the shared version to force static linking
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ -e "$PREFIX/lib/libftdi1.so" ] ; then
|
|
|
|
rm "$PREFIX"/lib/libftdi1.so*
|
2015-08-20 22:19:45 +00:00
|
|
|
fi
|
|
|
|
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libdivecomputer.pc" ] ; then
|
2015-03-09 19:28:54 +00:00
|
|
|
mkdir -p libdivecomputer-build-$ARCH
|
|
|
|
pushd libdivecomputer-build-$ARCH
|
2017-01-03 08:00:52 +00:00
|
|
|
"$SUBSURFACE_SOURCE"/../libdivecomputer/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared --enable-examples=no
|
2015-03-09 19:28:54 +00:00
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2015-07-08 22:42:12 +00:00
|
|
|
if [ ! -e qt-android-cmake ] ; then
|
|
|
|
git clone git://github.com/LaurentGomila/qt-android-cmake.git
|
|
|
|
else
|
|
|
|
pushd qt-android-cmake
|
2015-11-06 21:57:53 +00:00
|
|
|
git pull
|
2015-07-08 22:42:12 +00:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2015-07-09 22:02:35 +00:00
|
|
|
# Should we build the mobile ui or the desktop ui?
|
2015-12-30 01:38:30 +00:00
|
|
|
# doing this backwards in order not to break people's setup
|
|
|
|
if [ "$SUBSURFACE_DESKTOP" = "ON" ] ; then
|
|
|
|
SUBSURFACE_MOBILE=
|
|
|
|
else
|
|
|
|
SUBSURFACE_MOBILE="ON"
|
|
|
|
fi
|
2016-01-07 14:59:33 +00:00
|
|
|
|
|
|
|
if [ "$SUBSURFACE_MOBILE" = "ON" ] ; then
|
2017-01-03 08:00:52 +00:00
|
|
|
pushd "$SUBSURFACE_SOURCE"
|
2016-01-09 05:46:44 +00:00
|
|
|
bash ./scripts/mobilecomponents.sh
|
2016-01-07 14:59:33 +00:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2015-07-09 22:02:35 +00:00
|
|
|
if [ ! -z "$SUBSURFACE_MOBILE" ] ; then
|
|
|
|
mkdir -p subsurface-mobile-build-$ARCH
|
|
|
|
cd subsurface-mobile-build-$ARCH
|
2015-12-18 15:46:00 +00:00
|
|
|
MOBILE_CMAKE="-DSUBSURFACE_TARGET_EXECUTABLE=MobileExecutable"
|
2015-07-09 22:02:35 +00:00
|
|
|
else
|
|
|
|
mkdir -p subsurface-build-$ARCH
|
|
|
|
cd subsurface-build-$ARCH
|
|
|
|
fi
|
|
|
|
|
2016-01-07 14:59:33 +00:00
|
|
|
# something in the qt-android-cmake-thingies mangles your path, so thats why we need to hard-code ant and pkg-config here.
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ "$PLATFORM" = "Darwin" ] ; then
|
2015-07-20 09:13:00 +00:00
|
|
|
ANT=/usr/local/bin/ant
|
2015-11-08 15:50:49 +00:00
|
|
|
FTDI=OFF
|
2015-07-20 09:13:00 +00:00
|
|
|
else
|
|
|
|
ANT=/usr/bin/ant
|
2015-11-08 15:50:49 +00:00
|
|
|
FTDI=ON
|
2015-07-20 09:13:00 +00:00
|
|
|
fi
|
2016-01-07 14:59:33 +00:00
|
|
|
|
2015-11-08 15:50:50 +00:00
|
|
|
PKGCONF=$(which pkg-config)
|
2015-07-13 21:25:31 +00:00
|
|
|
cmake $MOBILE_CMAKE \
|
2015-07-20 09:13:00 +00:00
|
|
|
-DQT_ANDROID_ANT=${ANT} \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
|
|
|
|
-DQT_ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT" \
|
|
|
|
-DQT_ANDROID_NDK_ROOT="$ANDROID_NDK_ROOT" \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE="$BUILDROOT"/qt-android-cmake/toolchain/android.toolchain.cmake \
|
|
|
|
-DQT_ANDROID_CMAKE="$BUILDROOT"/qt-android-cmake/AddQtAndroidApk.cmake \
|
2016-08-29 02:14:06 +00:00
|
|
|
-DFORCE_LIBSSH=OFF \
|
2015-07-13 21:25:31 +00:00
|
|
|
-DLIBDC_FROM_PKGCONFIG=ON \
|
|
|
|
-DLIBGIT2_FROM_PKGCONFIG=ON \
|
|
|
|
-DNO_MARBLE=ON \
|
|
|
|
-DNO_PRINTING=ON \
|
|
|
|
-DNO_USERMANUAL=ON \
|
2015-12-01 19:46:58 +00:00
|
|
|
-DFBSUPPORT=OFF \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DCMAKE_PREFIX_PATH:UNINITIALIZED="$QT5_ANDROID/android_$QT_ARCH/lib/cmake" \
|
|
|
|
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
2015-12-24 17:41:39 +00:00
|
|
|
-DMAKE_TESTS=OFF \
|
2015-11-08 15:50:49 +00:00
|
|
|
-DFTDISUPPORT=${FTDI} \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DANDROID_NATIVE_LIBSSL="$BUILDROOT/ndk-$ARCH/sysroot/usr/lib/libssl.so" \
|
|
|
|
-DANDROID_NATIVE_LIBCRYPT="$BUILDROOT/ndk-$ARCH/sysroot/usr/lib/libcrypto.so" \
|
|
|
|
"$SUBSURFACE_SOURCE"
|
2015-12-24 17:49:05 +00:00
|
|
|
|
2016-03-06 01:14:33 +00:00
|
|
|
# set up the version number
|
2016-03-10 14:28:20 +00:00
|
|
|
|
2016-04-12 14:56:25 +00:00
|
|
|
rm -f ssrf-version.h
|
2016-03-10 14:35:40 +00:00
|
|
|
make version
|
2016-03-10 14:28:20 +00:00
|
|
|
|
2016-06-23 20:56:33 +00:00
|
|
|
if [ ! -z "$SUBSURFACE_MOBILE" ] ; then
|
|
|
|
SUBSURFACE_MOBILE_VERSION=$(grep MOBILE_VERSION_STRING ssrf-version.h | awk '{ print $3 }' | tr -d \" )
|
2017-01-03 08:00:52 +00:00
|
|
|
SUBSURFACE_MOBILE_VERSION="$SUBSURFACE_MOBILE_VERSION ($(grep CANONICAL_VERSION_STRING ssrf-version.h | awk '{ print $3 }' | tr -d \"))"
|
2016-06-23 20:56:33 +00:00
|
|
|
|
|
|
|
rm -rf android-mobile
|
2017-01-03 08:00:52 +00:00
|
|
|
cp -a "$SUBSURFACE_SOURCE/android-mobile" .
|
2016-06-23 20:56:33 +00:00
|
|
|
sed -i -e "s/@SUBSURFACE_MOBILE_VERSION@/\"$SUBSURFACE_MOBILE_VERSION\"/;s/@BUILD_NR@/$BUILD_NR/" android-mobile/AndroidManifest.xml
|
|
|
|
else
|
|
|
|
SUBSURFACE_VERSION=$(grep CANONICAL_VERSION_STRING ssrf-version.h | awk '{ print $3 }' | tr -d \")
|
|
|
|
|
2016-12-28 22:22:34 +00:00
|
|
|
# android-mobile is hardcoded in CMakeLists.txt nowadays.
|
|
|
|
rm -rf android-mobile
|
2017-01-03 08:00:52 +00:00
|
|
|
cp -a "$SUBSURFACE_SOURCE/android android-mobile"
|
2016-12-28 22:22:34 +00:00
|
|
|
sed -i -e "s/@SUBSURFACE_VERSION@/\"$SUBSURFACE_VERSION\"/;s/@BUILD_NR@/$BUILD_NR/" android-mobile/AndroidManifest.xml
|
2016-06-23 20:56:33 +00:00
|
|
|
fi
|
2016-03-06 01:14:33 +00:00
|
|
|
|
2016-05-04 00:20:53 +00:00
|
|
|
# now make the translations
|
|
|
|
make translations
|
|
|
|
mkdir -p assets/translations
|
|
|
|
cp -a translations/*.qm assets/translations
|
|
|
|
|
2015-12-24 17:49:05 +00:00
|
|
|
# now build Subsurface and use the rest of the command line arguments
|
2017-01-03 08:00:52 +00:00
|
|
|
make "$@"
|
2015-12-24 17:49:05 +00:00
|
|
|
|
2015-07-01 15:08:37 +00:00
|
|
|
#make install INSTALL_ROOT=android_build
|
2015-03-09 19:28:54 +00:00
|
|
|
# bug in androiddeployqt? why is it looking for something with the builddir in it?
|
2015-07-01 15:08:37 +00:00
|
|
|
#ln -fs android-libsubsurface.so-deployment-settings.json android-libsubsurface-build-${ARCH}.so-deployment-settings.json
|
|
|
|
#$QT5_ANDROID_BIN/androiddeployqt --output android_build
|