diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index 944a8389aa..4635651259 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -1,38 +1,41 @@ #!/usr/bin/env sh -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex -curl --retry 5 -O \ - https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip -unzip -q android-ndk-r15b-linux-x86_64.zip +NDK=android-ndk-r21d +wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip +unzip -q ${NDK}-linux-x86_64.zip -case "${1}" in +case "$1" in + arm) + arch=arm + api=28 + ;; + armv7) + arch=arm + api=28 + ;; aarch64) arch=arm64 + api=28 ;; - i686) arch=x86 + api=28 + ;; + x86_64) + arch=x86_64 + api=28 ;; - *) - arch="${1}" + echo "invalid arch: $1" + exit 1 ;; esac; -android-ndk-r15b/build/tools/make_standalone_toolchain.py \ - --unified-headers \ +python3 ${NDK}/build/tools/make_standalone_toolchain.py \ --install-dir "/android/ndk-${1}" \ --arch "${arch}" \ - --api 24 + --api ${api} -rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b +rm -rf ./${NDK}-linux-x86_64.zip ./${NDK} diff --git a/ci/android-install-sdk.sh b/ci/android-install-sdk.sh index 3383dcb7f4..6f6aeb28e8 100644 --- a/ci/android-install-sdk.sh +++ b/ci/android-install-sdk.sh @@ -1,13 +1,4 @@ #!/usr/bin/env sh -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex @@ -18,43 +9,56 @@ set -ex # located in https://github.com/appunite/docker by just wrapping it in a script # which apparently magically accepts the licenses. -mkdir sdk -curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O -unzip -d sdk sdk-tools-linux-4333796.zip +SDK=6609375 +mkdir -p sdk/cmdline-tools +wget -q --tries=20 https://dl.google.com/android/repository/commandlinetools-linux-${SDK}_latest.zip +unzip -q -d sdk/cmdline-tools commandlinetools-linux-${SDK}_latest.zip case "$1" in arm | armv7) - abi=armeabi-v7a + api=24 + image="system-images;android-${api};default;armeabi-v7a" ;; - aarch64) - abi=arm64-v8a + api=24 + image="system-images;android-${api};google_apis;arm64-v8a" ;; - i686) - abi=x86 + api=28 + image="system-images;android-${api};default;x86" ;; - x86_64) - abi=x86_64 + api=28 + image="system-images;android-${api};default;x86_64" ;; - *) echo "invalid arch: $1" exit 1 ;; esac; +# Try to fix warning about missing file. +# See https://askubuntu.com/a/1078784 +mkdir -p /root/.android/ +echo '### User Sources for Android SDK Manager' >> /root/.android/repositories.cfg +echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg + +# Print all available packages +# yes | ./sdk/tools/bin/sdkmanager --list --verbose + # --no_https avoids # javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found -yes | ./sdk/tools/bin/sdkmanager --licenses --no_https -yes | ./sdk/tools/bin/sdkmanager --no_https \ - "emulator" \ - "platform-tools" \ - "platforms;android-24" \ - "system-images;android-24;default;$abi" +# +# | grep -v = || true removes the progress bar output from the sdkmanager +# which produces an insane amount of output. +yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https | grep -v = || true +yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --no_https \ + "emulator" \ + "platform-tools" \ + "platforms;android-${api}" \ + "${image}" | grep -v = || true echo "no" | - ./sdk/tools/bin/avdmanager create avd \ + ./sdk/cmdline-tools/tools/bin/avdmanager create avd \ --name "${1}" \ - --package "system-images;android-24;default;$abi" + --package "${image}" | grep -v = || true diff --git a/ci/android-sysimage.sh b/ci/android-sysimage.sh index 31a6762cb5..b49712035c 100644 --- a/ci/android-sysimage.sh +++ b/ci/android-sysimage.sh @@ -1,15 +1,5 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex URL=https://dl.google.com/android/repository/sys-img/android @@ -23,13 +13,13 @@ main() { apt-get install --no-install-recommends e2tools - pushd "$td" - curl --retry 5 -O "${URL}/${name}" + pushd "${td}" + wget -q --tries=5 "${URL}/${name}" unzip -q "${name}" local system - system=$(find . -name system.img) - mkdir -p $dest/{bin,lib,lib64} + system="$(find . -name system.img)" + mkdir -p ${dest}/{bin,lib,lib64} # Extract android linker and libraries to /system # This allows android executables to be run directly (or with qemu) diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index 6cf9b50617..b17885e2d7 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -1,34 +1,34 @@ FROM ubuntu:22.04 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ +RUN dpkg --add-architecture i386 +RUN apt-get update +RUN apt-get install -y --no-install-recommends libc6-dev gcc +RUN apt-get install -y --no-install-recommends \ file \ - make \ - curl \ + wget \ ca-certificates \ - python-is-python3 \ + python3 \ + python3-distutils \ unzip \ expect \ openjdk-8-jre \ - libstdc++6-i386-cross \ - libpulse0 \ - gcc \ - libc6-dev + libstdc++6:i386 \ + libpulse0 WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=aarch64 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools RUN sh /android/android-install-ndk.sh $ANDROID_ARCH RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* +RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android28-clang \ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ OBJDUMP=aarch64-linux-android-objdump \ HOME=/tmp diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index fb1a0cecf4..3fc3202e9f 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -1,31 +1,31 @@ FROM ubuntu:22.04 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ +RUN dpkg --add-architecture i386 +RUN apt-get update +RUN apt-get install -y --no-install-recommends libc6-dev gcc +RUN apt-get install -y --no-install-recommends \ file \ - make \ - curl \ + wget \ ca-certificates \ - python-is-python3 \ + python3 \ + python3-distutils \ unzip \ expect \ openjdk-8-jre \ - libstdc++6-i386-cross \ - libpulse0 \ - gcc \ - libc6-dev + libstdc++6:i386 \ + libpulse0 WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=arm -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools RUN sh /android/android-install-ndk.sh $ANDROID_ARCH RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* +RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ diff --git a/ci/docker/x86_64-linux-android/Dockerfile b/ci/docker/x86_64-linux-android/Dockerfile index 82119be743..fa82385032 100644 --- a/ci/docker/x86_64-linux-android/Dockerfile +++ b/ci/docker/x86_64-linux-android/Dockerfile @@ -3,13 +3,12 @@ FROM ubuntu:22.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ ca-certificates \ - curl \ + wget \ gcc \ libc-dev \ - python-is-python3 \ - unzip \ - file \ - make + python3 \ + python3-distutils \ + unzip WORKDIR /android/ ENV ANDROID_ARCH=x86_64