1#
2# Docker Hexagon cross-compiler target
3#
4# This docker target is used for building hexagon tests. As it also
5# needs to be able to build QEMU itself in CI we include its
6# build-deps.
7#
8FROM docker.io/library/debian:11-slim
9
10# Duplicate deb line as deb-src
11RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
12RUN apt-get update && \
13    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
14    DEBIAN_FRONTEND=noninteractive eatmydata \
15# Install common build utilities
16    apt-get install -y --no-install-recommends \
17        curl \
18        xz-utils \
19        ca-certificates \
20        bison \
21        flex \
22        git \
23        ninja-build \
24        python3-venv && \
25# Install QEMU build deps for use in CI
26    DEBIAN_FRONTEND=noninteractive eatmydata \
27    apt build-dep -yy --arch-only qemu
28
29
30ENV TOOLCHAIN_INSTALL /opt
31ENV TOOLCHAIN_RELEASE 16.0.0
32ENV TOOLCHAIN_BASENAME "clang+llvm-${TOOLCHAIN_RELEASE}-cross-hexagon-unknown-linux-musl"
33ENV TOOLCHAIN_URL https://codelinaro.jfrog.io/artifactory/codelinaro-toolchain-for-hexagon/v${TOOLCHAIN_RELEASE}/${TOOLCHAIN_BASENAME}.tar.xz
34
35RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL"
36ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu/bin
37# As a final step configure the user (if env is defined)
38ARG USER
39ARG UID
40RUN if [ "${USER}" ]; then \
41  id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
42