android: Build and link with zlib

Previously, we linked with zlib shipped with NDK, but it seems this is
not part of NDK API, and thus could break our app.
This commit is contained in:
Tatsuhiro Tsujikawa 2015-05-21 00:00:37 +09:00
parent eb9dafc247
commit fb720b3077
3 changed files with 24 additions and 10 deletions

View file

@ -350,6 +350,7 @@ assumes the following libraries have been built for cross-compile:
* c-ares
* openssl
* expat
* zlib
When building the above libraries, make sure that disable shared
library and enable only static library. We are going to link those

View file

@ -55,13 +55,4 @@ PATH=$TOOLCHAIN/bin:$PATH
CFLAGS="-Os -g" \
CPPFLAGS="-fPIE" \
LDFLAGS="-fPIE -pie -L$PREFIX/lib" \
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
ZLIB_LIBS="-lz" \
ZLIB_CFLAGS="-I$TOOLCHAIN/sysroot/usr/include" \
LIBSSH2_LIBS="-lssh2" \
LIBSSH2_CFLAGS="-I$TOOLCHAIN/sysroot/usr/include"
# ZLIB_LIBS and ZLIB_CFLAGS are needed because aria2 configure script
# checks zlib availability using pkg-config, but android toochain does
# not provide pkg-config file. We need to specify these variables
# manually.
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig"

22
android/zlib-config Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh -e
if [ -z "$ANDROID_HOME" ]; then
echo 'No $ANDROID_HOME specified.'
exit 1
fi
PREFIX=$ANDROID_HOME/usr/local
TOOLCHAIN=$ANDROID_HOME/toolchain
PATH=$TOOLCHAIN/bin:$PATH
HOST=arm-linux-androideabi
CC=$HOST-gcc \
AR=$HOST-ar \
LD=$HOST-ld \
RANLIB=$HOST-ranlib \
STRIP=$HOST-strip \
./configure \
--prefix=$PREFIX \
--libdir=$PREFIX/lib \
--includedir=$PREFIX/include \
--static