Dockerfile 2.19 KB
Newer Older
1 2 3 4
FROM aarch64/debian:stretch

ENV LANG C.UTF-8

Matthew Pickering's avatar
Matthew Pickering committed
5 6
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

7
# Core build utilities
Matthew Pickering's avatar
Matthew Pickering committed
8 9
RUN apt-get update \
    && apt-get install --no-install-recommends -qy zlib1g-dev libtinfo-dev libsqlite3-0 libsqlite3-dev \
10
    ca-certificates g++ git make automake autoconf gcc \
11
    perl python3 texinfo xz-utils lbzip2 bzip2 patch openssh-client sudo time \
Matthew Pickering's avatar
Matthew Pickering committed
12 13 14 15 16
    jq wget curl libnuma-dev \
    # Documentation tools
    python3-sphinx texlive-xetex texlive-latex-extra \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
17 18 19 20 21 22 23 24 25 26 27

# Boot LLVM
ENV PATH /usr/local/bin:$PATH
ENV LLVM_TARBALL http://releases.llvm.org/6.0.0/clang+llvm-6.0.0-aarch64-linux-gnu.tar.xz
RUN curl $LLVM_TARBALL | tar -xJC .. && \
    mkdir /opt/llvm6 && \
    cp -R clang+llvm*/* /opt/llvm6 && \
    rm -R clang+llvm* && \
    /opt/llvm6/bin/llc --version

# GHC
28 29
# Use 8.8.1 to bootstrap, since earlier releases are especially buggy on AArch64
ENV GHC_VERSION 8.8.1
30
RUN curl http://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-aarch64-deb9-linux.tar.xz | tar -xJ
31
WORKDIR /ghc-$GHC_VERSION
Matthew Pickering's avatar
Matthew Pickering committed
32 33 34 35
RUN ./configure --prefix=/usr/local LLC=/opt/llvm6/bin/llc OPT=/opt/llvm6/bin/opt && \
    make install
WORKDIR /
RUN rm -Rf ghc-*
36 37 38 39 40 41 42 43 44 45 46 47 48
RUN ghc --version

# LLVM
ENV LLVM_TARBALL http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-aarch64-linux-gnu.tar.xz
ENV LLC /opt/llvm7/bin/llc
ENV OPT /opt/llvm7/bin/opt
RUN curl $LLVM_TARBALL | tar -xJC .. && \
    mkdir /opt/llvm7 && \
    cp -R clang+llvm*/* /opt/llvm7 && \
    rm -R clang+llvm* && \
    $LLC --version

# Cabal
49
ENV CABAL_VERSION 3.0.0.0
Matthew Pickering's avatar
Matthew Pickering committed
50 51
RUN git clone https://github.com/haskell/Cabal
WORKDIR /Cabal
52
RUN git checkout cabal-install-v$CABAL_VERSION
Matthew Pickering's avatar
Matthew Pickering committed
53
WORKDIR /Cabal/cabal-install
54
RUN EXTRA_CONFIGURE_OPTS=--disable-optimization ./bootstrap.sh --global --no-doc
55

Matthew Pickering's avatar
Matthew Pickering committed
56
RUN ls /Cabal/cabal-install/dist/build
57

58
ENV PATH /home/ghc/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
59 60 61 62 63

# Create a normal user.
RUN adduser ghc --gecos "GHC builds" --disabled-password
RUN echo "ghc ALL = NOPASSWD : ALL" > /etc/sudoers.d/ghc
USER ghc
Ben Gamari's avatar
Ben Gamari committed
64
WORKDIR /home/ghc/
65 66 67

# Build Haskell tools
RUN cabal update && \
Oleg Grenrus's avatar
Oleg Grenrus committed
68
    cabal install hscolour happy alex --constraint 'happy ^>= 1.19.10'
69 70 71 72
ENV PATH /home/ghc/.cabal/bin:$PATH

CMD ["bash"]