From: Jason Cooper <cyanogen at lakedaemon.net> Signed-off-by: Jason Cooper <cyanogen at lakedaemon.net> --- Android.mk | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.c | 2 + tun.c | 3 ++ 3 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..ec3dab6 --- /dev/null +++ b/Android.mk @@ -0,0 +1,91 @@ +LOCAL_PATH:= $(call my-dir) + +### From openvpn Android.mk ### + +#on a 32bit maschine run ./configure --enable-password-save --disable-pkcs11 --with-ifconfig-path=/system/bin/ifconfig --with-route-path=/system/bin/route +#from generated Makefile copy variable contents of openvpn_SOURCES to common_SRC_FILES +# append missing.c to the end of the list +# missing.c defines undefined functions. +# in tun.c replace /dev/net/tun with /dev/tun + +### End from openvpn Android.mk ### + +common_SRC_FILES:= \ + auth.c \ + cstp.c \ + dtls.c \ + http.c \ + library.c \ + main.c \ + mainloop.c \ + openconnect.h \ + openconnect-internal.h \ + ssl.c \ + ssl_ui.c \ + tun.c \ + version.c \ + xml.c + +#common_CFLAGS += -DNO_WINDOWS_BRAINDEATH +common_CFLAGS += -DANDROID_CHANGES -DIFF_TUN + +common_C_INCLUDES += \ + $(JNI_H_INCLUDE) \ + $(LOCAL_PATH)/WebKit/android/icu \ + external/ \ + external/icu4c/common \ + external/icu4c/i18n \ + external/libxml2/include \ + bionic/libc/include/ \ + external/openssl \ + external/openssl/include \ + external/openssl/crypto \ + external/zlib \ + frameworks/base/cmds/keystore + +common_SHARED_LIBRARIES := libcutils \ + libz \ + libicuuc \ + libicui18n + + +ifneq ($(TARGET_SIMULATOR),true) + common_SHARED_LIBRARIES += libdl +endif + +# static linked binary +# ===================================================== + +#include $(CLEAR_VARS) +#LOCAL_SRC_FILES:= $(common_SRC_FILES) +#LOCAL_CFLAGS:= $(common_CFLAGS) +#LOCAL_C_INCLUDES:= $(common_C_INCLUDES) +# +#LOCAL_SHARED_LIBRARIES += $(common_SHARED_LIBRARIES) +#LOCAL_STATIC_LIBRARIES:= libopenssl-static liblzo-static +# +##LOCAL_LDLIBS += -ldl +##LOCAL_PRELINK_MODULE:= false +# +#LOCAL_MODULE:= openconnect-static +#LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) +#include $(BUILD_EXECUTABLE) + +# dynamic linked binary +# ===================================================== + +include $(CLEAR_VARS) +LOCAL_SRC_FILES:= $(common_SRC_FILES) +LOCAL_CFLAGS:= $(common_CFLAGS) +LOCAL_C_INCLUDES:= $(common_C_INCLUDES) + +LOCAL_SHARED_LIBRARIES:= $(common_SHARED_LIBRARIES) libssl libcrypto libz +LOCAL_STATIC_LIBRARIES:= libxml2 liblog + +#LOCAL_LDLIBS += -ldl +#LOCAL_PRELINK_MODULE:= false + +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE:= openconnect +LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) +include $(BUILD_EXECUTABLE) diff --git a/main.c b/main.c index 38c51bf..40c7184 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,9 @@ #include <fcntl.h> #include <unistd.h> #include <pwd.h> +#ifndef ANDROID_CHANGES #include <sys/syslog.h> +#endif #include <sys/utsname.h> #include <sys/types.h> #include <openssl/ui.h> diff --git a/tun.c b/tun.c index 669b01f..280e66b 100644 --- a/tun.c +++ b/tun.c @@ -38,6 +38,9 @@ #include <arpa/inet.h> #include <errno.h> #include <ctype.h> +#ifdef ANDROID_CHANGES +#include <linux/if_tun.h> +#endif #if defined(__sun__) #include <stropts.h> #include <sys/sockio.h> -- 1.7.0.4