1 #!/bin/bash 2 set -e -o pipefail 3 4 # This script builds the go cross compilers for Android targets. 5 # 6 # Usage: build_go 7 # 8 # It assumes that the "arm-linux-androideabi" toolchain is already installed. 9 # It assumes that the "aarch64-linux-android" toolchain is already installed. 10 11 if [[ ! -e "make.bash" && -e "src/make.bash" ]] 12 then 13 cd src 14 fi 15 16 # Build the Go toolchain for arm devices. 17 GOOS="android" GOARCH="arm" CGO_ENABLED="1" \ 18 CC_FOR_TARGET="arm-linux-androideabi-clang" \ 19 CXX_FOR_TARGET="arm-linux-androideabi-clang++" \ 20 ./make.bash --no-clean 21 22 # Build the Go toolchain for arm64 devices. 23 GOOS="android" GOARCH="arm64" CGO_ENABLED="1" \ 24 CC_FOR_TARGET="aarch64-linux-android-clang" \ 25 CXX_FOR_TARGET="aarch64-linux-android-clang++" \ 26 ./make.bash --no-clean 27