-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_android.sh
executable file
·40 lines (33 loc) · 1.04 KB
/
build_android.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
#!/bin/bash
os=android
android_compiler_dir=\
$ANDROID_HOME/ndk/27.0.12077973/toolchains/llvm/prebuilt/linux-x86_64/bin
build()
{
local android_arch=$1
local go_arch=$2
local android_sdk_version=$3
local compiler=$(printf '%s/%s-linux-%s-clang' \
"$android_compiler_dir" \
"$android_arch" "$android_sdk_version")
cd client && \
CC="$compiler" GOOS="$os" GOARCH="$go_arch" CGO_ENABLED=1 go build \
-o ../bin/twilight-line-go-client-"$os"-"$android_arch" && \
cd - >/dev/null
if [ $? -ne 0 ]; then return 1; fi
cd server && \
CC="$compiler" GOOS="$os" GOARCH="$go_arch" CGO_ENABLED=1 go build \
-o ../bin/twilight-line-go-server-"$os"-"$android_arch" && \
cd - >/dev/null
if [ $? -ne 0 ]; then return 1; fi
return 0
}
build aarch64 arm64 android35
if [ $? -ne 0 ]; then exit 1; fi
build armv7a arm androideabi35
if [ $? -ne 0 ]; then exit 1; fi
build x86_64 amd64 android35
if [ $? -ne 0 ]; then exit 1; fi
build i686 386 android35
if [ $? -ne 0 ]; then exit 1; fi
exit 0