2022-04-15 11:24:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-05-28 00:24:50 +02:00
|
|
|
set -e -u
|
|
|
|
|
2022-04-15 11:24:57 +02:00
|
|
|
: "${TERMUX_PKG_TMPDIR:="/tmp"}"
|
|
|
|
|
2016-05-28 00:24:50 +02:00
|
|
|
# Install desired parts of the Android SDK:
|
2018-08-15 16:52:18 +02:00
|
|
|
. $(cd "$(dirname "$0")"; pwd)/properties.sh
|
2022-04-15 11:24:57 +02:00
|
|
|
. $(cd "$(dirname "$0")"; pwd)/build/termux_download.sh
|
2018-08-27 22:25:51 +02:00
|
|
|
|
2022-04-23 08:58:02 +02:00
|
|
|
ANDROID_SDK_FILE=commandlinetools-linux-${TERMUX_SDK_REVISION}_latest.zip
|
2021-09-16 21:51:29 +02:00
|
|
|
ANDROID_SDK_SHA256=124f2d5115eee365df6cf3228ffbca6fc3911d16f8025bebd5b1c6e2fcfa7faf
|
|
|
|
ANDROID_NDK_FILE=android-ndk-r${TERMUX_NDK_VERSION}-linux.zip
|
2021-10-22 16:08:49 +02:00
|
|
|
ANDROID_NDK_SHA256=c6e97f9c8cfe5b7be0a9e6c15af8e7a179475b7ded23e2d1c1fa0945d6fb4382
|
2016-05-28 00:24:50 +02:00
|
|
|
if [ ! -d $ANDROID_HOME ]; then
|
|
|
|
mkdir -p $ANDROID_HOME
|
|
|
|
cd $ANDROID_HOME/..
|
2019-02-12 09:41:30 +01:00
|
|
|
rm -Rf $(basename $ANDROID_HOME)
|
2016-05-28 00:24:50 +02:00
|
|
|
|
2017-05-20 21:17:00 +02:00
|
|
|
# https://developer.android.com/studio/index.html#command-tools
|
2018-08-27 22:25:51 +02:00
|
|
|
echo "Downloading android sdk..."
|
2022-04-15 11:24:57 +02:00
|
|
|
termux_download https://dl.google.com/android/repository/${ANDROID_SDK_FILE} \
|
2022-04-23 08:58:02 +02:00
|
|
|
tools-$TERMUX_SDK_REVISION.zip \
|
2022-04-15 11:24:57 +02:00
|
|
|
$ANDROID_SDK_SHA256
|
2022-04-23 08:58:02 +02:00
|
|
|
rm -Rf android-sdk-$TERMUX_SDK_REVISION
|
|
|
|
unzip -q tools-$TERMUX_SDK_REVISION.zip -d android-sdk-$TERMUX_SDK_REVISION
|
2016-05-28 00:24:50 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d $NDK ]; then
|
|
|
|
mkdir -p $NDK
|
|
|
|
cd $NDK/..
|
2019-02-12 09:41:30 +01:00
|
|
|
rm -Rf $(basename $NDK)
|
2018-08-27 22:25:51 +02:00
|
|
|
echo "Downloading android ndk..."
|
2022-04-15 11:24:57 +02:00
|
|
|
termux_download https://dl.google.com/android/repository/${ANDROID_NDK_FILE} \
|
|
|
|
ndk-r${TERMUX_NDK_VERSION}.zip \
|
|
|
|
$ANDROID_NDK_SHA256
|
2018-08-15 16:52:18 +02:00
|
|
|
rm -Rf android-ndk-r$TERMUX_NDK_VERSION
|
2022-04-15 11:24:57 +02:00
|
|
|
unzip -q ndk-r${TERMUX_NDK_VERSION}.zip
|
2016-05-28 00:24:50 +02:00
|
|
|
fi
|
|
|
|
|
2021-09-16 21:51:29 +02:00
|
|
|
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses
|
2017-11-02 00:21:36 +01:00
|
|
|
|
2019-04-27 22:47:56 +02:00
|
|
|
# The android platforms are used in the ecj and apksigner packages:
|
2021-09-16 21:51:29 +02:00
|
|
|
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME \
|
|
|
|
"platform-tools" \
|
|
|
|
"build-tools;${TERMUX_ANDROID_BUILD_TOOLS_VERSION}" \
|
2022-03-10 14:41:59 +01:00
|
|
|
"platforms;android-32" \
|
2021-09-16 21:51:29 +02:00
|
|
|
"platforms;android-28" \
|
|
|
|
"platforms;android-24" \
|
|
|
|
"platforms;android-21"
|