# Prebuild OCCT for aarch64-unknown-linux-gnu using the manylinux_2_28_aarch64
# base image. Covers 64-bit ARM Linux: Raspberry Pi 4/5 (64-bit OS), AWS
# Graviton, Oracle Ampere, Apple Silicon Linux VMs.
#
# Execution environment notes:
# - On an x86_64 Docker host (e.g. Docker Desktop or linux/amd64), `docker run`
#   of this image uses QEMU user-mode emulation and takes 3–5 hours.
# - For native-speed builds, run this image under GitHub Actions on an
#   `ubuntu-24.04-arm` runner (free for public repositories).
FROM quay.io/pypa/manylinux_2_28_aarch64

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
ENV PATH=/root/.cargo/bin:$PATH

# control cc crate and cargo command
# target == host (container runs as aarch64 via QEMU or on a native arm64
# runner), so the image's default gcc/g++/ar cover both host build
# dependencies and the OCCT cmake build.
# ENV CC=gcc
# ENV CXX=g++
# ENV AR=ar
ENV CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu

# add cargo target
RUN rustup target add ${CARGO_BUILD_TARGET}

# copy source and build OCCT prebuilt
WORKDIR /src
COPY . /src
