|
|
@@ -0,0 +1,108 @@ |
|
|
# Build libcurl for android NDK |
|
|
|
|
|
Libcurl requires openssl and zlib to be fully operationnal |
|
|
|
|
|
* Step 1 : cross compile zlib |
|
|
* Step 2 : cross compile openssl |
|
|
* Step 3 : cross compile curl with zlib/openssl external link |
|
|
|
|
|
Prerequisites : |
|
|
|
|
|
* NDK installed |
|
|
* NDK added to PATH : ``PATH=$PATH:/home/user/android-ndk`` |
|
|
* standalone toolchain generated and added to path : ``PATH=$PATH:/home/user/android-toolchain/bin`` |
|
|
|
|
|
<h2> Build zlib for arch arm-linux-androideabi</h2> |
|
|
|
|
|
* get sources |
|
|
|
|
|
``` |
|
|
wget http://zlib.net/zlib-1.2.8.tar.gz |
|
|
tar -xvzf zlib-1.2.8.tar.gz |
|
|
``` |
|
|
|
|
|
* build settings |
|
|
|
|
|
``` |
|
|
INSTALLATION_PATH=/path/to/install_directory |
|
|
|
|
|
export CC=arm-linux-androideabi-gcc |
|
|
export CPP=arm-linux-androideabi-g++ |
|
|
export AR=arm-linux-androideabi-ar |
|
|
export prefix=$INSTALLATION_PATH |
|
|
``` |
|
|
|
|
|
* build & install |
|
|
|
|
|
``` |
|
|
make |
|
|
make install |
|
|
``` |
|
|
|
|
|
<h2> Build openSSL for arch arm-linux-androideabi</h2> |
|
|
|
|
|
* get sources |
|
|
|
|
|
``` |
|
|
wget https://www.openssl.org/source/openssl-1.0.1p.tar.gz |
|
|
tar -xvzf openssl-1.0.1p.tar.gz |
|
|
``` |
|
|
|
|
|
* build settings |
|
|
|
|
|
``` |
|
|
#Delete all reference to arm-linux-androideabi arch in your path before pursuing, the following will do this for you |
|
|
|
|
|
INSTALLATION_PATH=/path/to/install_directory |
|
|
|
|
|
wget https://wiki.openssl.org/images/7/70/Setenv-android.sh |
|
|
chmod 777 Setenv-android.sh |
|
|
export ANDROID_NDK_ROOT=/path/to/ndk |
|
|
change _ANDROID_API="android-18" to _ANDROID_API="android-21" in Setecn |
|
|
. ./Setenv-android.sh |
|
|
cd openssl-1.0.1p |
|
|
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org |
|
|
./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir=$INSTALLATION_PATH |
|
|
``` |
|
|
|
|
|
* build |
|
|
|
|
|
``` |
|
|
make depend |
|
|
make all |
|
|
make install |
|
|
``` |
|
|
|
|
|
<h2> Build curl for arch arm-linux-androideabi</h2> |
|
|
|
|
|
* build settings |
|
|
|
|
|
``` |
|
|
#Before all, add standalone toolchain to your path if you dont (remove latter toolchain entry from openssl build and add the one you got from make-standalone.sh script) |
|
|
|
|
|
INSTALLATION_PATH=/path/to/install_directory |
|
|
|
|
|
export CROSS_COMPILE="arm-linux-androideabi" |
|
|
export CPPFLAGS="-I/home/abathur/MyApplication/app/src/main/prebuild/include" #path to zlib and openssl header folder |
|
|
export LDFLAGS="-L/home/abathur/MyApplication/app/src/main/prebuild" #path to zlib and openssl library folder |
|
|
export AR=${CROSS_COMPILE}-ar |
|
|
export AS=${CROSS_COMPILE}-as |
|
|
export LD=${CROSS_COMPILE}-ld |
|
|
export RANLIB=${CROSS_COMPILE}-ranlib |
|
|
export CC=${CROSS_COMPILE}-gcc |
|
|
export NM=${CROSS_COMPILE}-nm |
|
|
export LIBS="-lssl -lcrypto" |
|
|
|
|
|
./configure --host=${CROSS_COMPILE} --with-ssl --with-zlib --disable-ftp --disable-gopher --disable-file --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-proxy --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --without-gnutls --without-libidn --without-librtmp --disable-dict |
|
|
``` |
|
|
|
|
|
* build & install |
|
|
|
|
|
``` |
|
|
make |
|
|
|
|
|
DESTDIR=$INSTALLATION_PATH |
|
|
|
|
|
make install |
|
|
``` |
|
|
|