summaryrefslogtreecommitdiff
path: root/main/misc
diff options
context:
space:
mode:
Diffstat (limited to 'main/misc')
-rw-r--r--main/misc/build-native.bat22
-rwxr-xr-xmain/misc/build-native.sh48
2 files changed, 70 insertions, 0 deletions
diff --git a/main/misc/build-native.bat b/main/misc/build-native.bat
new file mode 100644
index 00000000..73a19a00
--- /dev/null
+++ b/main/misc/build-native.bat
@@ -0,0 +1,22 @@
+
+@echo on
+echo Currently broken, feel free to fix and send me a patch, see .sh file
+exit 1
+
+call ndk-build APP_API=all -j 8
+
+
+cd libs
+mkdir ..\assets
+mkdir ..\build\
+
+for /D %%f in (*) do (
+ copy %%f\minivpn ..\assets\minivpn.%%f
+ del %%f\libcrypto.so
+ del %%f\libssl.so
+
+ mkdir ..\build\native-libs\%%f\
+ copy %%f\*.so ..\build\native-libs\%%f\
+)
+
+cd ..
diff --git a/main/misc/build-native.sh b/main/misc/build-native.sh
new file mode 100755
index 00000000..37648bd1
--- /dev/null
+++ b/main/misc/build-native.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Exit on errors
+set -e
+
+# Generate git config if the openvpn directory is checked out from git
+if [ -d openvpn/.git ]; then
+ GIT=git
+ cd openvpn
+ CONFIGURE_GIT_CHFILES=$($GIT diff-files --name-status -r --ignore-submodules --quiet -- || echo "+")
+ CONFIGURE_GIT_UNCOMMITTED=$($GIT diff-index --cached --quiet --ignore-submodules HEAD || echo "*")
+ CONFIGURE_GIT_REVISION=$($GIT rev-parse --symbolic-full-name HEAD | cut -d/ -f3)-$($GIT rev-parse --short=16 HEAD)
+ echo "#define CONFIGURE_GIT_REVISION \"${CONFIGURE_GIT_REVISION}\"" > config-version.h.tmp; \
+ echo "#define CONFIGURE_GIT_FLAGS \"${CONFIGURE_GIT_CHFILES}${CONFIGURE_GIT_UNCOMMITTED}\"" >> config-version.h.tmp
+
+ if ! [ -f config-version.h ] || ! cmp -s config-version.h.tmp config-version.h; then \
+ echo "replacing config-version.h"
+ mv config-version.h.tmp config-version.h
+ else
+ rm -f config-version.h.tmp
+ fi
+ cd ..
+fi
+
+ndk-build APP_API=all -j 8
+
+if [ $? = 0 ]; then
+ rm -rf ovpnlibs/
+
+ cd libs
+ mkdir -p ../ovpnlibs/assets
+ for i in *
+ do
+ cp -v $i/minivpn ../ovpnlibs/assets/minivpn.$i
+ done
+ # Removed compiled openssl libs, will use platform so libs
+ # Reduces size of apk
+ rm -v */libcrypto.so */libssl.so
+
+ for arch in *
+ do
+ builddir=../ovpnlibs/jniLibs/$arch
+ mkdir -p $builddir
+ cp -v $arch/*.so $builddir
+ done
+else
+ exit $?
+fi