From 07700f12ec37a92ab19adb0df7b116d64dce7abd Mon Sep 17 00:00:00 2001 From: Alex Huszagh Date: Thu, 2 Jun 2022 21:27:49 -0500 Subject: [PATCH] Reduce Android image sizes. Delete unused toolchains to save ~600MB in our total image sizes. This is done by removing the toolchains for other targets in `/android-ndk/sysroot/usr/lib/`. Closes #743. --- CHANGELOG.md | 1 + docker/android-ndk.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1507ff5ff..e3800df6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +- #747 - reduced android image sizes. - #741 - added `armv7-unknown-linux-gnueabi` and `armv7-unknown-linux-musleabi` targets. - #377 - update WINE versions to 7.0. - #734 - patch `arm-unknown-linux-gnueabihf` to build for ARMv6, and add architecture for crosstool-ng-based images. diff --git a/docker/android-ndk.sh b/docker/android-ndk.sh index 818021ef4..0548f4dea 100755 --- a/docker/android-ndk.sh +++ b/docker/android-ndk.sh @@ -27,6 +27,21 @@ main() { --arch "${arch}" \ --api "${api}" + # clean up unused toolchains to reduce image size + local triple + local triples + triples=( + "aarch64-linux-android" + "arm-linux-androideabi" + "i686-linux-android" + "x86_64-linux-android" + ) + for triple in "${triples[@]}"; do + if ! [[ "${triple}" =~ ^"${arch}".* ]]; then + rm -rf "/android-ndk/sysroot/usr/lib/${triple}" + fi + done + purge_packages popd