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:
|
2017-02-06 14:55:38 +00:00
|
|
|
# http://download.qt.io/official_releases/qt/
|
2017-01-02 12:46:51 +00:00
|
|
|
# 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.
|
2017-02-06 14:55:38 +00:00
|
|
|
# So let's assume that you are installing the package above in ~/Qt
|
2017-01-02 12:46:51 +00:00
|
|
|
# (which I think is the default location), then simply do
|
|
|
|
# cd ~/src
|
2017-02-06 14:55:38 +00:00
|
|
|
# ln -s ~/Qt Qt
|
2017-01-02 12:46:51 +00:00
|
|
|
#
|
|
|
|
# you also need to have the current Android SDK and NDK installed under ~/src
|
|
|
|
#
|
2017-01-09 10:47:39 +00:00
|
|
|
# Or just set QT5_ANDROID, ANDROID_SDK_ROOT and ANDROID_NDK_ROOT to where ever you have them.
|
|
|
|
#
|
2017-02-06 14:55:41 +00:00
|
|
|
set -eu
|
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
|
|
|
|
2017-02-06 14:55:41 +00:00
|
|
|
# Set build defaults
|
2015-12-24 17:41:39 +00:00
|
|
|
# is this a release or debug build
|
|
|
|
BUILD_TYPE=Debug
|
2017-02-06 14:55:41 +00:00
|
|
|
# Build-nr in the android manifest.
|
|
|
|
BUILD_NR=0
|
|
|
|
# Should we build the desktop ui or the mobile ui?
|
|
|
|
SUBSURFACE_DESKTOP=OFF
|
|
|
|
# Which arch should we build for?
|
|
|
|
ARCH=arm
|
2018-06-28 10:13:35 +00:00
|
|
|
# Read build variables
|
|
|
|
source subsurface/packaging/android/variables.sh
|
2017-02-06 14:55:41 +00:00
|
|
|
|
2018-08-06 03:12:16 +00:00
|
|
|
QUICK=""
|
|
|
|
|
2017-02-06 14:55:41 +00:00
|
|
|
while [ "$#" -gt 0 ] ; do
|
|
|
|
case "$1" in
|
|
|
|
Release|release)
|
|
|
|
shift
|
|
|
|
BUILD_TYPE=Release
|
|
|
|
;;
|
|
|
|
Debug|debug)
|
|
|
|
# this is the default - still need to eat the argument if given
|
|
|
|
BUILD_TYPE=Debug
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-buildnr)
|
|
|
|
shift
|
|
|
|
BUILD_NR=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
desktop)
|
|
|
|
SUBSURFACE_DESKTOP=ON
|
|
|
|
shift
|
|
|
|
;;
|
2018-11-24 09:38:15 +00:00
|
|
|
arm|arm64|x86)
|
2017-02-06 14:55:41 +00:00
|
|
|
ARCH=$1
|
|
|
|
shift
|
2017-11-15 20:03:28 +00:00
|
|
|
;;
|
2018-08-06 03:12:16 +00:00
|
|
|
-quick)
|
|
|
|
QUICK="1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2017-11-15 20:03:28 +00:00
|
|
|
*)
|
|
|
|
echo "Unknown argument $1"
|
|
|
|
exit 1
|
|
|
|
;;
|
2017-02-06 14:55:41 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Its needed by all sub-cmds
|
|
|
|
export ARCH
|
2016-03-06 05:23:27 +00:00
|
|
|
|
2015-03-09 19:28:54 +00:00
|
|
|
# Configure where we can find things here
|
2018-06-28 10:13:35 +00:00
|
|
|
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT-$SUBSURFACE_SOURCE/../${ANDROID_NDK}}
|
2016-03-03 22:32:23 +00:00
|
|
|
|
2017-02-06 14:55:41 +00:00
|
|
|
if [ -n "${QT5_ANDROID+X}" ] ; then
|
2016-06-23 20:56:31 +00:00
|
|
|
echo "Using Qt5 in $QT5_ANDROID"
|
2018-06-28 10:13:35 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/${LATEST_QT}" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/${LATEST_QT}
|
2018-02-23 13:01:52 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.9.3" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.9.3
|
2017-06-30 23:57:13 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.9.1" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.9.1
|
2017-05-27 21:54:28 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.9" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.9
|
2017-02-06 14:55:39 +00:00
|
|
|
elif [ -d "$SUBSURFACE_SOURCE/../Qt/5.8" ] ; then
|
|
|
|
export QT5_ANDROID=$SUBSURFACE_SOURCE/../Qt/5.8
|
2016-03-03 22:32:23 +00:00
|
|
|
else
|
2018-06-28 10:13:35 +00:00
|
|
|
echo "Cannot find Qt 5.8 or newer 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}
|
2018-03-08 22:24:12 +00:00
|
|
|
export ANDROID_NDK_HOST=linux-x86_64
|
2015-07-20 09:13:00 +00:00
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
|
|
|
if [ "$ARCH" = "arm" ] ; then
|
2017-02-06 14:55:41 +00:00
|
|
|
QT_ARCH=armv7
|
2015-03-09 19:28:54 +00:00
|
|
|
BUILDCHAIN=arm-linux-androideabi
|
2017-02-06 14:55:41 +00:00
|
|
|
OPENSSL_MACHINE=armv7
|
2018-11-24 09:38:15 +00:00
|
|
|
ANDROID_ABI=armeabi-v7a
|
|
|
|
elif [ "$ARCH" = "arm64" ] ; then # requires Qt 5.12
|
|
|
|
QT_ARCH=arm64_v8a
|
|
|
|
BUILDCHAIN=aarch64-linux-android
|
|
|
|
ANDROID_ABI=arm64-v8a
|
|
|
|
OPENSSL_MACHINE=aarch64
|
2015-03-09 19:28:54 +00:00
|
|
|
elif [ "$ARCH" = "x86" ] ; then
|
|
|
|
QT_ARCH=$ARCH
|
|
|
|
BUILDCHAIN=i686-linux-android
|
2017-02-06 14:55:41 +00:00
|
|
|
OPENSSL_MACHINE=i686
|
2018-11-24 09:38:15 +00:00
|
|
|
ANDROID_ABI=x86
|
2015-03-09 19:28:54 +00:00
|
|
|
fi
|
|
|
|
|
2017-07-05 09:26:12 +00:00
|
|
|
# Verify Qt install and adjust for single-arch Qt install layout
|
|
|
|
# (e.g. when building Qt from scratch)
|
|
|
|
export QT5_ANDROID_CMAKE
|
|
|
|
if [ -d "${QT5_ANDROID}/android_${QT_ARCH}/lib/cmake" ] ; then
|
|
|
|
export QT5_ANDROID_CMAKE=$QT5_ANDROID/android_${QT_ARCH}/lib/cmake
|
2017-07-18 10:45:26 +00:00
|
|
|
elif [ -d "${QT5_ANDROID}/lib/cmake" ] ; then
|
2017-07-05 09:26:12 +00:00
|
|
|
export QT5_ANDROID_CMAKE=$QT5_ANDROID/lib/cmake
|
|
|
|
else
|
|
|
|
echo "Cannot find Qt cmake configuration"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-02-06 14:55:41 +00:00
|
|
|
if [ ! -e ndk-"$ARCH" ] ; then
|
2018-11-24 09:03:50 +00:00
|
|
|
"$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch="$ARCH" --install-dir=ndk-"$ARCH" --api=$ANDROID_PLATFORM_LEVEL
|
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
|
2018-11-24 09:38:15 +00:00
|
|
|
export CC=${BUILDROOT}/ndk-$ARCH/bin/clang
|
|
|
|
export CXX=${BUILDROOT}/ndk-$ARCH/bin/clang++
|
2015-07-15 17:32:48 +00:00
|
|
|
# autoconf seems to get lost without this
|
|
|
|
export SYSROOT=${BUILDROOT}/ndk-$ARCH/sysroot
|
2018-11-24 10:24:17 +00:00
|
|
|
export CFLAGS="--sysroot=${SYSROOT} -fPIC"
|
|
|
|
export CPPFLAGS="--sysroot=${SYSROOT} -fPIC"
|
|
|
|
export CXXFLAGS="--sysroot=${SYSROOT} -fPIC"
|
|
|
|
|
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
|
|
|
|
2018-05-17 18:57:26 +00:00
|
|
|
# find qmake
|
2018-11-24 09:15:11 +00:00
|
|
|
QMAKE=$QT5_ANDROID/android_$QT_ARCH/bin/qmake
|
|
|
|
echo $QMAKE
|
2018-05-17 18:57:26 +00:00
|
|
|
$QMAKE -query
|
|
|
|
|
2018-08-06 03:12:16 +00:00
|
|
|
# if we are just doing a quick rebuild, don't bother with any of the dependencies
|
|
|
|
|
|
|
|
if [ "$QUICK" = "" ] ; then
|
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
# don't adjust indentation to make this a more reasonable commit
|
|
|
|
# build google maps plugin
|
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . googlemaps
|
|
|
|
# find qmake
|
2018-11-24 09:15:11 +00:00
|
|
|
QMAKE=$QT5_ANDROID/android_$QT_ARCH/bin/qmake
|
2018-08-06 03:14:43 +00:00
|
|
|
$QMAKE -query
|
|
|
|
QT_PLUGINS_PATH=$($QMAKE -query QT_INSTALL_PLUGINS)
|
|
|
|
GOOGLEMAPS_BIN=libqtgeoservices_googlemaps.so
|
|
|
|
if [ ! -e "$QT_PLUGINS_PATH"/geoservices/$GOOGLEMAPS_BIN ] || [ googlemaps/.git/HEAD -nt "$QT_PLUGINS_PATH"/geoservices/$GOOGLEMAPS_BIN ] ; then
|
|
|
|
mkdir -p googlemaps-build-"$ARCH"
|
|
|
|
pushd googlemaps-build-"$ARCH"
|
|
|
|
$QMAKE ../googlemaps/googlemaps.pro
|
|
|
|
# on Travis the compiler doesn't support c++1z, yet qmake adds that flag;
|
|
|
|
# since things compile fine with c++11, let's just hack that away
|
|
|
|
# similarly, don't use -Wdata-time
|
|
|
|
sed -i.bak -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' Makefile
|
|
|
|
make -j4
|
|
|
|
$QMAKE -install qinstall -exe $GOOGLEMAPS_BIN "$QT_PLUGINS_PATH"/geoservices/$GOOGLEMAPS_BIN
|
|
|
|
popd
|
|
|
|
fi
|
2018-03-08 22:24:12 +00:00
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . sqlite
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/sqlite3.pc" ] ; then
|
|
|
|
mkdir -p sqlite-build-"$ARCH"
|
|
|
|
pushd sqlite-build-"$ARCH"
|
|
|
|
../sqlite/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libxml2
|
|
|
|
if [ ! -e libxml2/configure ] ; then
|
|
|
|
pushd libxml2
|
|
|
|
autoreconf --install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libxml-2.0.pc" ] ; then
|
|
|
|
mkdir -p libxml2-build-"$ARCH"
|
|
|
|
pushd libxml2-build-"$ARCH"
|
|
|
|
../libxml2/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --without-python --without-iconv --enable-static --disable-shared
|
|
|
|
perl -pi -e 's/runtest\$\(EXEEXT\)//' Makefile
|
|
|
|
perl -pi -e 's/testrecurse\$\(EXEEXT\)//' Makefile
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libxslt
|
|
|
|
if [ ! -e libxslt/configure ] ; then
|
|
|
|
pushd libxslt
|
|
|
|
autoreconf --install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libxslt.pc" ] ; then
|
|
|
|
mkdir -p libxslt-build-"$ARCH"
|
|
|
|
pushd libxslt-build-"$ARCH"
|
|
|
|
../libxslt/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --with-libxml-prefix="$PREFIX" --without-python --without-crypto --enable-static --disable-shared
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
2018-11-24 09:03:50 +00:00
|
|
|
|
2015-03-09 19:28:54 +00:00
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . openssl
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libssl.pc" ] ; then
|
2018-11-24 09:29:39 +00:00
|
|
|
mkdir -p openssl-build-"$ARCH"
|
|
|
|
cp -r openssl/* openssl-build-"$ARCH"
|
2018-08-06 03:14:43 +00:00
|
|
|
pushd openssl-build-"$ARCH"
|
2018-11-24 09:38:15 +00:00
|
|
|
perl -pi -e 's/-mandroid//g' Configure
|
Android: rework build of OpenSSL to get it to build link and run
This is squashed commit consisting of a number of subjects, all intended
to get our app to build, link and run on device, but as the steps are
small (but non-trivial), I document them in this one commit.
1) Do not use OpenSSLs install targets, but simply copy the wanted build
artifacts manually. The main reason for this, is that the install
targets want to install a lot more than we build, so it also builds
parts of the OpenSSL suite that we will never use.
2) As Android does not like shared libraries with embedded versioning
(and the used androiddeployqt actively prevents adding versioned
libraries to the build), strip all this data from the generated shared
libraries. This trick was already there, but its adapted to all possible
conflicts.
3) The OpenSSL config script seems rather broken, resulted in failed
builds, and calling the underlying Configure is simpler.
4) Finally, parts of the OpenSSL code uses stdio things like stdout,
stderr, etc. These showed up as undeclared external on build time. Well,
luckily, there was an easy way out using 2 -D(efines). This feels hacky,
but does the job (and we are not interested in the output of OpenSSL in
our app).
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-11 17:16:13 +00:00
|
|
|
export ANDROID_NDK_HOME=$ANDROID_NDK_ROOT
|
2018-08-06 03:14:43 +00:00
|
|
|
# Use env to make all these temporary, so they don't pollute later builds.
|
Android: rework build of OpenSSL to get it to build link and run
This is squashed commit consisting of a number of subjects, all intended
to get our app to build, link and run on device, but as the steps are
small (but non-trivial), I document them in this one commit.
1) Do not use OpenSSLs install targets, but simply copy the wanted build
artifacts manually. The main reason for this, is that the install
targets want to install a lot more than we build, so it also builds
parts of the OpenSSL suite that we will never use.
2) As Android does not like shared libraries with embedded versioning
(and the used androiddeployqt actively prevents adding versioned
libraries to the build), strip all this data from the generated shared
libraries. This trick was already there, but its adapted to all possible
conflicts.
3) The OpenSSL config script seems rather broken, resulted in failed
builds, and calling the underlying Configure is simpler.
4) Finally, parts of the OpenSSL code uses stdio things like stdout,
stderr, etc. These showed up as undeclared external on build time. Well,
luckily, there was an easy way out using 2 -D(efines). This feels hacky,
but does the job (and we are not interested in the output of OpenSSL in
our app).
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-11 17:16:13 +00:00
|
|
|
env PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH \
|
2018-11-24 09:38:15 +00:00
|
|
|
CC=clang \
|
Android: rework build of OpenSSL to get it to build link and run
This is squashed commit consisting of a number of subjects, all intended
to get our app to build, link and run on device, but as the steps are
small (but non-trivial), I document them in this one commit.
1) Do not use OpenSSLs install targets, but simply copy the wanted build
artifacts manually. The main reason for this, is that the install
targets want to install a lot more than we build, so it also builds
parts of the OpenSSL suite that we will never use.
2) As Android does not like shared libraries with embedded versioning
(and the used androiddeployqt actively prevents adding versioned
libraries to the build), strip all this data from the generated shared
libraries. This trick was already there, but its adapted to all possible
conflicts.
3) The OpenSSL config script seems rather broken, resulted in failed
builds, and calling the underlying Configure is simpler.
4) Finally, parts of the OpenSSL code uses stdio things like stdout,
stderr, etc. These showed up as undeclared external on build time. Well,
luckily, there was an easy way out using 2 -D(efines). This feels hacky,
but does the job (and we are not interested in the output of OpenSSL in
our app).
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-11 17:16:13 +00:00
|
|
|
./Configure android-"$ARCH" no-ssl2 no-ssl3 no-comp no-hw no-engine no-asm --prefix="$PREFIX" -DOPENSSL_NO_UI_CONSOLE -DOPENSSL_NO_STDIO
|
2018-08-06 03:14:43 +00:00
|
|
|
make depend
|
Android: rework build of OpenSSL to get it to build link and run
This is squashed commit consisting of a number of subjects, all intended
to get our app to build, link and run on device, but as the steps are
small (but non-trivial), I document them in this one commit.
1) Do not use OpenSSLs install targets, but simply copy the wanted build
artifacts manually. The main reason for this, is that the install
targets want to install a lot more than we build, so it also builds
parts of the OpenSSL suite that we will never use.
2) As Android does not like shared libraries with embedded versioning
(and the used androiddeployqt actively prevents adding versioned
libraries to the build), strip all this data from the generated shared
libraries. This trick was already there, but its adapted to all possible
conflicts.
3) The OpenSSL config script seems rather broken, resulted in failed
builds, and calling the underlying Configure is simpler.
4) Finally, parts of the OpenSSL code uses stdio things like stdout,
stderr, etc. These showed up as undeclared external on build time. Well,
luckily, there was an easy way out using 2 -D(efines). This feels hacky,
but does the job (and we are not interested in the output of OpenSSL in
our app).
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-11 17:16:13 +00:00
|
|
|
make build_libs
|
|
|
|
|
|
|
|
# now fix the reference to libcrypto.so.1.1 and libssl.so.1.1 to be just unversioned
|
|
|
|
# as androiddeployqt and Android itself does not like versioned shared objects
|
|
|
|
perl -pi -e 's/libcrypto.so.1.1/libcrypto.so\x00\x00\x00\x00/' libcrypto.so.1.1
|
|
|
|
perl -pi -e 's/libcrypto.so.1.1/libcrypto.so\x00\x00\x00\x00/' libssl.so.1.1
|
|
|
|
perl -pi -e 's/libssl.so.1.1/libssl.so\x00\x00\x00\x00/' libcrypto.so.1.1
|
|
|
|
perl -pi -e 's/libssl.so.1.1/libssl.so\x00\x00\x00\x00/' libssl.so.1.1
|
|
|
|
|
|
|
|
cp -RL include/openssl $PREFIX/include/openssl
|
|
|
|
cp libcrypto.a $PREFIX/lib
|
|
|
|
cp libcrypto.so* $PREFIX/lib
|
|
|
|
cp libssl.a $PREFIX/lib
|
|
|
|
cp libssl.so* $PREFIX/lib
|
|
|
|
cp *.pc $PKG_CONFIG_LIBDIR
|
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
popd
|
|
|
|
fi
|
2015-07-15 22:59:35 +00:00
|
|
|
|
2018-11-24 10:08:11 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libzip
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libzip.pc" ] ; then
|
|
|
|
# libzip expects a predefined macro that isn't there for our compiler
|
|
|
|
pushd libzip
|
|
|
|
git reset --hard
|
|
|
|
sed -i 's/SIZEOF_SIZE_T/__SIZEOF_SIZE_T__/g' lib/compat.h
|
|
|
|
# also, don't deal with manuals and bzip2
|
2019-03-20 21:16:56 +00:00
|
|
|
sed -i 's/ADD_SUBDIRECTORY(man)//' CMakeLists.txt
|
2018-11-24 10:08:11 +00:00
|
|
|
popd
|
|
|
|
mkdir -p libzip-build-"$ARCH"
|
|
|
|
pushd libzip-build-"$ARCH"
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_C_COMPILER="$CC" \
|
|
|
|
-DCMAKE_LINKER="$CC" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
|
|
|
-DCMAKE_INSTALL_LIBDIR="lib" \
|
|
|
|
-DBUILD_SHARED_LIBS=OFF \
|
2019-03-20 21:16:56 +00:00
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE \
|
2018-11-24 10:08:11 +00:00
|
|
|
../libzip/
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libgit2
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libgit2.pc" ] ; then
|
|
|
|
# We don't want to find the HTTP_Parser package of the build host by mistake
|
|
|
|
mkdir -p libgit2-build-"$ARCH"
|
|
|
|
pushd libgit2-build-"$ARCH"
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_C_COMPILER="$CC" \
|
|
|
|
-DCMAKE_LINKER="$CC" \
|
|
|
|
-DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=OFF \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
|
|
|
-DCURL=OFF \
|
|
|
|
-DUSE_SSH=OFF \
|
|
|
|
-DOPENSSL_SSL_LIBRARY="$PREFIX"/lib/libssl.so \
|
|
|
|
-DOPENSSL_CRYPTO_LIBRARY="$PREFIX"/lib/libcrypto.so \
|
|
|
|
-DOPENSSL_INCLUDE_DIR="$PREFIX"/include/openssl \
|
|
|
|
-D_OPENSSL_VERSION="${OPENSSL_VERSION}" \
|
2019-03-04 17:50:19 +00:00
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_HTTP_Parser=TRUE \
|
2018-08-06 03:14:43 +00:00
|
|
|
../libgit2/
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
# Patch away pkg-config dependency to zlib, its there, i promise
|
|
|
|
perl -pi -e 's/^(Requires.private:.*)zlib(.*)$/$1 $2/' "$PKG_CONFIG_LIBDIR"/libgit2.pc
|
|
|
|
popd
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libusb
|
|
|
|
if ! grep -q libusb_set_android_open_callback libusb/libusb/libusb.h ; then
|
|
|
|
# Patch in our libusb callback
|
|
|
|
pushd libusb
|
|
|
|
patch -p1 < "$SUBSURFACE_SOURCE"/packaging/android/patches/libusb-android.patch
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
if [ ! -e libusb/configure ] ; then
|
|
|
|
pushd libusb
|
|
|
|
mkdir m4
|
|
|
|
autoreconf -i
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libusb-1.0.pc" ] ; then
|
|
|
|
mkdir -p libusb-build-"$ARCH"
|
|
|
|
pushd libusb-build-"$ARCH"
|
|
|
|
../libusb/configure --host=${BUILDCHAIN} --prefix="$PREFIX" --enable-static --disable-shared --disable-udev --enable-system-log
|
|
|
|
# --enable-debug-log
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
2015-03-09 19:28:54 +00:00
|
|
|
|
2018-08-06 03:14:43 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libftdi1
|
|
|
|
if [ ! -e "$PKG_CONFIG_LIBDIR/libftdi1.pc" ] && [ "$PLATFORM" != "Darwin" ] ; then
|
|
|
|
mkdir -p libftdi1-build-"$ARCH"
|
|
|
|
pushd libftdi1-build-"$ARCH"
|
|
|
|
cmake ../libftdi1 -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
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
# Blast away the shared version to force static linking
|
|
|
|
if [ -e "$PREFIX/lib/libftdi1.so" ] ; then
|
|
|
|
rm "$PREFIX"/lib/libftdi1.so*
|
|
|
|
fi
|
2015-08-20 22:19:45 +00:00
|
|
|
|
2018-08-06 03:12:16 +00:00
|
|
|
fi # QUICK
|
|
|
|
|
2018-05-14 19:31:55 +00:00
|
|
|
pushd "$SUBSURFACE_SOURCE"
|
2018-04-25 19:49:28 +00:00
|
|
|
git submodule update --recursive
|
|
|
|
popd
|
2018-05-14 19:31:55 +00:00
|
|
|
CURRENT_SHA=$(cd "$SUBSURFACE_SOURCE"/libdivecomputer ; git describe)
|
2018-05-14 20:13:21 +00:00
|
|
|
PREVIOUS_SHA=$(cat "libdivecomputer-${ARCH}.SHA" 2>/dev/null || echo)
|
|
|
|
if [ ! "$CURRENT_SHA" = "$PREVIOUS_SHA" ] || [ ! -e "$PKG_CONFIG_LIBDIR/libdivecomputer.pc" ] ; then
|
2017-02-06 14:55:41 +00:00
|
|
|
mkdir -p libdivecomputer-build-"$ARCH"
|
|
|
|
pushd libdivecomputer-build-"$ARCH"
|
2017-12-07 03:02:58 +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
|
2018-05-14 20:13:21 +00:00
|
|
|
echo "$CURRENT_SHA" > "libdivecomputer-${ARCH}.SHA"
|
2015-03-09 19:28:54 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-27 14:01:00 +00:00
|
|
|
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . qt-android-cmake
|
2017-12-26 20:06:12 +00:00
|
|
|
# the Qt Android cmake addon runs androiddeployqt with '--verbose' which
|
|
|
|
# is, err, rather verbose. Let's not do that.
|
|
|
|
sed -i -e 's/--verbose//' qt-android-cmake/AddQtAndroidApk.cmake
|
2015-07-08 22:42:12 +00:00
|
|
|
|
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
|
2017-02-06 14:55:41 +00:00
|
|
|
SUBSURFACE_MOBILE=ON
|
2015-12-30 01:38:30 +00:00
|
|
|
fi
|
2016-01-07 14:59:33 +00:00
|
|
|
|
2018-08-06 03:12:16 +00:00
|
|
|
# if we are building Subsurface-mobile and this isn't just a quick
|
|
|
|
# rebuild, pull kirigami, icons, etc
|
|
|
|
if [ "$SUBSURFACE_MOBILE" = "ON" ] && [ "$QUICK" = "" ] ; 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
|
2017-02-06 14:55:41 +00:00
|
|
|
mkdir -p subsurface-mobile-build-"$ARCH"
|
|
|
|
cd subsurface-mobile-build-"$ARCH"
|
|
|
|
MOBILE_CMAKE=-DSUBSURFACE_TARGET_EXECUTABLE=MobileExecutable
|
2017-05-27 21:54:28 +00:00
|
|
|
BUILD_NAME=Subsurface-mobile
|
2015-07-09 22:02:35 +00:00
|
|
|
else
|
2017-02-06 14:55:41 +00:00
|
|
|
MOBILE_CMAKE=""
|
|
|
|
mkdir -p subsurface-build-"$ARCH"
|
|
|
|
cd subsurface-build-"$ARCH"
|
2017-05-27 21:54:28 +00:00
|
|
|
BUILD_NAME=Subsurface
|
2015-07-09 22:02:35 +00:00
|
|
|
fi
|
|
|
|
|
2017-01-03 08:00:52 +00:00
|
|
|
if [ "$PLATFORM" = "Darwin" ] ; then
|
2015-11-08 15:50:49 +00:00
|
|
|
FTDI=OFF
|
2015-07-20 09:13:00 +00:00
|
|
|
else
|
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 \
|
2018-11-24 09:38:15 +00:00
|
|
|
-DCMAKE_SYSTEM_NAME="Android" \
|
|
|
|
-DANDROID_ABI=$ANDROID_ABI \
|
|
|
|
-DANDROID_PLATFORM="$ANDROID_PLATFORM" \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DQT_ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT" \
|
|
|
|
-DQT_ANDROID_NDK_ROOT="$ANDROID_NDK_ROOT" \
|
2018-11-24 09:38:15 +00:00
|
|
|
-DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
|
2018-11-13 05:16:29 +00:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_ROOT"/build/cmake/android.toolchain.cmake \
|
2017-01-03 08:00:52 +00:00
|
|
|
-DQT_ANDROID_CMAKE="$BUILDROOT"/qt-android-cmake/AddQtAndroidApk.cmake \
|
2018-11-24 09:38:15 +00:00
|
|
|
-DANDROID_STL="c++_shared" \
|
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_PRINTING=ON \
|
|
|
|
-DNO_USERMANUAL=ON \
|
2017-12-26 17:24:35 +00:00
|
|
|
-DNO_DOCS=ON \
|
2017-07-05 09:26:12 +00:00
|
|
|
-DCMAKE_PREFIX_PATH:UNINITIALIZED="$QT5_ANDROID_CMAKE" \
|
2017-01-03 08:00:52 +00:00
|
|
|
-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" \
|
2017-12-26 17:27:02 +00:00
|
|
|
-DCMAKE_MAKE_PROGRAM="make" \
|
2017-01-03 08:00:52 +00:00
|
|
|
"$SUBSURFACE_SOURCE"
|
2019-07-18 06:31:36 +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
|
|
|
|
2019-03-04 17:52:40 +00:00
|
|
|
SUBSURFACE_VERSION=$(grep CANONICAL_VERSION_STRING ssrf-version.h | awk '{ print $3 }' | tr -d \")
|
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 \" )
|
2019-03-04 17:52:40 +00:00
|
|
|
SUBSURFACE_MOBILE_VERSION="$SUBSURFACE_MOBILE_VERSION (${SUBSURFACE_VERSION})"
|
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" .
|
2017-02-06 14:55:41 +00:00
|
|
|
sed -i -e "s/@SUBSURFACE_MOBILE_VERSION@/$SUBSURFACE_MOBILE_VERSION/;s/@BUILD_NR@/$BUILD_NR/" android-mobile/AndroidManifest.xml
|
2016-06-23 20:56:33 +00:00
|
|
|
else
|
2016-12-28 22:22:34 +00:00
|
|
|
# android-mobile is hardcoded in CMakeLists.txt nowadays.
|
|
|
|
rm -rf android-mobile
|
2017-02-07 06:15:33 +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
|
|
|
|
2017-05-27 21:54:28 +00:00
|
|
|
echo "Done building $BUILD_NAME for Android"
|