Skip to content

Commit

Permalink
Merge pull request #534 from chriswailes/android-ndk-update
Browse files Browse the repository at this point in the history
Update CI script to handle newer versions of the Android NDK
  • Loading branch information
workingjubilee authored Jun 28, 2023
2 parents 3a61258 + caf2f0b commit 1d97a00
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 33 deletions.
27 changes: 9 additions & 18 deletions ci/android-ndk.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
set -ex

ANDROID_ARCH=$1
ANDROID_SDK_VERSION=4333796

mkdir /tmp/android
cd /tmp/android

curl -o android-sdk.zip \
"https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip"
unzip -q android-sdk.zip

yes | ./tools/bin/sdkmanager --licenses > /dev/null
./tools/bin/sdkmanager ndk-bundle > /dev/null

./ndk-bundle/build/tools/make_standalone_toolchain.py \
--arch $ANDROID_ARCH \
--stl=libc++ \
--api 21 \
--install-dir /android-toolchain
ANDROID_NDK_URL=https://dl.google.com/android/repository
ANDROID_NDK_ARCHIVE=android-ndk-r25b-linux.zip

mkdir /android-toolchain
cd /android-toolchain
curl -fO $ANDROID_NDK_URL/$ANDROID_NDK_ARCHIVE
unzip -q $ANDROID_NDK_ARCHIVE
rm $ANDROID_NDK_ARCHIVE
mv android-ndk-* ndk

cd /tmp
rm -rf android
6 changes: 3 additions & 3 deletions ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-dev

COPY android-ndk.sh /
RUN /android-ndk.sh arm64
ENV PATH=$PATH:/android-toolchain/bin
RUN /android-ndk.sh
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

# TODO: run tests in an emulator eventually
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android21-clang \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=echo
6 changes: 3 additions & 3 deletions ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-dev

COPY android-ndk.sh /
RUN /android-ndk.sh arm
ENV PATH=$PATH:/android-toolchain/bin
RUN /android-ndk.sh
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

# TODO: run tests in an emulator eventually
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi19-clang \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=echo
6 changes: 3 additions & 3 deletions ci/docker/armv7-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-dev

COPY android-ndk.sh /
RUN /android-ndk.sh arm
ENV PATH=$PATH:/android-toolchain/bin
RUN /android-ndk.sh
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

# TODO: run tests in an emulator eventually
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi19-clang \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER=echo
6 changes: 3 additions & 3 deletions ci/docker/i686-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-dev

COPY android-ndk.sh /
RUN /android-ndk.sh x86
ENV PATH=$PATH:/android-toolchain/bin
RUN /android-ndk.sh
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

# TODO: run tests in an emulator eventually
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android19-clang \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=echo
6 changes: 3 additions & 3 deletions ci/docker/x86_64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-dev

COPY android-ndk.sh /
RUN /android-ndk.sh x86_64
ENV PATH=$PATH:/android-toolchain/bin
RUN /android-ndk.sh
ENV PATH=$PATH:/android-toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

# TODO: run tests in an emulator eventually
ENV CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
ENV CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android21-clang \
CARGO_TARGET_X86_64_LINUX_ANDROID_RUNNER=echo

0 comments on commit 1d97a00

Please sign in to comment.