Skip to content

Commit

Permalink
Update GHC to v9.10.1
Browse files Browse the repository at this point in the history
- Close #8
- Update base image to alpine:3.20
  - Add package clang18
- Patch to force LLVM v18 backend
- Update cabal-install to v3.12.0.0-prerelease
  - i.e. cabal-install 3.11.0.0
- Dev Container
  - Remove 'GHC 9.2 (recommended)'
  - Remove 'GHC 9.4'
  - Promote 'GHC 9.6' to recommended
  - Add 'GHC 9.10 (latest)'
  • Loading branch information
benz0li committed May 28, 2024
1 parent 4b697dc commit b0c19b9
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 112 deletions.
26 changes: 16 additions & 10 deletions .devcontainer/VERSION_MATRIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@

## Current

| GHC | Cabal[^1] | Stack[^1] | HLS |
|:----------------------------|:----------|:------------|:----------------------------------------------------------------------------------------------- |
| latest<br>9.8.2<br>9.8<br>9 | 3.10.3.0 | ≥ 2.13.1 | latest<br>2.8.0.0<br>2.7.0.0<br>2.6.0.0 |
| 9.8.1 | 3.10.2.1 | ≥ 2.13.1 | 2.6.0.0<br>2.5.0.0<br>2.4.0.0 |
| 9.6.5<br>9.6 | 3.10.3.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0 |
| 9.6.4 | 3.10.3.0 | ≥ 2.13.1 | 2.7.0.0<br>2.6.0.0 |
| 9.6.3 | 3.10.1.0 | ≥ 2.13.1 | 2.5.0.0<br>2.4.0.0<br>2.3.0.0<br>2.2.0.0 |
| 9.4.8<br>9.4 | 3.8.1.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0<br>2.6.0.0<br>2.5.0.0<br>2.4.0.0 |
| 9.4.7 | 3.8.1.0 | ≥ 2.13.1 | 2.4.0.0<br>2.3.0.0<br>2.2.0.0<br>2.1.0.0<br>2.0.0.1 |
| 9.2.8<br>9.2 | 3.6.2.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0<br>2.6.0.0<br>2.5.0.0<br>2.4.0.0<br>2.3.0.0<br>2.2.0.0<br>2.1.0.0<br>2.0.0.1 |
| GHC | Cabal[^1] | Stack[^1] | HLS |
|:------------------------------|:----------|:----------|:----------------------------- |
| latest<br>9.10.1<br>9.10<br>9 | 3.11.0.0 | ≥ 2.13.1 | n/a |
| 9.8.2<br>9.8 | 3.10.3.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0<br>2.6.0.0 |
| 9.6.5<br>9.6 | 3.10.3.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0 |

[^1]: built-in version; see [GHC musl > Version Matrix](../VERSION_MATRIX.md)

## Prior

| GHC | Cabal[^1] | Stack[^1] | HLS |
|:-------------|:----------|:----------|:----------------------------------------------------------------------------------------------- |
| 9.8.1 | 3.10.2.1 | ≥ 2.13.1 | 2.6.0.0<br>2.5.0.0<br>2.4.0.0 |
| 9.6.4 | 3.10.3.0 | ≥ 2.13.1 | 2.7.0.0<br>2.6.0.0 |
| 9.6.3 | 3.10.1.0 | ≥ 2.13.1 | 2.5.0.0<br>2.4.0.0<br>2.3.0.0<br>2.2.0.0 |
| 9.4.8<br>9.4 | 3.8.1.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0<br>2.6.0.0<br>2.5.0.0<br>2.4.0.0 |
| 9.4.7 | 3.8.1.0 | ≥ 2.13.1 | 2.4.0.0<br>2.3.0.0<br>2.2.0.0<br>2.1.0.0<br>2.0.0.1 |
| 9.2.8<br>9.2 | 3.6.2.0 | ≥ 2.13.1 | 2.8.0.0<br>2.7.0.0<br>2.6.0.0<br>2.5.0.0<br>2.4.0.0<br>2.3.0.0<br>2.2.0.0<br>2.1.0.0<br>2.0.0.1 |

## Legacy

