Android build: try to create APK that works on Android 7.0

It appears that instead of statically linking against ssl/crypto/ssh2, you
instead have to dynamically link against it and then bundle the library in
the APK. The documentation is not 100% clear and I don't have an Android
Nougat device to test this with, so for now this is an attempt.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-08-24 13:19:30 -07:00
parent 7dd8a62ced
commit a5cf8aaa21
2 changed files with 8 additions and 9 deletions

View file

@ -332,7 +332,7 @@ if(ANDROID)
# Android template directory
include(${QT_ANDROID_CMAKE})
add_qt_android_apk(${SUBSURFACE_TARGET}.apk ${SUBSURFACE_TARGET}
PACKAGE_SOURCES ${CMAKE_BINARY_DIR}/android-mobile
PACKAGE_SOURCES ${CMAKE_BINARY_DIR}/android-mobile DEPENDS ${ANDROID_NATIVE_LIBSSL} ${ANDROID_NATIVE_LIBCRYPT} ${ANDROID_NATIVE_LIBSSH2}
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(APP_BUNDLE_DIR "${SUBSURFACE_TARGET}.app")

View file

@ -184,7 +184,7 @@ if [ ! -e $PKG_CONFIG_LIBDIR/libssl.pc ] ; then
HOSTCC=gcc \
CC=gcc \
ANDROID_DEV=$PREFIX \
bash -x ./config no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir=$PREFIX
bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir=$PREFIX
make depend
make
make install_sw
@ -206,7 +206,7 @@ perl -pi -e 's,ENGINE_register_all_complete\(\),,' libssh2-${LIBSSH2_VERSION}/sr
if [ ! -e $PKG_CONFIG_LIBDIR/libssh2.pc ] ; then
mkdir -p libssh2-build-$ARCH
pushd libssh2-build-$ARCH
../libssh2-${LIBSSH2_VERSION}/configure --host=${BUILDCHAIN} --prefix=${PREFIX} --enable-static --disable-shared
../libssh2-${LIBSSH2_VERSION}/configure --host=${BUILDCHAIN} --prefix=${PREFIX} --enable-shared --disable-static
make
make install
# Patch away pkg-config dependency to zlib, its there, i promise
@ -228,8 +228,8 @@ if [ ! -e $PKG_CONFIG_LIBDIR/libgit2.pc ] ; then
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCURL=OFF \
-DUSE_SSH=ON \
-DOPENSSL_SSL_LIBRARY=${PREFIX}/lib/libssl.a \
-DOPENSSL_CRYPTO_LIBRARY=${PREFIX}/lib/libcrypto.a \
-DOPENSSL_SSL_LIBRARY=${PREFIX}/lib/libssl.so \
-DOPENSSL_CRYPTO_LIBRARY=${PREFIX}/lib/libcrypto.so \
-DOPENSSL_INCLUDE_DIR=${PREFIX}/include/openssl \
-D_OPENSSL_VERSION=1.0.1p \
../libgit2-${LIBGIT2_VERSION}/
@ -355,12 +355,11 @@ cmake $MOBILE_CMAKE \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DMAKE_TESTS=OFF \
-DFTDISUPPORT=${FTDI} \
-DANDROID_NATIVE_LIBSSL=$BUILDROOT/ndk-${ARCH}/sysroot/usr/lib/libssl.so \
-DANDROID_NATIVE_LIBCRYPT=$BUILDROOT/ndk-${ARCH}/sysroot/usr/lib/libcrypto.so \
-DANDROID_NATIVE_LIBSSH2=$BUILDROOT/ndk-${ARCH}/sysroot/usr/lib/libssh2.so \
$SUBSURFACE_SOURCE
# sometimes cmake tries to link both against the static and shared
# libcrypto - that's not helpful
sed -i -e "s/-lcrypto//g" CMakeFiles/subsurface-mobile.dir/link.txt
# set up the version number
rm -f ssrf-version.h