diff options
author | Nick Feldmann <nift4@protonmail.com> | 2024-12-31 14:57:57 +0100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2025-01-01 09:59:34 -0500 |
commit | f1b53d129f6e37a50151ea23fe2a80ece2c94568 (patch) | |
tree | 4f6b2fbe1e6c53074ba68686e78f6b607607f0a2 | |
parent | e79996e031ada89b2050b6974027d439e73020c6 (diff) | |
download | rockbox-f1b53d129f.tar.gz rockbox-f1b53d129f.zip |
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
-rw-r--r-- | android/README | 14 | ||||
-rwxr-xr-x | android/installToolchain.sh | 54 | ||||
-rw-r--r-- | docs/CREDITS | 1 | ||||
-rwxr-xr-x | tools/configure | 8 |
4 files changed, 37 insertions, 40 deletions
diff --git a/android/README b/android/README index 98069fcba6..97d474b0de 100644 --- a/android/README +++ b/android/README @@ -3,16 +3,16 @@ application for android. * Prerequisites -Download and install the Android SDK[1] and NDK[2], or run installToolchain.sh. -After you extracted the SDK, you need to run <sdk-dir>/tools/android in order to +Download and install the Android SDK[1] and NDK r10e[2], or run installToolchain.sh. +After you extracted the SDK, you need to run the SDKManager in order to install the actual platform sdk from the available packages tab (SDK Platform -Android 1.5 or above should work). +Android 4.4 should work). In the virtual devices tab you can also setup a emulator. Then, make sure you have the ANDROID_SDK_PATH and ANDROID_NDK_PATH (pointing to the each's root directory) environment variables set up, otherwise configure will fail to find the compiler and -compiling the java files will fail. +compiling the java files will fail. The installToolchain.sh script will provide reasonable values. * Build instructions @@ -32,7 +32,5 @@ compiling the java files will fail. "$ANDROID_SDK_PATH/tools/adb install -r rockbox.apk" -[1]: http://developer.android.com/sdk/index.html -[2]: http://developer.android.com/sdk/ndk/index.html -[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/ -[4]: http://developer.android.com/sdk/installing.html +[1]: https://developer.android.com/studio +[2]: https://github.com/android/ndk/wiki/Unsupported-Downloads diff --git a/android/installToolchain.sh b/android/installToolchain.sh index 3cdf27b9cd..dafea0f250 100755 --- a/android/installToolchain.sh +++ b/android/installToolchain.sh @@ -6,40 +6,43 @@ # it stopped set -e -SDK_DOWNLOAD_URL="http://developer.android.com/sdk/index.html" -NDK_DOWNLOAD_URL="http://developer.android.com/sdk/ndk/index.html" +SDK_DOWNLOAD_URL="https://developer.android.com/studio" +SDK_DOWNLOAD_KEYWORD="commandlinetools" +NDK_DOWNLOAD_URL="https://github.com/android/ndk/wiki/Unsupported-Downloads" +NDK_DOWNLOAD_KEYWORD="r10e" find_url() { base_url="$1" - os="$2" - wget -q -O - $base_url | grep dl.google.com | sed 's/.*"\(http:\/\/.*\)".*/\1/' | grep $os | grep -v bundle | grep -v .exe # Windows hack + keyword="$2" + os="$3" + 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 } OS=`uname` case $OS in Linux) - SDK_URL=$(find_url $SDK_DOWNLOAD_URL linux) - NDK_URL=$(find_url $NDK_DOWNLOAD_URL linux) - ANDROID=tools/android + SDK_URL=$(find_url $SDK_DOWNLOAD_URL $SDK_DOWNLOAD_KEYWORD linux) + NDK_URL=$(find_url $NDK_DOWNLOAD_URL $NDK_DOWNLOAD_KEYWORD linux) + ANDROID=cmdline-tools/latest/bin/sdkmanager ;; Darwin) - SDK_URL=$(find_url $SDK_DOWNLOAD_URL mac) - NDK_URL=$(find_url $NDK_DOWNLOAD_URL darwin) - ANDROID=tools/android + SDK_URL=$(find_url $SDK_DOWNLOAD_URL $SDK_DOWNLOAD_KEYWORD mac) + NDK_URL=$(find_url $NDK_DOWNLOAD_URL $NDK_DOWNLOAD_KEYWORD darwin) + ANDROID=cmdline-tools/latest/bin/sdkmanager ;; CYGWIN*) - SDK_URL=$(find_url $SDK_DOWNLOAD_URL windows) - NDK_URL=$(find_url $NDK_DOWNLOAD_URL windows) - ANDROID=tools/android.bat + SDK_URL=$(find_url $SDK_DOWNLOAD_URL $SDK_DOWNLOAD_KEYWORD windows) + NDK_URL=$(find_url $NDK_DOWNLOAD_URL $NDK_DOWNLOAD_KEYWORD windows) + ANDROID=cmdline-tools/latest/bin/sdkmanager.exe ;; esac prefix="${INSTALL_PREFIX:-$HOME}" dldir="${DOWNLOAD_DIR:-/tmp}" -SDK_PATH=$(find $prefix -maxdepth 1 -name "android-sdk-*") +SDK_PATH=${ANDROID_HOME:-$(find $prefix -maxdepth 1 -name "android-sdk")} NDK_PATH=$(find $prefix -maxdepth 1 -name "android-ndk-*") download_and_extract() { @@ -52,35 +55,24 @@ download_and_extract() { fi echo " * Extracting $name..." - case ${local_file} in - *.zip) - unzip -qo -d "$prefix" "$local_file" - ;; - *.tgz|*.tar.gz) - (cd $prefix; tar -xzf "$local_file") - ;; - *.tar.bz2) - (cd $prefix; tar -xjf "$local_file") - ;; - *) - echo "Couldn't figure out how to extract $local_file" ! 1>&2 - ;; - esac + unzip -qo -d "$prefix" "$local_file" } if [ -z "$SDK_PATH" ]; then + mkdir -p "$prefix/android-sdk/cmdline-tools" download_and_extract $SDK_URL + mv "$prefix/cmdline-tools" "$prefix/android-sdk/cmdline-tools/latest" # OS X doesn't know about realname, use basename instead. - SDK_PATH=$prefix/$(basename $prefix/android-sdk-*) + SDK_PATH=$prefix/$(basename $prefix/android-sdk) fi if [ -z "$NDK_PATH" ]; then download_and_extract $NDK_URL NDK_PATH=$prefix/$(basename $prefix/android-ndk-*) fi -if [ -z "$(find $SDK_PATH/platforms -type d -name 'android-*')" ]; then +if [ ! -d "$SDK_PATH/platforms/android-19" ] || [ ! -d "$SDK_PATH/build-tools/19.1.0" ]; then echo " * Installing Android platforms..." - $SDK_PATH/$ANDROID update sdk --no-ui --filter platform,platform-tool,tool + $SDK_PATH/$ANDROID --install "platforms;android-19" "build-tools;19.1.0" fi cat <<EOF diff --git a/docs/CREDITS b/docs/CREDITS index eb6aac4502..f141f6659b 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -730,6 +730,7 @@ Paul Sauro Dmitry Prozorov Mustafa YILDIZ Lianela Sky +Nick Feldmann The libmad team The wavpack team diff --git a/tools/configure b/tools/configure index 3f29ece438..7adadc9a1e 100755 --- a/tools/configure +++ b/tools/configure @@ -794,11 +794,16 @@ androidcc () { exit fi if [ -z "$ANDROID_NDK_PATH" ]; then - echo "ERROR: You need the Android NDK installed (r10e or higher) and have the ANDROID_NDK_PATH" + echo "ERROR: You need the Android NDK installed (r10e to r17) and have the ANDROID_NDK_PATH" echo "environment variable point to the root directory of the Android NDK." exit fi make_toolchain="${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh" + if [ ! -f "$make_toolchain" ]; then + echo "ERROR: You need the Android NDK installed (r10e to r17). Please note that" + echo "versions newer than r17 are not supported because they do not contain GCC." + exit + fi # the prebuilt android NDK only supports x86_64 architecture anyway, so we can take shortcuts buildhost=$(uname | tr "[:upper:]" "[:lower:]")-x86_64 @@ -815,6 +820,7 @@ androidcc () { ANDROID_PLATFORM_VERSION=$1 GCCOPTS="$GCCOPTS $3" gccchoice="4.9" + rm -rf "${pwd}/android-toolchain" # old toolchain must be removed before running script # arch dependant stuff case $ANDROID_ARCH in armeabi) |