1# Docker legacy cross-compiler target (tests and minimal qemu)
2#
3# Compilers for some of our older targets which we cant currently
4# upgrade. Currently:
5#
6#   libc6.1-dev-alpha-cross: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054412
7#   sh4-linux-user: binaries don't run with bookworm compiler
8#
9# As we are targeting check-tcg here we only need minimal qemu
10# dependencies and the relevant cross compilers.
11
12FROM docker.io/library/debian:11-slim
13
14# Duplicate deb line as deb-src
15RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
16
17RUN export DEBIAN_FRONTEND=noninteractive && \
18    apt-get update && \
19    apt-get install -y eatmydata && \
20    eatmydata apt-get dist-upgrade -y && \
21    apt build-dep -yy qemu
22
23# Add extra build tools and as many cross compilers as we can for testing
24RUN DEBIAN_FRONTEND=noninteractive eatmydata \
25        apt install -y --no-install-recommends \
26        bison \
27        ccache \
28        clang  \
29        flex \
30        git \
31        ninja-build \
32        gcc-alpha-linux-gnu \
33        libc6.1-dev-alpha-cross \
34        gcc-sh4-linux-gnu \
35        libc6-dev-sh4-cross \
36        python3-pip \
37        python3-setuptools \
38        python3-venv \
39        python3-wheel && \
40        dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
41
42RUN /usr/bin/pip3 install tomli
43
44ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools
45ENV DEF_TARGET_LIST alpha-linux-user,sh4-linux-user
46ENV MAKE /usr/bin/make
47# As a final step configure the user (if env is defined)
48ARG USER
49ARG UID
50RUN if [ "${USER}" ]; then \
51  id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
52