Skip to content

Instantly share code, notes, and snippets.

@danoli3
Forked from bertrandmartel/build_curl.md
Created May 19, 2021 23:28
Show Gist options
  • Select an option

  • Save danoli3/58fa898cdd4c86a8804252478b23a32a to your computer and use it in GitHub Desktop.

Select an option

Save danoli3/58fa898cdd4c86a8804252478b23a32a to your computer and use it in GitHub Desktop.

Revisions

  1. @bertrandmartel bertrandmartel revised this gist May 19, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build_curl.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ 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``
    * <a href="https://developer.android.com/ndk/guides/standalone_toolchain.html">standalone toolchain generated and added to path</a> : ``PATH=$PATH:/home/user/android-toolchain/bin``

    <h2> Build zlib for arch arm-linux-androideabi</h2>

  2. @bertrandmartel bertrandmartel revised this gist May 19, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions build_curl.md
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,7 @@ Prerequisites :
    ```
    wget http://zlib.net/zlib-1.2.8.tar.gz
    tar -xvzf zlib-1.2.8.tar.gz
    cd zlib-1.2.8
    ```

    * build settings
    @@ -35,6 +36,7 @@ export prefix=$INSTALLATION_PATH
    * build & install

    ```
    ./configure
    make
    make install
    ```
  3. @bertrandmartel bertrandmartel created this gist Oct 4, 2015.
    108 changes: 108 additions & 0 deletions build_curl.md
    Original file line number Diff line number Diff line change
    @@ -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
    ```