| 1 | # |
| 2 | # Docker cross-compiler target |
| 3 | # |
| 4 | # This docker target uses prebuilt toolchains for LoongArch64 from: |
| 5 | # https://github.com/loongson/build-tools/releases |
| 6 | # |
| 7 | FROM docker.io/library/debian:13-slim |
| 8 | |
| 9 | # Add deb-src repository sources |
| 10 | RUN sed -i "s/^Types: deb$/Types: deb deb-src/" \ |
| 11 | /etc/apt/sources.list.d/debian.sources |
| 12 | |
| 13 | RUN export DEBIAN_FRONTEND=noninteractive && \ |
| 14 | apt-get update && \ |
| 15 | apt-get install -y eatmydata && \ |
| 16 | eatmydata apt-get dist-upgrade -y && \ |
| 17 | apt build-dep -yy qemu |
| 18 | |
| 19 | RUN apt-get update && \ |
| 20 | DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \ |
| 21 | DEBIAN_FRONTEND=noninteractive eatmydata \ |
| 22 | apt-get install -y --no-install-recommends \ |
| 23 | build-essential \ |
| 24 | bison \ |
| 25 | ca-certificates \ |
| 26 | ccache \ |
| 27 | clang \ |
| 28 | flex \ |
| 29 | curl \ |
| 30 | gettext \ |
| 31 | git \ |
| 32 | ninja-build \ |
| 33 | python3-pip \ |
| 34 | python3-setuptools \ |
| 35 | python3-tomli \ |
| 36 | python3-venv \ |
| 37 | python3-wheel && \ |
| 38 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt |
| 39 | |
| 40 | RUN curl -#SL https://github.com/loongson/build-tools/releases/download/2023.08.08/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz \ |
| 41 | | tar -xJC /opt |
| 42 | |
| 43 | ENV PATH=$PATH:/opt/cross-tools/bin |
| 44 | ENV LD_LIBRARY_PATH=/opt/cross-tools/lib:/opt/cross-tools/loongarch64-unknown-linux-gnu/lib:$LD_LIBRARY_PATH |
| 45 | |
| 46 | ENV QEMU_CONFIGURE_OPTS="--disable-docs --disable-tools" |
| 47 | ENV DEF_TARGET_LIST=loongarch64-linux-user,loongarch64-softmmu |
| 48 | ENV MAKE=/usr/bin/make |
| 49 | |
| 50 | # As a final step configure the user (if env is defined) |
| 51 | ARG USER |
| 52 | ARG UID |
| 53 | RUN if [ "${USER}" ]; then \ |
| 54 | id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi |