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

RUN dpkg --add-architecture mips64el \
 && apt-get update \
 && apt-get install -y --no-install-recommends \
      build-essential gperf pkg-config \
      wget ca-certificates \
      binutils-mips64el-linux-gnuabi64 \
      gcc-mips64el-linux-gnuabi64 \
      libc6-dev-mips64el-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=mips64el-linux-gnuabi64-gcc \
        LD=mips64el-linux-gnuabi64-gcc \
        AR=mips64el-linux-gnuabi64-ar \
        ./configure \
                --enable-static \
                --disable-shared \
                --host=mips64el-linux-gnuabi64 \
                --prefix=/usr/mips64el-linux-gnuabi64 && \
 make -j >&2 && \
 make install >&2
