mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Add OS X support to install-ndk.sh
This commit is contained in:
parent
51b2df1012
commit
d9112d3fe3
@ -27,7 +27,7 @@ PLATFORMS=(armv7a aarch64 x86 x86_64)
|
|||||||
|
|
||||||
for platform in "${PLATFORMS[@]}"
|
for platform in "${PLATFORMS[@]}"
|
||||||
do
|
do
|
||||||
# setenv-ioandroids.sh reads these two variables for configuration info.
|
# setenv-android.sh reads these two variables for configuration info.
|
||||||
export ANDROID_API="23"
|
export ANDROID_API="23"
|
||||||
export ANDROID_CPU="$platform"
|
export ANDROID_CPU="$platform"
|
||||||
|
|
||||||
|
@ -10,12 +10,15 @@
|
|||||||
|
|
||||||
# NDK-r19: https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip
|
# NDK-r19: https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip
|
||||||
# SDK for r19: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
|
# SDK for r19: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
|
||||||
|
# SDK for Mac: https://dl.google.com/android/repository/sdk-tools-mac-4333796.zip
|
||||||
|
|
||||||
# NDK-r20: https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
|
# NDK-r20: https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
|
||||||
# SDK for r20: https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
|
# SDK for r20: https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
|
||||||
|
# SDK for Mac: https://dl.google.com/android/repository/commandlinetools-mac-6200805_latest.zip
|
||||||
|
|
||||||
# NDK-r21: https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip
|
# NDK-r21: https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip
|
||||||
# SDK for r21: https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
|
# SDK for r21: https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
|
||||||
|
# SDK for Mac: https://dl.google.com/android/repository/commandlinetools-mac-6200805_latest.zip
|
||||||
|
|
||||||
if [ -z "$ANDROID_SDK_ROOT" ]; then
|
if [ -z "$ANDROID_SDK_ROOT" ]; then
|
||||||
echo "ERROR: ANDROID_SDK_ROOT is not set. Please set it."
|
echo "ERROR: ANDROID_SDK_ROOT is not set. Please set it."
|
||||||
@ -29,47 +32,58 @@ if [ -z "$ANDROID_NDK_ROOT" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
|
IS_DARWIN=$(uname -s 2>/dev/null | grep -i -c darwin)
|
||||||
echo "Using ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
|
IS_LINUX=$(uname -s 2>/dev/null | grep -i -c linux)
|
||||||
|
|
||||||
|
# Keep this in sync with the move at the end.
|
||||||
|
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
|
||||||
|
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
|
||||||
|
else
|
||||||
|
echo "Unknown platform: \"$(uname -s 2>/dev/null)\". Please fix this script."
|
||||||
|
fi
|
||||||
|
|
||||||
# install android deps
|
# install android deps
|
||||||
if [ -n "$(command -v apt-get)" ]; then
|
if [ -n "$(command -v apt-get)" ]; then
|
||||||
apt-get -qq update
|
apt-get -qq update 2>/dev/null
|
||||||
apt-get -qq install --no-install-recommends openjdk-8-jdk unzip
|
apt-get -qq install --no-install-recommends openjdk-8-jdk unzip curl 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading SDK"
|
echo "Downloading SDK"
|
||||||
if ! curl -k -s -o android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip;
|
if ! curl -k -s -o android-sdk.zip "$SDK_URL";
|
||||||
then
|
then
|
||||||
echo "Failed to download SDK"
|
echo "Failed to download SDK"
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading NDK"
|
echo "Downloading NDK"
|
||||||
if ! curl -k -s -o android-ndk.zip https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip;
|
if ! curl -k -s -o android-ndk.zip "$NDK_URL";
|
||||||
then
|
then
|
||||||
echo "Failed to download NDK"
|
echo "Failed to download NDK"
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Unpacking SDK to $ANDROID_SDK_ROOT"
|
echo "Unpacking SDK to $ANDROID_SDK_ROOT"
|
||||||
if ! unzip -qq android-sdk.zip -d "$ANDROID_SDK_ROOT";
|
if ! unzip -qq android-sdk.zip -d "$ANDROID_SDK_ROOT";
|
||||||
then
|
then
|
||||||
echo "Failed to unpack SDK"
|
echo "Failed to unpack SDK"
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Unpacking NDK to $ANDROID_NDK_ROOT"
|
echo "Unpacking NDK to $ANDROID_NDK_ROOT"
|
||||||
if ! unzip -qq android-ndk.zip -d "$HOME";
|
if ! unzip -qq android-ndk.zip -d "$HOME";
|
||||||
then
|
then
|
||||||
echo "Failed to unpack NDK"
|
echo "Failed to unpack NDK"
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! mv "$HOME/android-ndk-r19c" "$ANDROID_NDK_ROOT";
|
if ! mv "$HOME/android-ndk-r20b" "$ANDROID_NDK_ROOT";
|
||||||
then
|
then
|
||||||
echo "Failed to move $HOME/android-ndk-r19c to $ANDROID_NDK_ROOT"
|
echo "Failed to move $HOME/android-ndk-r20b to $ANDROID_NDK_ROOT"
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f android-sdk.zip
|
rm -f android-sdk.zip
|
||||||
@ -81,4 +95,4 @@ touch "$ANDROID_SDK_ROOT/repositories.cfg"
|
|||||||
|
|
||||||
echo "Finished preparing SDK and NDK"
|
echo "Finished preparing SDK and NDK"
|
||||||
|
|
||||||
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
|
exit 0
|
||||||
|
@ -169,7 +169,7 @@ esac
|
|||||||
export IS_ANDROID=1
|
export IS_ANDROID=1
|
||||||
|
|
||||||
export CPP CC CXX LD AS AR RANLIB STRIP
|
export CPP CC CXX LD AS AR RANLIB STRIP
|
||||||
export ANDROID_CXXFLAGS ANDROID_API ANDROID_SYSROOT
|
export ANDROID_CXXFLAGS ANDROID_API ANDROID_CPU ANDROID_SYSROOT
|
||||||
|
|
||||||
# Do NOT use ANDROID_SYSROOT_INC or ANDROID_SYSROOT_LD
|
# Do NOT use ANDROID_SYSROOT_INC or ANDROID_SYSROOT_LD
|
||||||
# https://github.com/android/ndk/issues/894#issuecomment-470837964
|
# https://github.com/android/ndk/issues/894#issuecomment-470837964
|
||||||
|
Loading…
Reference in New Issue
Block a user