mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-02-13 00:41:07 +00:00
Update install-ndk.sh script
This commit is contained in:
parent
cf2ac06d63
commit
d66fd1d215
@ -30,6 +30,11 @@
|
||||
# SDK for r22: https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
|
||||
# SDK for Mac: https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip
|
||||
|
||||
# Platform tools
|
||||
# Linux: https://dl.google.com/android/repository/platform-tools-latest-linux.zip
|
||||
# Mac: https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
|
||||
# Windows: https://dl.google.com/android/repository/platform-tools-latest-windows.zip
|
||||
|
||||
if [ -z "$ANDROID_SDK_ROOT" ]; then
|
||||
echo "ERROR: ANDROID_SDK_ROOT is not set. Please set it."
|
||||
echo "SDK root is $ANDROID_SDK_ROOT"
|
||||
@ -49,9 +54,11 @@ IS_LINUX=$(uname -s 2>/dev/null | grep -i -c linux)
|
||||
if [ "$IS_LINUX" -eq 1 ]; then
|
||||
SDK_URL=https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
|
||||
NDK_URL=https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
|
||||
TOOLS_URL=https://dl.google.com/android/repository/platform-tools-latest-linux.zip
|
||||
elif [ "$IS_DARWIN" -eq 1 ]; then
|
||||
SDK_URL=https://dl.google.com/android/repository/commandlinetools-mac-6200805_latest.zip
|
||||
NDK_URL=https://dl.google.com/android/repository/android-ndk-r20b-darwin-x86_64.zip
|
||||
TOOLS_URL=https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
|
||||
else
|
||||
echo "Unknown platform: \"$(uname -s 2>/dev/null)\". Please fix this script."
|
||||
fi
|
||||
@ -63,41 +70,74 @@ if [ -n "$(command -v apt-get)" ]; then
|
||||
fi
|
||||
|
||||
echo "Downloading SDK"
|
||||
if ! curl -s -o android-sdk.zip "$SDK_URL";
|
||||
if ! curl -L -s -o android-sdk.zip "$SDK_URL";
|
||||
then
|
||||
echo "Failed to download SDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Downloading NDK"
|
||||
if ! curl -s -o android-ndk.zip "$NDK_URL";
|
||||
if ! curl -L -s -o android-ndk.zip "$NDK_URL";
|
||||
then
|
||||
echo "Failed to download NDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Downloading Platform Tools"
|
||||
if ! curl -L -s -o platform-tools.zip "$TOOLS_URL";
|
||||
then
|
||||
echo "Failed to download Platform Tools"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Unpacking SDK to $ANDROID_SDK_ROOT"
|
||||
if ! unzip -qq android-sdk.zip -d "$ANDROID_SDK_ROOT";
|
||||
if ! unzip -u -qq android-sdk.zip -d "$ANDROID_SDK_ROOT";
|
||||
then
|
||||
echo "Failed to unpack SDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Unpacking NDK to $ANDROID_NDK_ROOT"
|
||||
if ! unzip -qq android-ndk.zip -d "$HOME";
|
||||
if ! unzip -u -qq android-ndk.zip -d "$HOME";
|
||||
then
|
||||
echo "Failed to unpack NDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! mv "$HOME/android-ndk-r20b" "$ANDROID_NDK_ROOT";
|
||||
echo "Unpacking Platform Tools to $ANDROID_SDK_ROOT"
|
||||
if ! unzip -u -qq platform-tools.zip -d "$ANDROID_SDK_ROOT";
|
||||
then
|
||||
echo "Failed to move $HOME/android-ndk-r20b to $ANDROID_NDK_ROOT"
|
||||
echo "Failed to unpack Platform Tools"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Unlink as needed
|
||||
if [[ -d "$ANDROID_NDK_ROOT" ]];then
|
||||
ls_output=$(ls -l "$ANDROID_NDK_ROOT" 2>/dev/null | head -n 1)
|
||||
if [[ ${ls_output:0:1} == "l" ]]; then
|
||||
unlink "$ANDROID_NDK_ROOT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove an old directory
|
||||
rm -rf "$(dirname "$ANDROID_NDK_ROOT")/android-ndk-r20b"
|
||||
|
||||
# Place the new directory
|
||||
if ! mv "$HOME/android-ndk-r20b" $(dirname "$ANDROID_NDK_ROOT");
|
||||
then
|
||||
echo "Failed to move $HOME/android-ndk-r20b to $(dirname "$ANDROID_NDK_ROOT")"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run in a subshell
|
||||
(
|
||||
cd $(dirname "$ANDROID_NDK_ROOT")
|
||||
ln -s android-ndk-r20b android-ndk
|
||||
)
|
||||
|
||||
rm -f android-sdk.zip
|
||||
rm -f android-ndk.zip
|
||||
rm -f platform-tools.zip
|
||||
|
||||
# We don't set ANDROID_HOME to ANDROID_SDK_ROOT.
|
||||
# https://stackoverflow.com/a/47028911/608639
|
||||
|
Loading…
x
Reference in New Issue
Block a user