2021-01-16 16:25:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ -z "$ANDROID_HOME" ]; then
|
|
|
|
if [ -d "$HOME/Android/Sdk" ]; then
|
|
|
|
export ANDROID_HOME="$HOME/Android/Sdk"
|
2021-03-26 02:01:53 +00:00
|
|
|
elif [ -d "$HOME/.local/lib/android/sdk" ]; then
|
|
|
|
export ANDROID_HOME="$HOME/.local/lib/android/sdk"
|
2021-01-16 16:25:30 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-03-26 02:01:53 +00:00
|
|
|
_NDK="$ANDROID_HOME/ndk/21.4.7075529"
|
2021-03-05 15:09:24 +00:00
|
|
|
[ -f "$_NDK/source.properties" ] || _NDK="$ANDROID_NDK_HOME"
|
|
|
|
[ -f "$_NDK/source.properties" ] || _NDK="$NDK"
|
|
|
|
[ -f "$_NDK/source.properties" ] || _NDK="$ANDROID_HOME/ndk-bundle"
|
|
|
|
|
|
|
|
if [ ! -f "$_NDK/source.properties" ]; then
|
|
|
|
echo "Error: NDK not found."
|
|
|
|
exit 1
|
2021-01-16 16:25:30 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-05 15:09:24 +00:00
|
|
|
export ANDROID_NDK_HOME=$_NDK
|
|
|
|
export NDK=$_NDK
|
|
|
|
export PROJECT=$(realpath .)
|
2021-01-16 16:25:30 +00:00
|
|
|
|
2021-03-05 15:09:24 +00:00
|
|
|
if [ ! $(command -v go) ]; then
|
|
|
|
if [ -d /usr/lib/go-1.16 ]; then
|
|
|
|
export PATH=$PATH:/usr/lib/go-1.16/bin
|
2021-03-08 15:05:59 +00:00
|
|
|
elif [ -d $HOME/.go ]; then
|
|
|
|
export PATH=$PATH:$HOME/.go/bin
|
2021-03-05 15:09:24 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $(command -v go) ]; then
|
|
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
|
|
|
fi
|