| GHC | Cabal[^1] | Stack[^2] | HLS |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "GHC 9.4",
"name": "GHC 9.10 (latest)",
"build": {
"dockerfile": "../GHC.Dockerfile",
"context": "..",
"args": {
"GHC_VERSION": "9.4",
"HLS_VERSION": "2.8.0.0",
"GHC_VERSION": "9.10",
"USE_ZSH_FOR_ROOT": "unset-to-use-ash",
"SET_LANG": "C.UTF-8",
"SET_TZ": ""
Expand Down Expand Up @@ -58,13 +57,13 @@

// Set 'remoteUser' to 'root' to connect as root instead.
"remoteUser": "vscode",
"workspaceMount": "source=ghc-musl-ghc-9.4-home-vscode,target=/home/vscode,type=volume",
// "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/ghc-musl-ghc-9.4-home-vscode,target=/home/vscode,type=bind",
"workspaceMount": "source=ghc-musl-ghc-9.10-home-vscode,target=/home/vscode,type=volume",
// "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/ghc-musl-ghc-9.10-home-vscode,target=/home/vscode,type=bind",
"workspaceFolder": "/home/vscode",

// "remoteUser": "root",
// "workspaceMount": "source=ghc-musl-ghc-9.4-root,target=/root,type=volume",
// // "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/ghc-musl-ghc-9.4-root,target=/root,type=bind",
// "workspaceMount": "source=ghc-musl-ghc-9.10-root,target=/root,type=volume",
// // "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/bind-mounts/ghc-musl-ghc-9.10-root,target=/root,type=bind",
// "workspaceFolder": "/root",

"remoteEnv": {
Expand Down
75 changes: 0 additions & 75 deletions .devcontainer/ghc-9.2/devcontainer.json

This file was deleted.

5 changes: 3 additions & 2 deletions .devcontainer/ghc-9.6/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "GHC 9.6",
"name": "GHC 9.6 (recommended)",
"build": {
"dockerfile": "../GHC.Dockerfile",
"context": "..",
"args": {
"GHC_VERSION": "9.6",
"HLS_VERSION": "2.8.0.0",
"HLS_VERSION": "2.7.0.0",
"STACK_VERSION": "2.15.5",
"USE_ZSH_FOR_ROOT": "unset-to-use-ash",
"SET_LANG": "C.UTF-8",
"SET_TZ": ""
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/ghc-9.8/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "GHC 9.8 (latest)",
"name": "GHC 9.8",
"build": {
"dockerfile": "../GHC.Dockerfile",
"context": "..",
Expand Down
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.env:
variables:
GHC_VERSION: "9.8.2"
CABAL_VERSION: "3.10.3.0"
GHC_VERSION: "9.10.1"
CABAL_VERSION: "3.12.0.0-prerelease"
STACK_VERSION: "2.15.7"
HLS_VERSION: "2.8.0.0"
BUILD_GHC: "true"
BUILD_HLS: "true"
TAG_VERSION_MAJ_MIN: "true"
BUILD_HLS: "false"
TAG_VERSION_MAJ_MIN: "false"
TAG_VERSION_MAJ: "false"

.before-script-build: &before-script-build
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ To install docker, follow the instructions for your platform:

```bash
docker build \
--build-arg GHC_VERSION=9.8.2 \
--build-arg CABAL_VERSION=3.10.3.0 \
--build-arg GHC_VERSION=9.10.1 \
--build-arg CABAL_VERSION=3.12.0.0-prerelease \
--build-arg STACK_VERSION=2.15.7 \
-t ghc-musl \
-f latest.Dockerfile .
Expand Down
1 change: 1 addition & 0 deletions VERSION_MATRIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Topmost entry = Tag `latest`

| GHC | Cabal | Stack | LLVM | Linux distro |
|:-----------|:---------|:-----------|:---- |:-------------|
| 9.10.1 | 3.11.0.0 | 2.15.7 | 18 | Alpine 3.20 |
| 9.8.2 | 3.10.3.0 | 2.15.7 | 16 | Alpine 3.20 |
| 9.8.1 | 3.10.2.1 | 2.15.1 | 14 | Alpine 3.19 |
| 9.6.5 | 3.10.3.0 | 2.15.7 | 16 | Alpine 3.20 |
Expand Down
37 changes: 26 additions & 11 deletions latest.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ ARG STACK_VERSION
ARG GHC_VERSION_BUILD=${GHC_VERSION}
ARG CABAL_VERSION_BUILD=${CABAL_VERSION}

FROM glcr.b-data.ch/ghc/ghc-musl:9.6.5 as bootstrap
FROM glcr.b-data.ch/ghc/ghc-musl:9.8.2 as bootstrap

RUN apk upgrade --no-cache \
&& apk add --no-cache \
autoconf \
automake \
binutils-gold \
build-base \
clang18 \
coreutils \
cpio \
curl \
gnupg \
linux-headers \
libffi-dev \
llvm14 \
llvm18 \
ncurses-dev \
perl \
python3 \
Expand All @@ -32,25 +33,32 @@ ARG GHC_VERSION_BUILD

ENV GHC_VERSION=${GHC_VERSION_BUILD}

COPY patches/${GHC_VERSION}.patch /tmp/

RUN cd /tmp \
&& curl -sSLO https://downloads.haskell.org/~ghc/"$GHC_VERSION"/ghc-"$GHC_VERSION"-src.tar.xz \
&& curl -sSLO https://downloads.haskell.org/~ghc/"$GHC_VERSION"/ghc-"$GHC_VERSION"-src.tar.xz.sig \
&& gpg --keyserver hkps://keyserver.ubuntu.com:443 \
--receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 || \
--receive-keys FFEB7CE81E16A36B3E2DED6F2DE04D4E97DB64AD || \
gpg --keyserver hkp://keyserver.ubuntu.com:80 \
--receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 \
--receive-keys FFEB7CE81E16A36B3E2DED6F2DE04D4E97DB64AD \
&& gpg --verify "ghc-$GHC_VERSION-src.tar.xz.sig" "ghc-$GHC_VERSION-src.tar.xz" \
&& tar -xJf "ghc-$GHC_VERSION-src.tar.xz" \
&& cd "ghc-$GHC_VERSION" \
# Apply patches
&& mv "/tmp/$GHC_VERSION.patch" . \
&& patch -p0 <"$GHC_VERSION.patch" \
&& ./boot.source \
&& ./configure --disable-ld-override LD=ld.gold \
&& ./configure \
## Use the LLVM backend
## Switch llvm-targets from unknown-linux-gnueabihf->alpine-linux
## so we can match the llvm vendor string alpine uses
&& sed -i -e 's/unknown-linux-gnueabihf/alpine-linux/g' llvm-targets \
&& sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
&& sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
&& cabal update \
&& cabal install alex \
&& export PATH=/root/.local/bin:$PATH \
## See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
&& hadrian/build binary-dist -j"$(($(nproc)+1))" \
--flavour=perf+llvm+split_sections \
Expand All @@ -65,9 +73,9 @@ ENV CABAL_VERSION=${CABAL_VERSION_BUILD}
## Build Cabal (the tool) with the GHC bootstrap version
RUN cabal update \
## See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
&& cabal install "cabal-install-$CABAL_VERSION"
&& cabal install cabal-install-3.10.3.0

FROM alpine:3.19 as ghc-base
FROM alpine:3.20 as ghc-base

LABEL org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://gitlab.b-data.ch/ghc/ghc-musl" \
Expand All @@ -88,6 +96,7 @@ RUN apk add --no-cache \
bzip2 \
bzip2-dev \
bzip2-static \
clang18 \
curl \
curl-static \
dpkg \
Expand All @@ -97,7 +106,7 @@ RUN apk add --no-cache \
libcurl \
libffi \
libffi-dev \
llvm14 \
llvm18 \
ncurses-dev \
ncurses-static \
openssl-dev \
Expand All @@ -124,7 +133,7 @@ RUN cd /tmp \
## Install GHC
&& tar -xJf ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz \
&& cd ghc-"$GHC_VERSION"-*-alpine-linux \
&& ./configure --disable-ld-override \
&& ./configure \
&& make install \
## Install Stack
&& cd /tmp \
Expand All @@ -142,8 +151,14 @@ FROM ghc-stage1 as ghc-stage2
COPY --from=bootstrap-cabal /root/.local/bin/cabal /usr/local/bin/cabal

## Rebuild Cabal (the tool) with the GHC target version
RUN cabal update \
&& cabal install "cabal-install-$CABAL_VERSION"
RUN cd /tmp \
&& curl -sSLO https://github.com/haskell/cabal/archive/refs/tags/cabal-install-v"$CABAL_VERSION".tar.gz \
&& tar -xzf cabal-install-v"$CABAL_VERSION".tar.gz \
&& cd cabal-cabal-install-v"$CABAL_VERSION" \
&& sed -i 's/2024-03-20T08:02:24Z/2024-04-02T17:52:00Z/g' cabal.project.release \
&& sed -i 's/hashable >= 1.0 /hashable >= 1.4.4.0 /g' cabal-install/cabal-install.cabal \
&& cabal update \
&& cabal install --project-file=cabal.project.release --allow-newer cabal-install

FROM ghc-stage1 as test

Expand Down
11 changes: 11 additions & 0 deletions patches/9.10.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- configure.ac
+++ configure.ac.patched
@@ -492,7 +492,7 @@
# versions of LLVM simultaneously, but that stopped working around
# 3.5/3.6 release of LLVM.
LlvmMinVersion=13 # inclusive
-LlvmMaxVersion=16 # not inclusive
+LlvmMaxVersion=19 # not inclusive
AC_SUBST([LlvmMinVersion])
AC_SUBST([LlvmMaxVersion])

0 comments on commit b0c19b9

Please sign in to comment.