diff options
author | Parménides GV <parmegv@sdf.org> | 2014-04-09 16:03:55 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-04-09 16:07:34 +0200 |
commit | 1684c8f398922065a97e7da4dac4ac6a33cc5218 (patch) | |
tree | 76a4b11ae0d7b217c088f3c2b8fc7e69a7b8ae0d /app/build-native.sh | |
parent | b9a2b085a8f508cd09e2639c70be845c992c4a3e (diff) |
Back to the standard "app" module.
This return to "app" instead of "bitmask_android" is due to this reading: https://developer.android.com/sdk/installing/studio-build.html#projectStructure
I'll have to tweak the final apk name in build.gradle.
Diffstat (limited to 'app/build-native.sh')
-rwxr-xr-x | app/build-native.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/app/build-native.sh b/app/build-native.sh new file mode 100755 index 00000000..c7ef60a7 --- /dev/null +++ b/app/build-native.sh @@ -0,0 +1,52 @@ +#!/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 + +if [ "x$1" = "x" ]; then + ndk-build APP_API=all -j 8 +else + ndk-build $@ +fi + +if [ $? = 0 ]; then + rm -rf ovpnlibs/ + + cd libs + mkdir -p ../ovpnlibs/assets + for i in $(find * -type d) + 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 $(find * -type d) + do + builddir=../ovpnlibs/jniLibs/$arch + mkdir -p $builddir + cp -v $arch/*.so $builddir + done +else + exit $? +fi |