Skip to content

Commit

Permalink
android: Build and link with zlib
Browse files Browse the repository at this point in the history
Previously, we linked with zlib shipped with NDK, but it seems this is
not part of NDK API, and thus could break our app.
  • Loading branch information
tatsuhiro-t committed May 20, 2015
1 parent eb9dafc commit fb720b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions android-config
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 22 additions & 0 deletions android/zlib-config
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fb720b3

Please sign in to comment.