# Start from the official Rust dev container image for Debian 12 (bookworm)
FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm

# Install ARM cross-compilation toolchain packages
RUN apt-get update && \
  apt-get install -y --no-install-recommends \
  gdb-multiarch \
  gcc-arm-linux-gnueabihf \
  g++-arm-linux-gnueabihf \
  binutils-arm-linux-gnueabihf \
  libclang-dev && \
  apt-get clean && \
  rm -rf /var/lib/apt/lists/*

# install arm32 cross-compiler
RUN dpkg --add-architecture armhf && \
  apt update && \
  apt install -y \
  libasound2-dev:armhf && \
  apt-get clean && \
  rm -rf /var/lib/apt/lists/*

RUN rustup target add armv7-unknown-linux-gnueabihf

ENV PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig
ENV PKG_CONFIG_ALLOW_CROSS=true