1FROM debian:10.3
2
3ENV DEBIAN_FRONTEND noninteractive
4
5# Enabling backports gives us access to clang-6 and makes it more likely that
6# 'apt-get build-dep' will install the correct dependencies.
7# Mesa builds newer than 17.0.4 or so require libdrm > 2.4.75, but the
8# default one in stretch is 2.4.74.
9# Note that the hosts that use these drivers will also need the newer version of libdrm2
10# or there will be an error along the lines of:
11#     symbol lookup error: ./mesa_intel_driver/libGL.so.1: undefined symbol: drmGetDevice2
12#
13# Hosts can install this by adding the stretch-backports debian source (see next RUN)
14# and then performing `sudo apt-get update && sudo apt-get install libdrm2=2.4.95-1~bpo9+1`
15RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list && \
16    echo "deb-src http://deb.debian.org/debian buster-updates main" >> /etc/apt/sources.list && \
17    apt-get update && apt-get upgrade -y && \
18    apt-get install -y wget clang-6.0 && \
19    apt-get build-dep -y mesa && \
20    rm -rf /var/lib/apt/lists/*
21
22ENV CC="/usr/lib/llvm-6.0/bin/clang" \
23    CXX="/usr/lib/llvm-6.0/bin/clang++" \
24    PATH=/usr/lib/llvm-6.0/bin:$PATH \
25    # Default to this version of MESA, but it can be overridden with
26    # -e MESA_VERSION=X.Y.Z when running the docker container
27    MESA_VERSION=18.3.6
28
29COPY ./build_mesa.sh /opt/build_mesa.sh
30