Android.mk for NDK build added.
authorTobias Brunner <tobias@strongswan.org>
Fri, 17 Feb 2012 14:40:57 +0000 (15:40 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 8 Aug 2012 13:09:30 +0000 (15:09 +0200)
src/frontends/android/README.ndk [new file with mode: 0644]
src/frontends/android/jni/.gitignore [new file with mode: 0644]
src/frontends/android/jni/Android.mk [new file with mode: 0644]
src/frontends/android/jni/vstr/Android.mk [new file with mode: 0644]

diff --git a/src/frontends/android/README.ndk b/src/frontends/android/README.ndk
new file mode 100644 (file)
index 0000000..dc0df1f
--- /dev/null
@@ -0,0 +1,19 @@
+To build this within the NDK several things have to be added in the jni
+folder:
+
+ - strongswan: The strongSwan sources.  This can either be an extracted tarball,
+   or a symlink to the Git repository.  To build from the repository the sources
+   have to be prepared first: ./autogen && ./configure && make && make distclean
+
+ - openssl: The OpenSSL sources.  Since the sources need to be changed to be
+   built on Android (and especially in the NDK), we provide a modified mirror
+   of the official Android OpenSSL version on git.strongswan.org.
+
+ - vstr: The Vstr string library.  Since cross-compiling this library is not
+   that easy with the configure script and Makefiles included in the tarball,
+   the easiest way to build it is still to use droid-gcc (as described on
+   wiki.strongswan.org).  The build script provided on the wiki builds the
+   library and copies the required header files to the configured installation
+   directory.  Please note that the Android.mk provided on the wiki (vstr.mk)
+   does not work in the NDK.  A replacement is already in place in jni/vstr.
+
diff --git a/src/frontends/android/jni/.gitignore b/src/frontends/android/jni/.gitignore
new file mode 100644 (file)
index 0000000..90fd652
--- /dev/null
@@ -0,0 +1,4 @@
+openssl
+strongswan
+vstr/libvstr.a
+vstr/include
diff --git a/src/frontends/android/jni/Android.mk b/src/frontends/android/jni/Android.mk
new file mode 100644 (file)
index 0000000..74c6c6a
--- /dev/null
@@ -0,0 +1,62 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+strongswan_CHARON_PLUGINS := android-log openssl fips-prf random nonce pubkey \
+       pkcs1 pem xcbc hmac socket-default \
+       eap-identity eap-mschapv2 eap-md5
+
+strongswan_PLUGINS := $(strongswan_CHARON_PLUGINS)
+
+include $(LOCAL_PATH)/strongswan/Android.common.mk
+
+# includes
+strongswan_PATH := $(LOCAL_PATH)/strongswan
+libvstr_PATH := $(LOCAL_PATH)/vstr/include
+openssl_PATH := $(LOCAL_PATH)/openssl/include
+
+# CFLAGS (partially from a configure run using droid-gcc)
+strongswan_CFLAGS := \
+       -Wno-format \
+       -Wno-pointer-sign \
+       -Wno-pointer-arith \
+       -Wno-sign-compare \
+       -Wno-strict-aliasing \
+       -DHAVE___BOOL \
+       -DHAVE_STDBOOL_H \
+       -DHAVE_ALLOCA_H \
+       -DHAVE_ALLOCA \
+       -DHAVE_CLOCK_GETTIME \
+       -DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC \
+       -DHAVE_PRCTL \
+       -DHAVE_LINUX_UDP_H \
+       -DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
+       -DHAVE_IPSEC_MODE_BEET \
+       -DHAVE_IPSEC_DIR_FWD \
+       -DOPENSSL_NO_EC \
+       -DOPENSSL_NO_ECDSA \
+       -DOPENSSL_NO_ECDH \
+       -DOPENSSL_NO_ENGINE \
+       -DCONFIG_H_INCLUDED \
+       -DCAPABILITIES \
+       -DCAPABILITIES_NATIVE \
+       -DMONOLITHIC \
+       -DUSE_IKEV1 \
+       -DUSE_IKEV2 \
+       -DUSE_VSTR \
+       -DDEBUG \
+       -DCHARON_UDP_PORT=4000 \
+       -DVERSION=\"$(strongswan_VERSION)\" \
+       -DDEV_RANDOM=\"/dev/random\" \
+       -DDEV_URANDOM=\"/dev/urandom\"
+
+# only for Android 2.0+
+strongswan_CFLAGS += \
+       -DHAVE_IN6ADDR_ANY
+
+include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
+               vstr \
+               openssl \
+               strongswan/src/libcharon \
+               strongswan/src/libhydra \
+               strongswan/src/libstrongswan \
+))
diff --git a/src/frontends/android/jni/vstr/Android.mk b/src/frontends/android/jni/vstr/Android.mk
new file mode 100644 (file)
index 0000000..87355a6
--- /dev/null
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := libvstr.a
+
+LOCAL_MODULE := libvstr
+
+LOCAL_PRELINK_MODULE := false
+
+include $(PREBUILT_STATIC_LIBRARY)