Ver código fonte

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.
Tatsuhiro Tsujikawa 10 anos atrás
pai
commit
fb720b3077
3 arquivos alterados com 24 adições e 10 exclusões
  1. 1 0
      README.rst
  2. 1 10
      android-config
  3. 22 0
      android/zlib-config

+ 1 - 0
README.rst

@@ -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

+ 1 - 10
android-config

@@ -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 - 0
android/zlib-config

@@ -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