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 4 * Prerequisites 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 8 install the actual platform sdk from the available packages tab (SDK Platform 9 - Android 1.5 or above should work). 10 In the virtual devices tab you can also setup a emulator. 11 12 13 Then, make sure you have the ANDROID_SDK_PATH and ANDROID_NDK_PATH (pointing to 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. 16 17 * Build instructions 18 ··· 32 "$ANDROID_SDK_PATH/tools/adb install -r rockbox.apk" 33 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
··· 3 4 * Prerequisites 5 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 install the actual platform sdk from the available packages tab (SDK Platform 9 + Android 4.4 should work). 10 In the virtual devices tab you can also setup a emulator. 11 12 13 Then, make sure you have the ANDROID_SDK_PATH and ANDROID_NDK_PATH (pointing to 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. The installToolchain.sh script will provide reasonable values. 16 17 * Build instructions 18 ··· 32 "$ANDROID_SDK_PATH/tools/adb install -r rockbox.apk" 33 34 35 + [1]: https://developer.android.com/studio 36 + [2]: https://github.com/android/ndk/wiki/Unsupported-Downloads
+23 -31
android/installToolchain.sh
··· 6 # it stopped 7 set -e 8 9 - SDK_DOWNLOAD_URL="http://developer.android.com/sdk/index.html" 10 - NDK_DOWNLOAD_URL="http://developer.android.com/sdk/ndk/index.html" 11 12 find_url() { 13 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 } 17 18 OS=`uname` 19 case $OS in 20 Linux) 21 - SDK_URL=$(find_url $SDK_DOWNLOAD_URL linux) 22 - NDK_URL=$(find_url $NDK_DOWNLOAD_URL linux) 23 - ANDROID=tools/android 24 ;; 25 26 Darwin) 27 - SDK_URL=$(find_url $SDK_DOWNLOAD_URL mac) 28 - NDK_URL=$(find_url $NDK_DOWNLOAD_URL darwin) 29 - ANDROID=tools/android 30 ;; 31 32 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 ;; 37 esac 38 39 prefix="${INSTALL_PREFIX:-$HOME}" 40 dldir="${DOWNLOAD_DIR:-/tmp}" 41 42 - SDK_PATH=$(find $prefix -maxdepth 1 -name "android-sdk-*") 43 NDK_PATH=$(find $prefix -maxdepth 1 -name "android-ndk-*") 44 45 download_and_extract() { ··· 52 fi 53 54 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 69 } 70 71 if [ -z "$SDK_PATH" ]; then 72 download_and_extract $SDK_URL 73 # OS X doesn't know about realname, use basename instead. 74 - SDK_PATH=$prefix/$(basename $prefix/android-sdk-*) 75 fi 76 if [ -z "$NDK_PATH" ]; then 77 download_and_extract $NDK_URL 78 NDK_PATH=$prefix/$(basename $prefix/android-ndk-*) 79 fi 80 81 - if [ -z "$(find $SDK_PATH/platforms -type d -name 'android-*')" ]; then 82 echo " * Installing Android platforms..." 83 - $SDK_PATH/$ANDROID update sdk --no-ui --filter platform,platform-tool,tool 84 fi 85 86 cat <<EOF
··· 6 # it stopped 7 set -e 8 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" 13 14 find_url() { 15 base_url="$1" 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 19 } 20 21 OS=`uname` 22 case $OS in 23 Linux) 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 27 ;; 28 29 Darwin) 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 33 ;; 34 35 CYGWIN*) 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 39 ;; 40 esac 41 42 prefix="${INSTALL_PREFIX:-$HOME}" 43 dldir="${DOWNLOAD_DIR:-/tmp}" 44 45 + SDK_PATH=${ANDROID_HOME:-$(find $prefix -maxdepth 1 -name "android-sdk")} 46 NDK_PATH=$(find $prefix -maxdepth 1 -name "android-ndk-*") 47 48 download_and_extract() { ··· 55 fi 56 57 echo " * Extracting $name..." 58 + unzip -qo -d "$prefix" "$local_file" 59 } 60 61 if [ -z "$SDK_PATH" ]; then 62 + mkdir -p "$prefix/android-sdk/cmdline-tools" 63 download_and_extract $SDK_URL 64 + mv "$prefix/cmdline-tools" "$prefix/android-sdk/cmdline-tools/latest" 65 # OS X doesn't know about realname, use basename instead. 66 + SDK_PATH=$prefix/$(basename $prefix/android-sdk) 67 fi 68 if [ -z "$NDK_PATH" ]; then 69 download_and_extract $NDK_URL 70 NDK_PATH=$prefix/$(basename $prefix/android-ndk-*) 71 fi 72 73 + if [ ! -d "$SDK_PATH/platforms/android-19" ] || [ ! -d "$SDK_PATH/build-tools/19.1.0" ]; then 74 echo " * Installing Android platforms..." 75 + $SDK_PATH/$ANDROID --install "platforms;android-19" "build-tools;19.1.0" 76 fi 77 78 cat <<EOF
+1
docs/CREDITS
··· 730 Dmitry Prozorov 731 Mustafa YILDIZ 732 Lianela Sky 733 734 The libmad team 735 The wavpack team
··· 730 Dmitry Prozorov 731 Mustafa YILDIZ 732 Lianela Sky 733 + Nick Feldmann 734 735 The libmad team 736 The wavpack team
+7 -1
tools/configure
··· 794 exit 795 fi 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" 798 echo "environment variable point to the root directory of the Android NDK." 799 exit 800 fi 801 make_toolchain="${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh" 802 803 # the prebuilt android NDK only supports x86_64 architecture anyway, so we can take shortcuts 804 buildhost=$(uname | tr "[:upper:]" "[:lower:]")-x86_64 ··· 815 ANDROID_PLATFORM_VERSION=$1 816 GCCOPTS="$GCCOPTS $3" 817 gccchoice="4.9" 818 # arch dependant stuff 819 case $ANDROID_ARCH in 820 armeabi)
··· 794 exit 795 fi 796 if [ -z "$ANDROID_NDK_PATH" ]; then 797 + echo "ERROR: You need the Android NDK installed (r10e to r17) and have the ANDROID_NDK_PATH" 798 echo "environment variable point to the root directory of the Android NDK." 799 exit 800 fi 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 807 808 # the prebuilt android NDK only supports x86_64 architecture anyway, so we can take shortcuts 809 buildhost=$(uname | tr "[:upper:]" "[:lower:]")-x86_64 ··· 820 ANDROID_PLATFORM_VERSION=$1 821 GCCOPTS="$GCCOPTS $3" 822 gccchoice="4.9" 823 + rm -rf "${pwd}/android-toolchain" # old toolchain must be removed before running script 824 # arch dependant stuff 825 case $ANDROID_ARCH in 826 armeabi)