1#
2# Docker toolchain cross-compiler
3#
4# This dockerfile is used for building a cross-compiler toolchain.
5# The script for building the toolchain is supplied via extra-files.
6#
7FROM qemu/debian10
8
9# Install build utilities for building gcc and glibc.
10# ??? The build-dep isn't working, missing a number of
11# minimal build dependiencies, e.g. libmpc.
12
13RUN apt update && \
14    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
15    DEBIAN_FRONTEND=noninteractive eatmydata \
16    apt install -y --no-install-recommends \
17        bison \
18        flex \
19        gawk \
20        libmpc-dev \
21        libmpfr-dev \
22        rsync \
23        texinfo \
24        wget && \
25    DEBIAN_FRONTEND=noninteractive eatmydata \
26    apt build-dep -yy --arch-only gcc glibc
27
28ADD build-toolchain.sh /root/build-toolchain.sh
29
30RUN cd /root && ./build-toolchain.sh
31
32# Throw away the extra toolchain build deps, the downloaded source,
33# and the build trees by restoring the original debian10 image,
34# then copying the built toolchain from stage 0.
35FROM qemu/debian10
36COPY --from=0 /usr/local /usr/local
37