Ed-Yang / strongswan-android

8 stars 5 forks source link

Building the Strongswan for Android on OSX (High Sierra)

Reference

Install Build Tools and Library

NOTE. If you use bison 2.x which come with OSX, it will fail to build "settings_parser.y", so please ensure the bison is version 3.x by "bison -V".

To install the new bison and make it will be executed in building process, you can do:

    $ brew install bison
    $ brew link bison --force
    $ source ~/.bash_profile

Prepare Strongswan and OpenSSL (BoringSSL) Source Tree

For building in OSX, try to put the source in case-insensitive filesystem (the default filesystem), or when use the Android Studio to build the app, it will complains the file system setting is not the same as IDE.

    # Make source folder
    $ git clone https://github.com/Ed-Yang/strongswan-android.git
    $ cd strongswan-android

    # Get strongswan latest source
    $ git clone git://git.strongswan.org/strongswan.git
    $ export SS_HOME=`pwd`/strongswan

    $ cd ./strongswan/src/frontends/android/app/src/main/jni

    # Get boringssl source 
    $ git clone git://git.strongswan.org/android-ndk-boringssl.git -b ndk-static openssl

    or 

    # Get openssl source (NOT WORK !!!!)
    $ git clone git://git.strongswan.org/android-ndk-openssl.git -b ndk-static openssl

    $ cd ${SS_HOME}

    # See Alexandre Duret Lutz's Autotools tutorial for aclocal (I did not read....)
    $ aclocal -I m4
    $ ./autogen.sh
    $ ./configure
    $ make dist

    Done

Take a note, if we want to clean the source tree:

    $ make maintainer-clean

Install and Setup Android Studio

Build Native Part

Building the App

Run APP

Author

Edward Yang, June 16, 2018.