# cross passes the correct base via this ARG
ARG CROSS_BASE_IMAGE
FROM debian:bookworm-slim

RUN dpkg --add-architecture mipsel \
 && apt-get update \
 && apt-get install -y --no-install-recommends \
      build-essential gperf pkg-config \
      wget ca-certificates \
      binutils-mipsel-linux-gnu \
      gcc-mipsel-linux-gnu \
      libc6-dev-mipsel-cross \
 && rm -rf /var/lib/apt/lists/*

RUN wget https://github.com/seccomp/libseccomp/releases/download/v2.6.0/libseccomp-2.6.0.tar.gz && \
 tar -xvpf libseccomp-2.6.0.tar.gz && \
 cd libseccomp-2.6.0 && \
 env CC=mipsel-linux-gnu-gcc \
        LD=mipsel-linux-gnu-gcc \
        AR=mipsel-linux-gnu-ar \
        ./configure \
                --enable-static \
                --disable-shared \
                --host=mipsel-linux-gnu \
                --prefix=/usr/mipsel-linux-gnu && \
 make -j && \
 make install
