A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

android: make installToolchains.sh work again

Google changed their site and the layout of downloaded SDK zips.
Also add a warning to configure if a r2x series NDK version is used, because those aren't supported - they no longer contain GCC, only clang.

Change-Id: I48a42c38c9b657ac6662162a39763aac73ec502a

authored by

Nick Feldmann and committed by
Solomon Peachy
f1b53d12 e79996e0

+37 -40
+6 -8
android/README
··· 3 3 4 4 * Prerequisites 5 5 6 - Download and install the Android SDK[1] and NDK[2], or run installToolchain.sh. 7 - After you extracted the SDK, you need to run <sdk-dir>/tools/android in order to 6 + Download and install the Android SDK[1] and NDK r10e[2], or run installToolchain.sh. 7 + After you extracted the SDK, you need to run the SDKManager in order to 8 8 install the actual platform sdk from the available packages tab (SDK Platform 9 - Android 1.5 or above should work). 9 + Android 4.4 should work). 10 10 In the virtual devices tab you can also setup a emulator. 11 11 12 12 13 13 Then, make sure you have the ANDROID_SDK_PATH and ANDROID_NDK_PATH (pointing to 14 14 the each's root directory) environment variables set up, otherwise configure will fail to find the compiler and 15 - compiling the java files will fail. 15 + compiling the java files will fail. The installToolchain.sh script will provide reasonable values. 16 16 17 17 * Build instructions 18 18 ··· 32 32 "$ANDROID_SDK_PATH/tools/adb install -r rockbox.apk" 33 33 34 34 35 - [1]: http://developer.android.com/sdk/index.html 36 - [2]: http://developer.android.com/sdk/ndk/index.html 37 - [3]: http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/ 38 - [4]: http://developer.android.com/sdk/installing.html 35 + [1]: https://developer.android.com/studio 36 + [2]: https://github.com/android/ndk/wiki/Unsupported-Downloads
+23 -31
android/installToolchain.sh
··· 6 6 # it stopped 7 7 set -e 8 8 9 - SDK_DOWNLOAD_URL="http://developer.android.com/sdk/index.html" 10 - NDK_DOWNLOAD_URL="http://developer.android.com/sdk/ndk/index.html" 9 + SDK_DOWNLOAD_URL="https://developer.android.com/studio" 10 + SDK_DOWNLOAD_KEYWORD="commandlinetools" 11 + NDK_DOWNLOAD_URL="https://github.com/android/ndk/wiki/Unsupported-Downloads" 12 + NDK_DOWNLOAD_KEYWORD="r10e" 11 13 12 14 find_url() { 13 15 base_url="$1" 14 - os="$2" 15 - wget -q -O - $base_url | grep dl.google.com | sed 's/.*"\(http:\/\/.*\)".*/\1/' | grep $os | grep -v bundle | grep -v .exe # Windows hack 16 + keyword="$2" 17 + os="$3" 18 + wget -q -O - $base_url | grep dl.google.com | sed 's/.*"\(https:\/\/dl.google.com\/.*\.zip\)".*/\1/' | grep $os | grep $keyword | grep -v bundle | grep -v .exe 16 19 } 17 20 18 21 OS=`uname` 19 22 case $OS in 20 23 Linux) 21 - SDK_URL=$(find_url $SDK_DOWNLOAD_URL linux) 22 - NDK_URL=$(find_url $NDK_DOWNLOAD_URL linux) 23 - ANDROID=tools/android 24 + SDK_URL=$(find_url $SDK_DOWNLOAD_URL $SDK_DOWNLOAD_KEYWORD linux) 25 + NDK_URL=$(find_url $NDK_DOWNLOAD_URL $NDK_DOWNLOAD_KEYWORD linux) 26 + ANDROID=cmdline-tools/latest/bin/sdkmanager 24 27 ;; 25 28 26 29 Darwin) 27 - SDK_URL=$(find_url $SDK_DOWNLOAD_URL mac) 28 - NDK_URL=$(find_url $NDK_DOWNLOAD_URL darwin) 29 - ANDROID=tools/android 30 + SDK_URL=$(find_url $SDK_DOWNLOAD_URL $SDK_DOWNLOAD_KEYWORD mac) 31 + NDK_URL=$(find_url $NDK_DOWNLOAD_URL $NDK_DOWNLOAD_KEYWORD darwin) 32 + ANDROID=cmdline-tools/latest/bin/sdkmanager 30 33 ;; 31 34 32 35 CYGWIN*) 33 - SDK_URL=$(find_url $SDK_DOWNLOAD_URL windows) 34 - NDK_URL=$(find_url $NDK_DOWNLOAD_URL windows) 35 - ANDROID=tools/android.bat 36 + SDK_URL=$(find_url $SDK_DOWNLOAD_URL $SDK_DOWNLOAD_KEYWORD windows) 37 + NDK_URL=$(find_url $NDK_DOWNLOAD_URL $NDK_DOWNLOAD_KEYWORD windows) 38 + ANDROID=cmdline-tools/latest/bin/sdkmanager.exe 36 39 ;; 37 40 esac 38 41 39 42 prefix="${INSTALL_PREFIX:-$HOME}" 40 43 dldir="${DOWNLOAD_DIR:-/tmp}" 41 44 42 - SDK_PATH=$(find $prefix -maxdepth 1 -name "android-sdk-*") 45 + SDK_PATH=${ANDROID_HOME:-$(find $prefix -maxdepth 1 -name "android-sdk")} 43 46 NDK_PATH=$(find $prefix -maxdepth 1 -name "android-ndk-*") 44 47 45 48 download_and_extract() { ··· 52 55 fi 53 56 54 57 echo " * Extracting $name..." 55 - case ${local_file} in 56 - *.zip) 57 - unzip -qo -d "$prefix" "$local_file" 58 - ;; 59 - *.tgz|*.tar.gz) 60 - (cd $prefix; tar -xzf "$local_file") 61 - ;; 62 - *.tar.bz2) 63 - (cd $prefix; tar -xjf "$local_file") 64 - ;; 65 - *) 66 - echo "Couldn't figure out how to extract $local_file" ! 1>&2 67 - ;; 68 - esac 58 + unzip -qo -d "$prefix" "$local_file" 69 59 } 70 60 71 61 if [ -z "$SDK_PATH" ]; then 62 + mkdir -p "$prefix/android-sdk/cmdline-tools" 72 63 download_and_extract $SDK_URL 64 + mv "$prefix/cmdline-tools" "$prefix/android-sdk/cmdline-tools/latest" 73 65 # OS X doesn't know about realname, use basename instead. 74 - SDK_PATH=$prefix/$(basename $prefix/android-sdk-*) 66 + SDK_PATH=$prefix/$(basename $prefix/android-sdk) 75 67 fi 76 68 if [ -z "$NDK_PATH" ]; then 77 69 download_and_extract $NDK_URL 78 70 NDK_PATH=$prefix/$(basename $prefix/android-ndk-*) 79 71 fi 80 72 81 - if [ -z "$(find $SDK_PATH/platforms -type d -name 'android-*')" ]; then 73 + if [ ! -d "$SDK_PATH/platforms/android-19" ] || [ ! -d "$SDK_PATH/build-tools/19.1.0" ]; then 82 74 echo " * Installing Android platforms..." 83 - $SDK_PATH/$ANDROID update sdk --no-ui --filter platform,platform-tool,tool 75 + $SDK_PATH/$ANDROID --install "platforms;android-19" "build-tools;19.1.0" 84 76 fi 85 77 86 78 cat <<EOF
+1
docs/CREDITS
··· 730 730 Dmitry Prozorov 731 731 Mustafa YILDIZ 732 732 Lianela Sky 733 + Nick Feldmann 733 734 734 735 The libmad team 735 736 The wavpack team
+7 -1
tools/configure
··· 794 794 exit 795 795 fi 796 796 if [ -z "$ANDROID_NDK_PATH" ]; then 797 - echo "ERROR: You need the Android NDK installed (r10e or higher) and have the ANDROID_NDK_PATH" 797 + echo "ERROR: You need the Android NDK installed (r10e to r17) and have the ANDROID_NDK_PATH" 798 798 echo "environment variable point to the root directory of the Android NDK." 799 799 exit 800 800 fi 801 801 make_toolchain="${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh" 802 + if [ ! -f "$make_toolchain" ]; then 803 + echo "ERROR: You need the Android NDK installed (r10e to r17). Please note that" 804 + echo "versions newer than r17 are not supported because they do not contain GCC." 805 + exit 806 + fi 802 807 803 808 # the prebuilt android NDK only supports x86_64 architecture anyway, so we can take shortcuts 804 809 buildhost=$(uname | tr "[:upper:]" "[:lower:]")-x86_64 ··· 815 820 ANDROID_PLATFORM_VERSION=$1 816 821 GCCOPTS="$GCCOPTS $3" 817 822 gccchoice="4.9" 823 + rm -rf "${pwd}/android-toolchain" # old toolchain must be removed before running script 818 824 # arch dependant stuff 819 825 case $ANDROID_ARCH in 820 826 armeabi)