#!/bin/sh set -eux SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 pwd -P )" if [ $# -eq 0 ]; then set -- arm loongarch64 x86_64 x86 aarch64 riscv64 powerpc powerpc64 mips \ mips64 s390x fi while [ $# -ne 0 ]; do ARCH="$1" shift ( case "${ARCH}" in x86_64) cat <<'EOF' FROM ghcr.io/cross-rs/x86_64-linux-android:0.2.5 as android FROM ubuntu:22.04 COPY --from=android /system/ /system EOF ;; x86) cat <<'EOF' FROM ghcr.io/cross-rs/i686-linux-android:0.2.5 as android FROM ubuntu:22.04 RUN mkdir -p /usr/i686-linux-android COPY --from=android /system/ /usr/i686-linux-android/system EOF ;; arm) cat <<'EOF' FROM ghcr.io/cross-rs/arm-linux-androideabi:0.2.5 as android FROM ubuntu:22.04 RUN mkdir -p /usr/arm-linux-androideabi COPY --from=android /system/ /usr/arm-linux-androideabi/system EOF ;; aarch64) cat <<'EOF' FROM ghcr.io/cross-rs/aarch64-linux-android:0.2.5 as android FROM ubuntu:22.04 RUN mkdir -p /usr/aarch64-linux-android COPY --from=android /system/ /usr/aarch64-linux-android/system EOF ;; *) cat <<'EOF' FROM ubuntu:22.04 EOF ;; esac cat "${SCRIPTPATH}/../docker/base.dockerfile" echo "${SCRIPTPATH}/env.sh" "$ARCH" | grep -vP '^\s*($|#)' | sed -e '/^#/d;/^\s*$/d' \ -e "s/'/'\\\''/g" \ -e "s/^\([^+][^=]*\)=\(.*\)\$/\1='\2'/g" \ -e 's/^\+//g' \ -e 's/^/ENV /' ) >"${SCRIPTPATH}/../docker/${ARCH}.dockerfile" docker buildx build \ -f "$SCRIPTPATH/../docker/${ARCH}.dockerfile" \ -t "shurizzle/toolchain-gnu-musl-cargoenv-${ARCH}:latest" \ --build-arg ARCH="$ARCH" \ "$SCRIPTPATH/.." docker push "shurizzle/toolchain-gnu-musl-cargoenv-${ARCH}:latest" done