diff options
-rw-r--r-- | .hgignore | 6 | ||||
-rwxr-xr-x | build-native.sh | 11 | ||||
-rw-r--r-- | jni/Android.mk | 10 | ||||
-rw-r--r-- | jni/Application.mk | 2 | ||||
-rw-r--r-- | openssl/crypto/Android.mk | 44 | ||||
-rw-r--r-- | openssl/ssl/Android.mk | 26 | ||||
-rw-r--r-- | openvpn/Android.mk | 7 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/LaunchVPN.java | 26 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/OpenVPNThread.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 2 |
10 files changed, 82 insertions, 54 deletions
@@ -45,4 +45,8 @@ openvpn/sample/Makefile.in openvpn/src/Makefile.in openvpn/src/compat/Makefile.in openvpn/src/openvpnserv/Makefile.in -openvpn/tests/Makefile.in
\ No newline at end of file +openvpn/tests/Makefile.in +assets/minivpn.armeabi +assets/minivpn.armeabi-v7a +assets/minivpn.mips +assets/minivpn.x86
\ No newline at end of file diff --git a/build-native.sh b/build-native.sh new file mode 100755 index 00000000..af9fcf57 --- /dev/null +++ b/build-native.sh @@ -0,0 +1,11 @@ +ndk-build APP_API=all -j 8 +if [ $? = 0 ]; then + cd libs + for i in * + do + cp -v $i/minivpn ../assets/minivpn.$i + done + # Removed compiled openssl libs, will use platform so libs + # Reduces size of apk + rm -v */libcrypto.so */libssl.so +fi
\ No newline at end of file diff --git a/jni/Android.mk b/jni/Android.mk index 3de07059..ee137f81 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -1,5 +1,6 @@ # Path of the sources + JNI_DIR := $(call my-dir) include lzo/Android.mk @@ -13,19 +14,18 @@ LOCAL_PATH := $(JNI_DIR) # The only real JNI library include $(CLEAR_VARS) -LOCAL_LDLIBS := -llog +LOCAL_LDLIBS := -llog -lz LOCAL_C_INCLUDES := openssl/include openssl/crypto openssl LOCAL_SRC_FILES:= jniglue.c jbcrypto.cpp LOCAL_MODULE = opvpnutil -LOCAL_STATIC_LIBRARIES := libcrypto_static +LOCAL_SHARED_LIBRARIES := libcrypto include $(BUILD_SHARED_LIBRARY) - include $(CLEAR_VARS) -LOCAL_LDLIBS := -llog +LOCAL_LDLIBS := -lz +LOCAL_SHARED_LIBRARIES := libssl libcrypto openvpn LOCAL_SRC_FILES:= minivpn.c LOCAL_MODULE = minivpn -LOCAL_SHARED_LIBRARIES=openvpn include $(BUILD_EXECUTABLE) diff --git a/jni/Application.mk b/jni/Application.mk index 2000103b..e33410ed 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -1,4 +1,4 @@ -#APP_ABI := armeabi-v7a +APP_ABI := all #APP_PLATFORM := android-14 #APP_OPTIM := release diff --git a/openssl/crypto/Android.mk b/openssl/crypto/Android.mk index b0a3bcc3..70aef35d 100644 --- a/openssl/crypto/Android.mk +++ b/openssl/crypto/Android.mk @@ -504,30 +504,30 @@ include $(BUILD_STATIC_LIBRARY) ####################################### # target shared library -# include $(CLEAR_VARS) -# include $(LOCAL_PATH)/../android-config.mk +include $(CLEAR_VARS) +include $(LOCAL_PATH)/../android-config.mk -# ifneq ($(TARGET_ARCH),x86) -# LOCAL_NDK_VERSION := 5 -# LOCAL_SDK_VERSION := 9 -# # Use the NDK prebuilt libz and libdl. -# LOCAL_LDFLAGS += -lz -ldl -# else -# LOCAL_SHARED_LIBRARIES += libz libdl -# endif +#ifneq ($(TARGET_ARCH),x86) +#LOCAL_NDK_VERSION := 5 +#LOCAL_SDK_VERSION := 9 +## Use the NDK prebuilt libz and libdl. +LOCAL_LDFLAGS += -lz -ldl +#else +#LOCAL_SHARED_LIBRARIES += libz libdl +#endif -# LOCAL_SRC_FILES += $(local_src_files) -# LOCAL_CFLAGS += $(local_c_flags) -# LOCAL_C_INCLUDES += $(local_c_includes) -# ifeq ($(TARGET_ARCH),arm) -# LOCAL_SRC_FILES += $(arm_src_files) -# LOCAL_CFLAGS += $(arm_cflags) -# else -# LOCAL_SRC_FILES += $(non_arm_src_files) -# endif -# LOCAL_MODULE_TAGS := optional -# LOCAL_MODULE:= libcrypto -# include $(BUILD_SHARED_LIBRARY) +LOCAL_SRC_FILES += $(local_src_files) +LOCAL_CFLAGS += $(local_c_flags) +LOCAL_C_INCLUDES += $(local_c_includes) +ifeq ($(TARGET_ARCH),arm) + LOCAL_SRC_FILES += $(arm_src_files) + LOCAL_CFLAGS += $(arm_cflags) +else + LOCAL_SRC_FILES += $(non_arm_src_files) +endif +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE:= libcrypto +include $(BUILD_SHARED_LIBRARY) ####################################### # Host shared library diff --git a/openssl/ssl/Android.mk b/openssl/ssl/Android.mk index 87af2f3e..1319d5e1 100644 --- a/openssl/ssl/Android.mk +++ b/openssl/ssl/Android.mk @@ -1,5 +1,5 @@ LOCAL_PATH:= $(call my-dir) - + local_c_includes := \ openssl \ openssl/include \ @@ -61,18 +61,18 @@ include $(BUILD_STATIC_LIBRARY) ####################################### # target shared library -# include $(CLEAR_VARS) -# include $(LOCAL_PATH)/../android-config.mk +include $(CLEAR_VARS) +include $(LOCAL_PATH)/../android-config.mk -# ifneq ($(TARGET_ARCH),x86) -# LOCAL_NDK_VERSION := 5 -# LOCAL_SDK_VERSION := 9 -# endif -# LOCAL_SRC_FILES += $(local_src_files) -# LOCAL_C_INCLUDES += $(local_c_includes) -# LOCAL_SHARED_LIBRARIES += libcrypto -# LOCAL_MODULE_TAGS := optional -# LOCAL_MODULE:= libssl -# include $(BUILD_SHARED_LIBRARY) +ifneq ($(TARGET_ARCH),x86) +LOCAL_NDK_VERSION := 5 +LOCAL_SDK_VERSION := 9 +endif +LOCAL_SRC_FILES += $(local_src_files) +LOCAL_C_INCLUDES += $(local_c_includes) +LOCAL_SHARED_LIBRARIES += libcrypto +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE:= libssl +include $(BUILD_SHARED_LIBRARY) diff --git a/openvpn/Android.mk b/openvpn/Android.mk index 2008adb1..4c12b15a 100644 --- a/openvpn/Android.mk +++ b/openvpn/Android.mk @@ -3,11 +3,12 @@ LOCAL_PATH:= $(call my-dir)/ include $(CLEAR_VARS) -LOCAL_LDLIBS := -lz -llog +LOCAL_LDLIBS := -lz LOCAL_C_INCLUDES := openssl/include lzo/include openssl/crypto openssl openvpn/src/compat openvpn/src/openvpn openvpn/include -#LOCAL_SHARED_LIBRARIES := libssl libcrypto liblzo -LOCAL_STATIC_LIBRARIES := libssl_static libcrypto_static liblzo-static +LOCAL_SHARED_LIBRARIES := libssl libcrypto +#LOCAL_STATIC_LIBRARIES := libssl_static libcrypto_static liblzo-static +LOCAL_STATIC_LIBRARIES := liblzo-static LOCAL_CFLAGS= -DHAVE_CONFIG_H diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index a3fb0829..04294c33 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -32,6 +32,7 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; import android.net.VpnService; +import android.os.Build; import android.os.Bundle; import android.os.Parcelable; import android.preference.PreferenceManager; @@ -82,7 +83,6 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { private boolean mCmfixed=false; - static boolean minivpnwritten=false; @Override public void onCreate(Bundle icicle) { @@ -224,14 +224,25 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } private boolean writeMiniVPN() { - File mvpnout = new File(getCacheDir(),"minivpn"); + File mvpnout = new File(getCacheDir(),"miniovpn"); if (mvpnout.exists() && mvpnout.canExecute()) return true; - if(minivpnwritten) - return true; + IOException e2 = null; + try { - InputStream mvpn = getAssets().open("minivpn"); + + + InputStream mvpn; + + try { + mvpn = getAssets().open("minivpn." + Build.CPU_ABI); + } + catch (IOException errabi) { + e2=errabi; + mvpn = getAssets().open("minivpn." + Build.CPU_ABI2); + } + FileOutputStream fout = new FileOutputStream(mvpnout); @@ -246,10 +257,11 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { if(!mvpnout.setExecutable(true)) return false; - - minivpnwritten=true; + return true; } catch (IOException e) { + if(e2!=null) + OpenVPN.logMessage(0, "",e2.getLocalizedMessage()); OpenVPN.logMessage(0, "",e.getLocalizedMessage()); e.printStackTrace(); return false; diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java index 22a08763..4477fa5f 100644 --- a/src/de/blinkt/openvpn/OpenVPNThread.java +++ b/src/de/blinkt/openvpn/OpenVPNThread.java @@ -58,7 +58,7 @@ public class OpenVPNThread implements Runnable { // Hack O rama
// Hack until I find a good way to get the real library path
- String applibpath = argv[0].replace("/cache/minivpn", "/lib");
+ String applibpath = argv[0].replace("/cache/miniovpn", "/lib");
String lbpath = pb.environment().get("LD_LIBRARY_PATH");
if(lbpath==null)
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 8d506f9b..91c4c494 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -428,7 +428,7 @@ public class VpnProfile implements Serializable{ // Add fixed paramenters //args.add("/data/data/de.blinkt.openvpn/lib/openvpn"); - args.add(cacheDir.getAbsolutePath() +"/" +"minivpn"); + args.add(cacheDir.getAbsolutePath() +"/" +"miniovpn"); args.add("--config"); args.add(cacheDir.getAbsolutePath() + "/" + OVPNCONFIGFILE); |