mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-02-11 00:00:08 +08:00
Squashed 'Sources/OpenVPNAdapter/Libraries/Vendors/openvpn/' content from commit 554d8b888
git-subtree-dir: Sources/OpenVPNAdapter/Libraries/Vendors/openvpn git-subtree-split: 554d8b88817d3a7b836e78940ed61bb11ed2bd9b
This commit is contained in:
55
scripts/android/build-all
Executable file
55
scripts/android/build-all
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the entire core package as required by Android App
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -z "$ECHO" ] && ECHO=0
|
||||
|
||||
if [ "$ECHO" -eq 0 ]; then
|
||||
exec > $O3/android_build.log
|
||||
exec 2>&1
|
||||
fi
|
||||
|
||||
[ -z "$DEP_DIR" ] && export DEP_DIR=${O3}/deps
|
||||
[ -z "$DL" ] && export DL=~/dl
|
||||
|
||||
mkdir -p $DEP_DIR
|
||||
mkdir -p $DL
|
||||
|
||||
export NO_MOD_PATH=1
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
echo BUILD ANDROID SDK
|
||||
$O3/core/scripts/android/build-sdk
|
||||
|
||||
echo BUILD TOOLCHAIN
|
||||
$O3/core/scripts/android/build-toolchain
|
||||
|
||||
echo BUILD DEPS
|
||||
cd $DEP_DIR
|
||||
rm -rf asio* lz4* mbedtls* #lzo* boost* minicrypto openssl* polarssl* snappy*
|
||||
echo "******* ASIO"
|
||||
$O3/core/deps/asio/build-asio
|
||||
echo "******* MBEDTLS"
|
||||
$O3/core/scripts/android/build-mbedtls
|
||||
echo "******* LZ4"
|
||||
$O3/core/scripts/android/build-lz4
|
||||
|
||||
#echo "******* BOOST"
|
||||
#$O3/core/scripts/android/build-boost
|
||||
#echo "******* MINICRYPTO"
|
||||
#$O3/core/scripts/android/build-minicrypto
|
||||
#echo "******* OpenSSL"
|
||||
#$O3/core/scripts/android/build-openssl-small
|
||||
#echo "******* LZO"
|
||||
#$O3/core/scripts/android/build-lzo
|
||||
#echo "******* SNAPPY"
|
||||
#$O3/core/scripts/android/build-snappy
|
||||
|
||||
echo BUILD CORE LIBRARY
|
||||
$O3/core/javacli/build-android
|
||||
|
||||
echo DONE.
|
||||
23
scripts/android/build-boost
Executable file
23
scripts/android/build-boost
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Note: thread library may fail with PAGE_SIZE undefined.
|
||||
# The pthread.h header makes reference to the PAGE_SIZE define however
|
||||
# this only gets defined in <asm/page.h> which is not pulled in by any
|
||||
# of the pthread.h includes. A google-suggested fix was to add
|
||||
# #include <sys/mman.h>, which does indeed work, but may not be the
|
||||
# correct solution for all cases.
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to ovpn3 dependency tree
|
||||
exit 1
|
||||
fi
|
||||
cd $DEP_DIR
|
||||
rm -rf boost
|
||||
mkdir boost
|
||||
export LINK_MODE=static
|
||||
export TARGETS="android-a8a android-a8a-dbg android-a7a android-a7a-dbg android android-dbg"
|
||||
export SDK_PATH_SCRIPT=$O3/core/vars/android-sdk-path
|
||||
$O3/core/deps/boost/build-boost
|
||||
exit 0
|
||||
25
scripts/android/build-lz4
Executable file
25
scripts/android/build-lz4
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to the dependency build directory
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
cd $DEP_DIR
|
||||
rm -rf lz4
|
||||
mkdir lz4
|
||||
|
||||
TARGETS=${TARGETS:-android-a7a android-a8a android-x86}
|
||||
|
||||
for target in $TARGETS; do
|
||||
echo '***************' TARGET $target
|
||||
TARGET=$target $O3/core/deps/lz4/build-lz4
|
||||
done
|
||||
exit 0
|
||||
22
scripts/android/build-lzo
Executable file
22
scripts/android/build-lzo
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to ovpn3 dependency tree
|
||||
exit 1
|
||||
fi
|
||||
cd $DEP_DIR
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
rm -rf lzo
|
||||
mkdir lzo
|
||||
|
||||
for target in android-a8a android-a8a-dbg android-a7a android-a7a-dbg android android-dbg ; do
|
||||
echo '***************' TARGET $target
|
||||
TARGET=$target $O3/core/deps/lzo/build-lzo
|
||||
done
|
||||
exit 0
|
||||
30
scripts/android/build-mbedtls
Executable file
30
scripts/android/build-mbedtls
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to the dependency build directory
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
cd $DEP_DIR
|
||||
rm -rf mbedtls
|
||||
mkdir -p mbedtls
|
||||
|
||||
# disable minicrypto for now
|
||||
mini=0
|
||||
|
||||
TARGETS=${TARGETS:-android-a7a android-a8a android-x86}
|
||||
|
||||
for target in $TARGETS; do
|
||||
echo '***************' TARGET $target
|
||||
VERBOSE=1 TARGET=$target CMAKE_TARGET=android USE_MINICRYPTO=$mini MINICRYPTO_DIR=$(pwd)/minicrypto/minicrypto-$target $O3/core/deps/mbedtls/build-mbedtls
|
||||
[ "$ANDROID_DBG_ONLY" = "1" ] && exit
|
||||
done
|
||||
exit 0
|
||||
22
scripts/android/build-minicrypto
Executable file
22
scripts/android/build-minicrypto
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to ovpn3 dependency tree
|
||||
exit 1
|
||||
fi
|
||||
cd $DEP_DIR
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
rm -rf minicrypto
|
||||
mkdir minicrypto
|
||||
|
||||
for target in android android-dbg android-a7a android-a7a-dbg ; do
|
||||
echo '***************' TARGET $target
|
||||
TARGET=$target $O3/core/deps/minicrypto/build-minicrypto
|
||||
done
|
||||
exit 0
|
||||
39
scripts/android/build-openssl-small
Executable file
39
scripts/android/build-openssl-small
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to ovpn3 dependency tree
|
||||
exit 1
|
||||
fi
|
||||
cd $DEP_DIR
|
||||
. $O3/core/deps/lib-versions
|
||||
. $O3/core/vars/android-sdk-path
|
||||
[ -z "$DL" ] && DL=~/Downloads
|
||||
rm -rf openssl
|
||||
mkdir openssl
|
||||
for TARGET in android-a8a android-a8a-dbg android-a7a android-a7a-dbg android-dbg android ; do
|
||||
. $O3/core/vars/vars-$TARGET
|
||||
export OPENSSL=$OPENSSL_VERSION
|
||||
export DIST=$(pwd)/openssl-$PLATFORM
|
||||
export BIN=$TC/bin
|
||||
rm -rf $DIST
|
||||
rm -rf $OPENSSL
|
||||
tar xfz $DL/$OPENSSL.tar.gz
|
||||
pushd $OPENSSL
|
||||
OSSL_FLAGS="no-shared threads no-idea no-mdc2 no-rc5 no-engine no-comp no-hw no-ssl2 no-ssl3 no-zlib no-rc2 no-cast no-md2 no-ripemd no-camellia no-seed no-krb5 no-socks no-ecdsa no-ec no-ecdh no-md2 no-whirlpool no-dsa no-cms no-jpake no-gost"
|
||||
#OSSL_FLAGS="no-shared threads no-comp no-zlib"
|
||||
./Configure linux-armv4 $OSSL_FLAGS --prefix=$DIST
|
||||
sed -i "" -e "s|-O3|$LIB_OPT_LEVEL $LIB_FPIC $PLATFORM_FLAGS $OTHER_COMPILER_FLAGS|" Makefile
|
||||
sed -i "" -e "s|ERR_load_COMP_strings()|//ERR_load_COMP_strings()|" crypto/err/err_all.c
|
||||
make -j 4 build_libs
|
||||
touch apps/openssl
|
||||
touch openssl.pc
|
||||
touch libcrypto.pc
|
||||
touch libssl.pc
|
||||
make install_sw
|
||||
popd
|
||||
mv $DIST openssl
|
||||
done
|
||||
exit 0
|
||||
27
scripts/android/build-polarssl
Executable file
27
scripts/android/build-polarssl
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to ovpn3 dependency tree
|
||||
exit 1
|
||||
fi
|
||||
cd $DEP_DIR
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
# disable minicrypto for now
|
||||
mini=0
|
||||
|
||||
rm -rf polarssl
|
||||
mkdir polarssl
|
||||
|
||||
for target in android-a8a android-a8a-dbg android-a7a android-a7a-dbg android android-dbg ; do
|
||||
echo '***************' TARGET $target
|
||||
VERBOSE=1 TARGET=$target CMAKE_TARGET=android USE_MINICRYPTO=$mini MINICRYPTO_DIR=$(pwd)/minicrypto/minicrypto-$target $O3/core/deps/polarssl/build-polarssl
|
||||
mv polarssl-$target polarssl/
|
||||
[ "$ANDROID_DBG_ONLY" = "1" ] && exit
|
||||
done
|
||||
exit 0
|
||||
50
scripts/android/build-sdk
Executable file
50
scripts/android/build-sdk
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to the dependency build directory
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -z "$SDK" ] && export SDK=$DEP_DIR/android-sdk
|
||||
|
||||
if [ -d "$SDK" ]; then
|
||||
echo "Android SDK already exists at $SDK. Doing only update"
|
||||
yes | $SDK/tools/bin/sdkmanager --licenses
|
||||
$SDK/tools/bin/sdkmanager --update
|
||||
exit 0
|
||||
fi
|
||||
|
||||
. $O3/core/deps/functions.sh
|
||||
|
||||
FNAME=sdk-tools-linux-3859397.zip
|
||||
URL=https://dl.google.com/android/repository/${FNAME}
|
||||
CSUM=444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0
|
||||
|
||||
download
|
||||
|
||||
cd $DEP_DIR
|
||||
rm -rf android-sdk
|
||||
mkdir android-sdk
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
cd $SDK
|
||||
unzip $DL/$FNAME
|
||||
|
||||
yes | $SDK/tools/bin/sdkmanager --licenses
|
||||
$SDK/tools/bin/sdkmanager --update
|
||||
$SDK/tools/bin/sdkmanager 'build-tools;26.0.2' \
|
||||
'ndk-bundle' \
|
||||
'extras;android;m2repository' \
|
||||
'patcher;v4' \
|
||||
'platform-tools' \
|
||||
'platforms;android-26' \
|
||||
'tools'
|
||||
|
||||
exit 0
|
||||
22
scripts/android/build-snappy
Executable file
22
scripts/android/build-snappy
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
if [ -z "$DEP_DIR" ]; then
|
||||
echo DEP_DIR var must point to ovpn3 dependency tree
|
||||
exit 1
|
||||
fi
|
||||
cd $DEP_DIR
|
||||
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
rm -rf snappy
|
||||
mkdir snappy
|
||||
|
||||
for target in android-a8a android-a8a-dbg android-a7a android-a7a-dbg android android-dbg ; do
|
||||
echo '***************' TARGET $target
|
||||
TARGET=$target $O3/core/deps/snappy/build-snappy
|
||||
done
|
||||
exit 0
|
||||
66
scripts/android/build-toolchain
Executable file
66
scripts/android/build-toolchain
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the Android toolchain (run first)
|
||||
#set -e
|
||||
if [ -z "$O3" ]; then
|
||||
echo O3 var must point to ovpn3 tree ; exit 1
|
||||
fi
|
||||
export DEP_DIR=${DEP_DIR:-$HOME/src/android}
|
||||
export NO_MOD_PATH=1
|
||||
. $O3/core/vars/android-sdk-path
|
||||
|
||||
# 64 bit
|
||||
cd $DEP_DIR
|
||||
DEST=$(pwd)/tc-arm64
|
||||
rm -rf $DEST
|
||||
ABI=aarch64-linux-android
|
||||
ABI_VER=4.9
|
||||
$NDK/build/tools/make-standalone-toolchain.sh \
|
||||
--verbose \
|
||||
--toolchain=$ABI-$ABI_VER \
|
||||
--stl=gnustl \
|
||||
--arch=arm64 \
|
||||
--platform=android-21 \
|
||||
--install-dir=$DEST
|
||||
cd $DEST/$ABI/bin
|
||||
ln -s ../../bin/$ABI-gcc cc
|
||||
ln -s ../../bin/$ABI-gcc gcc
|
||||
ln -s ../../bin/$ABI-g++ g++
|
||||
ln -s ../../libexec/gcc/$ABI/$ABI_VER.x/cc1 cc1
|
||||
ln -s ../../libexec/gcc/$ABI/$ABI_VER.x/cc1plus cc1plus
|
||||
|
||||
# 32 bit
|
||||
cd $DEP_DIR
|
||||
DEST=$(pwd)/tc-arm
|
||||
rm -rf $DEST
|
||||
ABI=arm-linux-androideabi
|
||||
ABI_VER=4.9
|
||||
$NDK/build/tools/make-standalone-toolchain.sh \
|
||||
--verbose \
|
||||
--toolchain=$ABI-$ABI_VER \
|
||||
--stl=gnustl \
|
||||
--arch=arm \
|
||||
--platform=android-14 \
|
||||
--install-dir=$DEST
|
||||
cd $DEST/$ABI/bin
|
||||
ln -s ../../bin/$ABI-gcc cc
|
||||
ln -s ../../libexec/gcc/$ABI/$ABI_VER.x/cc1 cc1
|
||||
ln -s ../../libexec/gcc/$ABI/$ABI_VER.x/cc1plus cc1plus
|
||||
|
||||
# 32 bit x86 for Android emulator
|
||||
cd $DEP_DIR
|
||||
DEST=$(pwd)/tc-x86
|
||||
rm -rf $DEST
|
||||
ABI=x86-linux-android
|
||||
SUB=i686-linux-android
|
||||
ABI_VER=4.9
|
||||
$NDK/build/tools/make-standalone-toolchain.sh \
|
||||
--verbose \
|
||||
--toolchain=$ABI-$ABI_VER \
|
||||
--stl=gnustl \
|
||||
--arch=x86 \
|
||||
--platform=android-14 \
|
||||
--install-dir=$DEST
|
||||
cd $DEST/$SUB/bin
|
||||
ln -s ../../bin/$SUB-gcc cc
|
||||
ln -s ../../libexec/gcc/$SUB/$ABI_VER.x/cc1 cc1
|
||||
ln -s ../../libexec/gcc/$SUB/$ABI_VER.x/cc1plus cc1plus
|
||||
Reference in New Issue
Block a user