forked from bitmold/OrbotIPtProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-orbot.sh
executable file
·50 lines (42 loc) · 1.01 KB
/
build-orbot.sh
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
46
47
48
49
50
#!/bin/sh
rm -f ../OrbotLib.aar
rm -f ../OrbotLib-sources.jar
# should match Orbot's...
export MIN_ANDROID_SDK=23
if [ -d IPtProxy ]; then
cd IPtProxy
git clean -fdx
git reset --hard
git submodule update --init --recursive
else
git submodule update --init --recursive
cd IPtProxy || exit 1
fi
cd ..
cp OrbotTun.go/* IPtProxy/IPtProxy.go/
if test -d "$TMPDIR"; then
:
elif test -d "$TMP"; then
TMPDIR=$TMP
elif test -d /var/tmp; then
TMPDIR=/var/tmp
else
TMPDIR=/tmp
fi
TEMPDIR="$TMPDIR/IPtProxy"
printf '\n\n--- Prepare build environment at %s...\n' "$TEMPDIR"
cd IPtProxy/IPtProxy.go
go mod tidy
go get golang.org/x/mobile/bind
cd ..
CURRENT=$PWD
rm -rf "$TEMPDIR"
mkdir -p "$TEMPDIR"
cp -a . "$TEMPDIR/"
printf '\n\n--- Compile %s...\n' "$OUTPUT"
export PATH=~/go/bin:$PATH
cd "$TEMPDIR/IPtProxy.go" || exit 1
gomobile init
gomobile bind -o "OrbotLib.aar" -ldflags="-w -s -checklinkname=0" -target=android -androidapi="$MIN_ANDROID_SDK" -v -trimpath
cp -v OrbotLib* "$CURRENT/.."
printf '\n\nDone\n'