2020-06-24 16:15:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-11-22 09:57:13 +00:00
|
|
|
V2RAY_CORE_VERSION="4.33.0"
|
2020-10-04 10:14:58 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
if [ ! -x "$(command -v go)" ]; then
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-10-09 17:35:17 +00:00
|
|
|
# if [ ! -x "$(command -v gvm)" ]; then
|
|
|
|
#
|
2020-10-25 15:16:26 +00:00
|
|
|
# apt install -y bison gcc make
|
2020-10-09 17:35:17 +00:00
|
|
|
# bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
|
|
|
|
# source "$HOME/.bashrc"
|
|
|
|
#
|
|
|
|
# fi
|
|
|
|
#
|
2020-11-22 09:57:13 +00:00
|
|
|
# gvm install go1.15.5 -B
|
|
|
|
# gvm use go1.15.5 --default
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
echo "install golang please!"
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
exit 1
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
fi
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
if [ ! -x "$(command -v rustc)" ]; then
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-10-09 17:35:17 +00:00
|
|
|
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
# echo "source \$HOME/.cargo/env" >> $HOME/.bashrc && source $HOME/.cargo/env
|
|
|
|
# rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
echo "install rust please!"
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
exit 1
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
fi
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-08-10 10:20:22 +00:00
|
|
|
if [ -z "$ANDROID_HOME" ]; then
|
|
|
|
if [ -d "$HOME/Android/Sdk" ]; then
|
|
|
|
export ANDROID_HOME="$HOME/Android/Sdk"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
if [ ! -f "$ANDROID_HOME/ndk-bundle/source.properties" ]; then
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/21.3.6528147
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
fi
|
2020-06-24 16:15:30 +00:00
|
|
|
|
2020-07-27 04:49:42 +00:00
|
|
|
rm -rf TMessagesProj/libs/*.aar
|
|
|
|
./gradlew ss-rust:assembleRelease --stacktrace &&
|
2020-10-09 17:35:17 +00:00
|
|
|
cp ss-rust/build/outputs/aar/* TMessagesProj/libs &&
|
|
|
|
./gradlew ssr-libev:assembleRelease &&
|
|
|
|
cp ssr-libev/build/outputs/aar/* TMessagesProj/libs &&
|
|
|
|
cd TMessagesProj/libs &&
|
2020-11-22 09:57:13 +00:00
|
|
|
go get -v golang.org/x/mobile/cmd/...
|
|
|
|
|
|
|
|
v2rayCore="$(go env GOPATH)/src/v2ray.com/core"
|
|
|
|
|
|
|
|
if [ ! -d "$v2rayCore" ]; then
|
|
|
|
|
|
|
|
mkdir -p "$v2rayCore"
|
|
|
|
git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION"
|
|
|
|
cd "$v2rayCore"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
cd "$v2rayCore"
|
2020-11-27 18:18:29 +00:00
|
|
|
git fetch origin "v$V2RAY_CORE_VERSION" && git reset "v$V2RAY_CORE_VERSION" --hard || git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION"
|
2020-11-22 09:57:13 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
go mod download
|
|
|
|
cd "$OLDPWD"
|
|
|
|
|
|
|
|
go get -d github.com/2dust/AndroidLibV2rayLite &&
|
2020-10-09 17:35:17 +00:00
|
|
|
gomobile init &&
|
|
|
|
gomobile bind -v -ldflags='-s -w' github.com/2dust/AndroidLibV2rayLite &&
|
|
|
|
rm *-sources.jar &&
|
|
|
|
cd ../.. &&
|
|
|
|
./gradlew TMessagesProj:stripFullFossDebugSymbols &&
|
|
|
|
OUT=TMessagesProj/build/intermediates/stripped_native_libs/fullFoss/out/lib &&
|
|
|
|
DIR=TMessagesProj/src/main/libs &&
|
|
|
|
rm -rf $DIR/armeabi-v7a &&
|
|
|
|
mkdir -p $DIR/armeabi-v7a &&
|
|
|
|
cp $OUT/armeabi-v7a/libtmessages*.so $DIR/armeabi-v7a &&
|
|
|
|
rm -rf $DIR/arm64-v8a &&
|
|
|
|
mkdir -p $DIR/arm64-v8a &&
|
|
|
|
cp $OUT/arm64-v8a/libtmessages*.so $DIR/arm64-v8a &&
|
|
|
|
rm -rf $DIR/x86 &&
|
|
|
|
mkdir -p $DIR/x86 &&
|
|
|
|
cp $OUT/x86/libtmessages*.so $DIR/x86 &&
|
|
|
|
rm -rf $DIR/x86_64 &&
|
|
|
|
mkdir -p $DIR/x86_64 &&
|
|
|
|
cp $OUT/x86_64/libtmessages*.so $DIR/x86_64
|