From 35a2e02c194dabdfb581207feab4246b15f45ca1 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@well-typed.com>
Date: Tue, 22 Oct 2019 06:10:50 +0000
Subject: [PATCH] Add powerpc-fedora29 image

---
 .gitlab-ci.yml                    |  8 +++++
 ppc64le-linux-fedora29/Dockerfile | 60 +++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 ppc64le-linux-fedora29/Dockerfile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7d19e22..a710542 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -124,3 +124,11 @@ build-x86_64-linux-fedora27:
   tags:
     - docker
     - x86_64-linux
+
+build-ppc64le-linux-fedora29:
+  extends: .build
+  variables:
+    IMAGE: ppc64le-linux-fedora29
+  tags:
+    - docker
+    - ppc64le-linux
diff --git a/ppc64le-linux-fedora29/Dockerfile b/ppc64le-linux-fedora29/Dockerfile
new file mode 100644
index 0000000..ac988e9
--- /dev/null
+++ b/ppc64le-linux-fedora29/Dockerfile
@@ -0,0 +1,60 @@
+FROM ppc64le/fedora:29
+
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+
+ENV LANG C.UTF-8
+
+# Core build utilities
+RUN dnf -y install coreutils binutils which git make \
+    automake autoconf gcc perl python3 texinfo xz bzip2 lbzip2 \
+    patch openssh-clients sudo zlib-devel sqlite \
+    ncurses-compat-libs gmp-devel ncurses-devel gcc-c++ findutils \
+    curl wget jq
+
+# Documentation tools
+RUN dnf -y install python3-sphinx \
+    texlive texlive-latex texlive-xetex \
+    texlive-collection-latex texlive-collection-latexrecommended \
+    texlive-xetex-def texlive-collection-xetex \
+    python-sphinx-latex dejavu-sans-fonts dejavu-serif-fonts \
+    dejavu-sans-mono-fonts
+
+# This is in the PATH when I ssh into the CircleCI machine but somehow
+# sphinx-build isn't found during configure unless we explicitly
+# add it here as well; perhaps PATH is being overridden by CircleCI's
+# infrastructure?
+ENV PATH /usr/libexec/python3-sphinx:$PATH
+
+# systemd isn't running so remove it from nsswitch.conf
+# Failing to do this will result in testsuite failures due to
+# non-functional user lookup (#15230).
+RUN sed -i -e 's/systemd//g' /etc/nsswitch.conf
+
+WORKDIR /tmp
+# Install GHC and cabal
+ENV GHC_VERSION 8.6.5
+RUN curl https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-powerpc64le-fedora29-linux.tar.xz | tar -Jx;
+WORKDIR /tmp/ghc-$GHC_VERSION
+RUN ./configure --prefix=/opt/ghc/$GHC_VERSION; \
+    make install; \
+    rm -rf /tmp/ghc-$GHC_VERSION
+ENV PATH /opt/ghc/$GHC_VERSION/bin:$PATH
+
+WORKDIR /tmp
+# Get Cabal
+ENV CABAL_VERSION 3.0.0.0
+RUN curl http://home.smart-cactus.org/~ben/ghc/cabal-install-$CABAL_VERSION-powerpc64le-fedora29-linux.tar.xz | tar -Jx && \
+    mv cabal /usr/local/bin/cabal
+
+# Create a normal user.
+RUN adduser ghc --comment "GHC builds"
+RUN echo "ghc ALL = NOPASSWD : ALL" > /etc/sudoers.d/ghc
+USER ghc
+WORKDIR /home/ghc/
+
+# Build Haskell tools
+RUN cabal v2-update && \
+    cabal v2-install hscolour happy alex --constraint 'happy ^>= 1.19.10'
+ENV PATH /home/ghc/.cabal/bin:$PATH
+
+CMD ["bash"]
-- 
GitLab