forked from guardianproject/orbot-android
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_shadowsocks.sh
More file actions
executable file
·45 lines (34 loc) · 1.48 KB
/
build_shadowsocks.sh
File metadata and controls
executable file
·45 lines (34 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# We can't use rust-android-gradle to build shadowsocks-rust, since it uses functionality that
# breaks with gradle 9. Rust binaries for shadowsocks can be built via shadowsocks-android which
# uses the plugin...
# Rust Android Gradle Plugin:
# https://github.com/mozilla/rust-android-gradle/
# Open PR for gradle 9 support:
# https://github.com/mozilla/rust-android-gradle/pull/168
set -eo pipefail
if ! command -v rustup >/dev/null 2>&1; then
echo >&2 "Error: rustup is not installed. Please install before running this script."
exit 1
fi
cd "$(dirname "$0")"
ROOT="$(pwd -P)"
BUILDDIR="$(mktemp -d)"
LOG="$ROOT/build_shadowsocks.log"
echo "Build log: $LOG"
cd "$BUILDDIR"
echo "Builddir: $BUILDDIR" > "$LOG" 2>&1
echo "- Cloning shadowsocks-android and submodules…"
git clone --recursive --shallow-submodules --depth 1 https://github.com/shadowsocks/shadowsocks-android >> "$LOG" 2>&1
echo "- Adding android native targets for rust…"
rustup target add armv7-linux-androideabi aarch64-linux-android x86_64-linux-android >> "$LOG" 2>&1
echo "- Building shadowsocks-android…"
cd "shadowsocks-android"
./gradlew mergeReleaseJniLibFolders -PTARGET_ABI=arm >> "$LOG" 2>&1
./gradlew mergeReleaseJniLibFolders -PTARGET_ABI=arm64 >> "$LOG" 2>&1
./gradlew mergeReleaseJniLibFolders -PTARGET_ABI=x86_64 >> "$LOG" 2>&1
echo "- Copy created so files…"
cp -a core/build/rustJniLibs/android/* "$ROOT/app/src/main/jniLibs/" >> "$LOG" 2>&1
echo "- Cleanup…"
cd "$ROOT"
rm -rf "$BUILDDIR"