forked from tladesignz/IPtProxy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·59 lines (48 loc) · 1.6 KB
/
build.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
51
52
53
54
55
56
57
58
59
#!/bin/sh
TARGET=ios
OUTPUT=IPtProxy.xcframework
if test "$1" = "android"; then
TARGET=android
OUTPUT=IPtProxy.aar
fi
cd "$(dirname "$0")" || exit 1
if test -e $OUTPUT; then
echo "--- No build necessary, $OUTPUT already exists."
exit
fi
# Install dependencies. Go itself is a prerequisite.
printf '\n--- Golang 1.16 or up needs to be installed! Try "brew install go" on MacOS or "snap install go" on Linux if we fail further down!'
printf '\n--- Installing gomobile...\n'
go install golang.org/x/mobile/cmd/gomobile@latest
# Fetch submodules obfs4 and snowflake.
printf '\n\n--- Fetching Obfs4proxy and Snowflake dependencies...\n'
if test -e ".git"; then
# There's a .git directory - we must be in the development pod.
git submodule update --init --recursive
cd obfs4 || exit 1
git reset --hard
cd ../snowflake || exit 1
git reset --hard
cd ..
else
# No .git directory - That's a normal install.
git clone https://gitlab.com/yawning/obfs4.git
cd obfs4 || exit 1
git checkout --force --quiet cbf3f3cf
cd ..
git clone https://git.torproject.org/pluggable-transports/snowflake.git
cd snowflake || exit 1
git checkout --force --quiet ead5a960
cd ..
fi
# Apply patches.
printf '\n\n--- Apply patches to Obfs4proxy and Snowflake...\n'
patch --directory=obfs4 --strip=1 < obfs4.patch
patch --directory=snowflake --strip=1 < snowflake.patch
# Compile framework.
printf '\n\n--- Compile %s...\n' "$OUTPUT"
export PATH=~/go/bin:$PATH
cd IPtProxy.go || exit 1
gomobile init
gomobile bind -target=$TARGET -o ../$OUTPUT -iosversion 11.0 -v
printf '\n\n--- Done.\n\n'