安卓
NDK android-ndk-r14b(高版本不能通过)
zlib编译
export NDK_HOME=/usr/NDK/android-ndk-r14b
export BASE=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
export CURL_PATH=/var/android/curl
export OPENSSL_PATH=/var/android/openssl/
export ZLIB_PATH=/var/android/zlib/
export SYSROOT=$NDK_HOME/platforms/android-21/arch-arm
export CFLAGS="--sysroot=${SYSROOT}"
export CPPFLAGS="$CPPFLAGS -I${SYSROOT}/usr/include"
export CC=$BASE/arm-linux-androideabi-gcc
export CPP=$BASE/arm-linux-androideabi-cpp
export CXX=$BASE/arm-linux-androideabi-g++
export LD=$BASE/arm-linux-androideabi-ld
export AS=$BASE/arm-linux-androideabi-as
export AR=$BASE/arm-linux-androideabi-ar
export NM=$BASE/arm-linux-androideabi-nm
export STRIP=$BASE/arm-linux-androideabi-strip
export RANLIB=$BASE/arm-linux-androideabi-ranlib
export PATH=$PATH:$BASE
export PKG_CONFIG_PATH="$CURL_BUILD_DIR/zlib/pkgconfig"
../configure --static --prefix=$ZLIB_BUILD_DIR
openssl编译(编译了很多次都失败了必须用ndk14以下,必须在openssl源码目录编译否则会出错)
export ANDROID_NDK=/usr/NDK/android-ndk-r14b
export PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
./Configure android-arm -D__ANDROID_API__=21 --prefix=/var/android/opensslback
curl编译
export NDK_HOME=/usr/NDK/android-ndk-r14b
export BASE=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
export CURL_PATH=/var/android/curl
export OPENSSL_PATH=/var/android/openssl/
export ZLIB_PATH=/var/android/zlib/
export SYSROOT=$NDK_HOME/platforms/android-21/arch-arm
export CFLAGS="--sysroot=${SYSROOT}"
export CPPFLAGS="$CPPFLAGS -I${SYSROOT}/usr/include"
export CC=$BASE/arm-linux-androideabi-gcc
export CPP=$BASE/arm-linux-androideabi-cpp
export CXX=$BASE/arm-linux-androideabi-g++
export LD=$BASE/arm-linux-androideabi-ld
export AS=$BASE/arm-linux-androideabi-as
export AR=$BASE/arm-linux-androideabi-ar
export NM=$BASE/arm-linux-androideabi-nm
export STRIP=$BASE/arm-linux-androideabi-strip
export RANLIB=$BASE/arm-linux-androideabi-ranlib
export PATH=$PATH:$BASE
export PKG_CONFIG_PATH="$CURL_BUILD_DIR/openssl/pkgconfig"
../configure \
--host=arm-linux-androideabi \
CC=$CC AR=$AR LD=$LD NM=$NM STRIP=$STRIP CXX=$CXX CPPFLAGS=$CFLAGS LDFLAGS=$LDFLAGS \
--enable-cross-compile \
--enable-static \
--enable-shared \
--disable-verbose \
--enable-threaded-resolver \
--enable-libgcc \
--enable-ipv6 \
--with-ssl=$OPENSSL_PATH \
--with-zlib=$ZLIB_PATH \
--prefix=$CURL_PATH