# Hamlib's radio simulators, to test the bridge against radios we do not own.
# A simulator is not the radio: it shows the protocol as Hamlib reads it, nothing more.
# docker build -t 12db-hamlib-sim bruecke/tests/sim
FROM debian:12-slim
ARG HAMLIB=4.6.2
ARG SHA256=b2ac73f44dd1161e95fdee6c95276144757647bf92d7fdb369ee2fe41ed47ae8
# The release tarball misses simulators/sim.h, eleven simulators need it. Same tag, from git.
ARG SIM_H=637a17ada14a077657c91333c2e9f0d68f3d17fa6409406120493ae759599787
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential ca-certificates curl python3 python3-serial socat \
    && rm -rf /var/lib/apt/lists/*
RUN curl -sfL -o /tmp/hl.tar.gz https://github.com/Hamlib/Hamlib/releases/download/$HAMLIB/hamlib-$HAMLIB.tar.gz \
    && echo "$SHA256  /tmp/hl.tar.gz" | sha256sum -c - \
    && mkdir /hl && tar xzf /tmp/hl.tar.gz -C /hl --strip-components=1 && rm /tmp/hl.tar.gz \
    && curl -sfL -o /hl/simulators/sim.h https://raw.githubusercontent.com/Hamlib/Hamlib/$HAMLIB/simulators/sim.h \
    && echo "$SIM_H  /hl/simulators/sim.h" | sha256sum -c - \
    && cd /hl && ./configure --disable-static --without-readline --without-libusb --without-cxx-binding -q \
    && make -j"$(nproc)" -s \
    && cd simulators && (make -k -s -j"$(nproc)" $(sed -n 's/^check_PROGRAMS = //p' Makefile.am) || true) \
    && for s in $(sed -n 's/^check_PROGRAMS = //p' Makefile.am); do test -x $s || echo "not built: $s"; done
