Skip to content

Commit

Permalink
Reduce Android image sizes.
Browse files Browse the repository at this point in the history
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 cross-rs#743.
  • Loading branch information
Alexhuszagh committed Jun 3, 2022
1 parent 87a322e commit 07700f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions docker/android-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 07700f1

Please sign in to comment.