Build libfreeswan on Android.
[strongswan.git] / Android.mk.in
1 LOCAL_PATH := $(call my-dir)
2 include $(CLEAR_VARS)
3
4 # this is the list of plugins that are built into libstrongswan and charon
5 # also these plugins are loaded by default (if not changed in strongswan.conf)
6 strongswan_PLUGINS := openssl fips-prf random pubkey pkcs1 \
7 pem xcbc hmac kernel-netlink socket-default android \
8 stroke eap-identity eap-mschapv2 eap-md5
9
10 # helper macros to only add source files for plugins included in the list above
11 # source files are relative to the android.mk that called the macro
12 plugin_enabled = $(findstring $(1), $(strongswan_PLUGINS))
13 add_plugin = $(if $(call plugin_enabled,$(1)), \
14 $(patsubst $(LOCAL_PATH)/%,%, \
15 $(wildcard \
16 $(subst %,$(subst -,_,$(strip $(1))), \
17 $(LOCAL_PATH)/plugins/%/%*.c \
18 ) \
19 ) \
20 ) \
21 )
22
23 # includes
24 strongswan_PATH := $(LOCAL_PATH)
25 libvstr_PATH := external/strongswan-support/vstr/include
26 libgmp_PATH := external/strongswan-support/gmp
27
28 # some definitions
29 strongswan_VERSION := "@PACKAGE_VERSION@"
30 strongswan_DIR := "/system/bin"
31 strongswan_SBINDIR := "/system/bin"
32 strongswan_PIDDIR := "/data/misc/vpn"
33 strongswan_PLUGINDIR := "$(strongswan_IPSEC_DIR)/ipsec"
34 strongswan_CONFDIR := "/system/etc"
35 strongswan_STRONGSWAN_CONF := "$(strongswan_CONFDIR)/strongswan.conf"
36
37 # CFLAGS (partially from a configure run using droid-gcc)
38 strongswan_CFLAGS := \
39 -Wno-format \
40 -Wno-pointer-sign \
41 -Wno-pointer-arith \
42 -Wno-sign-compare \
43 -Wno-strict-aliasing \
44 -DHAVE___BOOL \
45 -DHAVE_STDBOOL_H \
46 -DHAVE_ALLOCA_H \
47 -DHAVE_ALLOCA \
48 -DHAVE_CLOCK_GETTIME \
49 -DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC \
50 -DHAVE_PRCTL \
51 -DHAVE_LINUX_UDP_H \
52 -DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
53 -DHAVE_IPSEC_MODE_BEET \
54 -DHAVE_IPSEC_DIR_FWD \
55 -DOPENSSL_NO_EC \
56 -DOPENSSL_NO_ECDSA \
57 -DOPENSSL_NO_ECDH \
58 -DOPENSSL_NO_ENGINE \
59 -DCAPABILITIES \
60 -DCAPABILITIES_NATIVE \
61 -DMONOLITHIC \
62 -DUSE_VSTR \
63 -DROUTING_TABLE=0 \
64 -DROUTING_TABLE_PRIO=220 \
65 -DVERSION=\"$(strongswan_VERSION)\" \
66 -DPLUGINS='"$(strongswan_PLUGINS)"' \
67 -DPLUGINDIR=\"$(strongswan_PLUGINDIR)\" \
68 -DIPSEC_DIR=\"$(strongswan_DIR)\" \
69 -DIPSEC_PIDDIR=\"$(strongswan_PIDDIR)\" \
70 -DIPSEC_CONFDIR=\"$(strongswan_CONFDIR)\" \
71 -DSTRONGSWAN_CONF=\"$(strongswan_STRONGSWAN_CONF)\" \
72 -DDEV_RANDOM=\"/dev/random\" \
73 -DDEV_URANDOM=\"/dev/urandom\"
74
75 # only for Android 2.0+
76 strongswan_CFLAGS += \
77 -DHAVE_IN6ADDR_ANY
78
79 include $(addprefix $(LOCAL_PATH)/src/,$(addsuffix /Android.mk, \
80 charon \
81 libcharon \
82 libhydra \
83 libstrongswan \
84 libtncif \
85 libfreeswan \
86 ))