Dockerfile 2.5 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 \
Ben Gamari's avatar
Ben Gamari committed
11
    perl python3 texinfo xz-utils pxz lbzip2 bzip2 patch openssh-client sudo time \
Matthew Pickering's avatar
Matthew Pickering committed
12 13
    jq wget curl libnuma-dev \
    # Documentation tools
14
    python3-sphinx texlive-xetex texlive-latex-extra texlive-binaries texlive-fonts-recommended lmodern texlive-generic-extra \
Matthew Pickering's avatar
Matthew Pickering committed
15 16
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
17 18

# Boot LLVM
19 20
ENV BOOT_LLVM_DIR /opt/llvm-bootstrap
ENV BOOT_LLVM_VERSION 7.0.0
21
ENV PATH /usr/local/bin:$PATH
22 23 24
RUN curl http://releases.llvm.org/$BOOT_LLVM_VERSION/clang+llvm-$BOOT_LLVM_VERSION-aarch64-linux-gnu.tar.xz | tar -xJC . && \
    mkdir $BOOT_LLVM_DIR && \
    cp -R clang+llvm*/* $BOOT_LLVM_DIR && \
25
    rm -R clang+llvm* && \
26
    $BOOT_LLVM_DIR/bin/llc --version
27 28

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

# LLVM
40
ENV LLVM_DIR /opt/llvm
Ben Gamari's avatar
Ben Gamari committed
41
ENV LLVM_VERSION 9.0.0
42 43 44 45
ENV PATH $LLVM_DIR/bin:$PATH
RUN curl http://releases.llvm.org/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-aarch64-linux-gnu.tar.xz | tar -xJC . && \
    mkdir $LLVM_DIR && \
    cp -R clang+llvm*/* $LLVM_DIR && \
46
    rm -R clang+llvm* && \
47
    llc --version
48 49

# Cabal
50
ENV CABAL_VERSION 3.0.0.0
51 52 53 54 55 56
#RUN git clone https://github.com/haskell/Cabal
#WORKDIR /Cabal
#RUN git checkout cabal-install-v$CABAL_VERSION
#WORKDIR /Cabal/cabal-install
#RUN EXTRA_CONFIGURE_OPTS=--disable-optimization ./bootstrap.sh --global --no-doc
#RUN ls /Cabal/cabal-install/dist/build
57
RUN curl http://home.smart-cactus.org/~ben/ghc/cabal-install-$CABAL_VERSION-aarch64-debian9-linux.tar.xz | tar -Jx && \
58
    mv cabal /usr/local/bin/cabal
59

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

# 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
66
WORKDIR /home/ghc/
67 68 69

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

CMD ["bash"]