diff --git a/.devcontainer/VERSION_MATRIX.md b/.devcontainer/VERSION_MATRIX.md index 3a58ed09c3a0dc37587c44bad5acb181a9b80ad2..784cadb5b54a518638dade3405b24a9d73fa32ca 100644 --- a/.devcontainer/VERSION_MATRIX.md +++ b/.devcontainer/VERSION_MATRIX.md @@ -5,7 +5,7 @@ | GHC | Cabal[^1] | Stack[^1] | HLS | |:------------------------------|:----------|:----------|:--------------------------------------------------- | | latest<br>9.10.1<br>9.10<br>9 | 3.12.1.0 | ≥ 2.13.1 | latest<br>2.9.0.1<br>2.9.0.0 | -| 9.8.2<br>9.8 | 3.10.3.0 | ≥ 2.13.1 | 2.9.0.1<br>2.9.0.0<br>2.8.0.0<br>2.7.0.0<br>2.6.0.0 | +| 9.8.3<br>9.8 | 3.10.3.0 | ≥ 2.13.1 | | | 9.6.6<br>9.6 | 3.10.3.0 | ≥ 2.13.1 | 2.9.0.1 | [^1]: built-in version; see [GHC musl > Version Matrix](../VERSION_MATRIX.md) @@ -14,6 +14,7 @@ | GHC | Cabal[^1] | Stack[^1] | HLS | |:-------------|:----------|:----------|:----------------------------------------------------------------------------------------------- | +| 9.8.2 | 3.10.3.0 | ≥ 2.13.1 | 2.9.0.1<br>2.9.0.0<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 | 3.10.3.0 | ≥ 2.13.1 | 2.9.0.0<br>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 | diff --git a/.devcontainer/ghc-9.8/devcontainer.json b/.devcontainer/ghc-9.8/devcontainer.json index 242d77206ce5179b089069f535ace3ad83096bf5..48de1f2721a014a4d3fc3402d4dbda759b77e3e4 100644 --- a/.devcontainer/ghc-9.8/devcontainer.json +++ b/.devcontainer/ghc-9.8/devcontainer.json @@ -5,7 +5,6 @@ "context": "..", "args": { "GHC_VERSION": "9.8", - "HLS_VERSION": "2.9.0.1", "USE_ZSH_FOR_ROOT": "unset-to-use-ash", "SET_LANG": "C.UTF-8", "SET_TZ": "" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3cfda015bf50cf14354e441a9ddb48aeedbe0d77..e0c213b35f57735b59fa226e24661e13bc686c50 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1,12 @@ .env: variables: - GHC_VERSION: "9.10.1" - CABAL_VERSION: "3.12.1.0" + GHC_VERSION: "9.8.3" + CABAL_VERSION: "3.10.3.0" STACK_VERSION: "3.1.1" HLS_VERSION: "2.9.0.1" BUILD_GHC: "true" - BUILD_HLS: "true" - TAG_VERSION_MAJ_MIN: "false" + BUILD_HLS: "false" + TAG_VERSION_MAJ_MIN: "true" TAG_VERSION_MAJ: "false" .before-script-build: &before-script-build diff --git a/VERSION_MATRIX.md b/VERSION_MATRIX.md index 1ba2af3e4ca767d5738e4b5c2284acadde8638b8..3554984c016c54f1d41a122e1ad9cdad9088f6c6 100644 --- a/VERSION_MATRIX.md +++ b/VERSION_MATRIX.md @@ -5,6 +5,7 @@ Topmost entry = Tag `latest` | GHC | Cabal | Stack | LLVM | Linux distro | |:-----------|:---------|:-----------|:---- |:-------------| | 9.10.1 | 3.12.1.0 | 3.1.1 | 18 | Alpine 3.20 | +| 9.8.3 | 3.10.3.0 | 3.1.1 | 16 | Alpine 3.20 | | 9.8.2 | 3.10.3.0 | 3.1.1 | 16 | Alpine 3.20 | | 9.8.1 | 3.10.2.1 | 2.15.1 | 14 | Alpine 3.19 | | 9.6.6 | 3.10.3.0 | 3.1.1 | 16 | Alpine 3.20 | diff --git a/patches/9.8.3.patch b/patches/9.8.3.patch new file mode 100644 index 0000000000000000000000000000000000000000..f940e0cea84b049d5eef07083a5743a738015e9f --- /dev/null +++ b/patches/9.8.3.patch @@ -0,0 +1,72 @@ +--- compiler/GHC/Driver/DynFlags.hs ++++ compiler/GHC/Driver/DynFlags.hs.patched +@@ -1248,7 +1248,6 @@ + optLevelFlags -- see Note [Documenting optimisation flags] + = [ ([0,1,2], Opt_DoLambdaEtaExpansion) + , ([0,1,2], Opt_DoEtaReduction) -- See Note [Eta-reduction in -O0] +- , ([0,1,2], Opt_LlvmTBAA) + , ([0,1,2], Opt_ProfManualCcs ) + , ([2], Opt_DictsStrict) + +--- compiler/GHC/Driver/Flags.hs ++++ compiler/GHC/Driver/Flags.hs.patched +@@ -285,7 +285,6 @@ + | Opt_RegsGraph -- do graph coloring register allocation + | Opt_RegsIterative -- do iterative coalescing graph coloring register allocation + | Opt_PedanticBottoms -- Be picky about how we treat bottom +- | Opt_LlvmTBAA -- Use LLVM TBAA infrastructure for improving AA (hidden flag) + | Opt_LlvmFillUndefWithGarbage -- Testing for undef bugs (hidden flag) + | Opt_IrrefutableTuples + | Opt_CmmSink +@@ -525,7 +524,6 @@ + , Opt_EnableRewriteRules + , Opt_RegsGraph + , Opt_RegsIterative +- , Opt_LlvmTBAA + , Opt_IrrefutableTuples + , Opt_CmmSink + , Opt_CmmElimCommonBlocks +--- compiler/GHC/Driver/Pipeline/Execute.hs ++++ compiler/GHC/Driver/Pipeline/Execute.hs.patched +@@ -968,8 +968,7 @@ + -> DynFlags + -> [(String, String)] -- ^ pairs of (opt, llc) arguments + llvmOptions llvm_config dflags = +- [("-enable-tbaa -tbaa", "-enable-tbaa") | gopt Opt_LlvmTBAA dflags ] +- ++ [("-relocation-model=" ++ rmodel ++ [("-relocation-model=" ++ rmodel + ,"-relocation-model=" ++ rmodel) | not (null rmodel)] + ++ [("-stack-alignment=" ++ (show align) + ,"-stack-alignment=" ++ (show align)) | align > 0 ] +--- compiler/GHC/Driver/Session.hs ++++ compiler/GHC/Driver/Session.hs.patched +@@ -2400,7 +2400,6 @@ + flagSpec "late-dmd-anal" Opt_LateDmdAnal, + flagSpec "late-specialise" Opt_LateSpecialise, + flagSpec "liberate-case" Opt_LiberateCase, +- flagHiddenSpec "llvm-tbaa" Opt_LlvmTBAA, + flagHiddenSpec "llvm-fill-undef-with-garbage" Opt_LlvmFillUndefWithGarbage, + flagSpec "loopification" Opt_Loopification, + flagSpec "block-layout-cfg" Opt_CfgBlocklayout, +--- configure.ac ++++ configure.ac.patched +@@ -544,7 +544,7 @@ + # versions of LLVM simultaneously, but that stopped working around + # 3.5/3.6 release of LLVM. + LlvmMinVersion=11 # inclusive +-LlvmMaxVersion=16 # not inclusive ++LlvmMaxVersion=17 # not inclusive + AC_SUBST([LlvmMinVersion]) + AC_SUBST([LlvmMaxVersion]) + sUPPORTED_LLVM_VERSION_MIN=$(echo \($LlvmMinVersion\) | sed 's/\./,/') +--- llvm-passes ++++ llvm-passes.patched +@@ -1,5 +1,5 @@ + [ +-(0, "-enable-new-pm=0 -mem2reg -globalopt -lower-expect"), +-(1, "-enable-new-pm=0 -O1 -globalopt"), +-(2, "-enable-new-pm=0 -O2") ++(0, "-passes=function(require<tbaa>),function(mem2reg),globalopt,function(lower-expect)"), ++(1, "-passes=default<O1>"), ++(2, "-passes=default<O2>") + ] diff --git a/prior/9.8.3.Dockerfile b/prior/9.8.3.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4003f1d03348dc66755c9f7959772bb5c33904f5 --- /dev/null +++ b/prior/9.8.3.Dockerfile @@ -0,0 +1,191 @@ +ARG GHC_VERSION=9.8.3 +ARG CABAL_VERSION=3.10.3.0 +ARG STACK_VERSION=3.1.1 + +ARG GHC_VERSION_BUILD=${GHC_VERSION} +ARG CABAL_VERSION_BUILD=${CABAL_VERSION} + +FROM glcr.b-data.ch/ghc/ghc-musl:9.6.6 AS bootstrap + +RUN apk upgrade --no-cache \ + && apk add --no-cache \ + autoconf \ + automake \ + binutils-gold \ + build-base \ + coreutils \ + cpio \ + curl \ + gnupg \ + linux-headers \ + libffi-dev \ + llvm16 \ + ncurses-dev \ + perl \ + python3 \ + xz \ + zlib-dev + +FROM bootstrap AS bootstrap-ghc + +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 FFEB7CE81E16A36B3E2DED6F2DE04D4E97DB64AD || \ + gpg --keyserver hkp://keyserver.ubuntu.com:80 \ + --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 patch: Bump max LLVM version to 19 (not inclusive) + ## https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12726 + && mv "/tmp/$GHC_VERSION.patch" . \ + && patch -p0 <"$GHC_VERSION.patch" \ + ## Configure and build + && ./boot.source \ + && ./configure \ + --build=$(uname -m)-alpine-linux \ + --host=$(uname -m)-alpine-linux \ + --target=$(uname -m)-alpine-linux \ + --disable-ld-override LD=ld.gold \ + ## 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 \ + ## 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 \ + --docs=none + +FROM bootstrap AS bootstrap-cabal + +ARG CABAL_VERSION_BUILD + +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" + +FROM alpine:3.20 AS ghc-base + +ARG IMAGE_LICENSE="MIT" +ARG IMAGE_SOURCE="https://gitlab.b-data.ch/ghc/ghc-musl" +ARG IMAGE_VENDOR="Olivier Benz" +ARG IMAGE_AUTHORS="Olivier Benz <olivier.benz@b-data.ch>" + +LABEL org.opencontainers.image.licenses="$IMAGE_LICENSE" \ + org.opencontainers.image.source="$IMAGE_SOURCE" \ + org.opencontainers.image.vendor="$IMAGE_VENDOR" \ + org.opencontainers.image.authors="$IMAGE_AUTHORS" + +ARG GHC_VERSION_BUILD +ARG CABAL_VERSION_BUILD +ARG STACK_VERSION + +ENV GHC_VERSION=${GHC_VERSION_BUILD} \ + CABAL_VERSION=${CABAL_VERSION_BUILD} \ + STACK_VERSION=${STACK_VERSION} + +RUN apk add --no-cache \ + bash \ + build-base \ + bzip2 \ + bzip2-dev \ + bzip2-static \ + curl \ + curl-static \ + dpkg \ + fakeroot \ + git \ + gmp-dev \ + libcurl \ + libffi \ + libffi-dev \ + llvm16 \ + ncurses-dev \ + ncurses-static \ + openssl-dev \ + openssl-libs-static \ + pcre \ + pcre-dev \ + pcre2 \ + pcre2-dev \ + perl \ + ## Install shadow for `stack --docker` + shadow \ + wget \ + xz \ + xz-dev \ + zlib \ + zlib-dev \ + zlib-static + +FROM ghc-base AS ghc-stage1 + +COPY --from=bootstrap-ghc /tmp/ghc-"$GHC_VERSION"/_build/bindist/ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz /tmp/ + +RUN cd /tmp \ + ## Install GHC + && tar -xJf ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz \ + && cd ghc-"$GHC_VERSION"-*-alpine-linux \ + && ./configure --disable-ld-override \ + && make install \ + ## Install Stack + && cd /tmp \ + && curl -sSLO https://github.com/commercialhaskell/stack/releases/download/v"$STACK_VERSION"/stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz \ + && curl -sSLO https://github.com/commercialhaskell/stack/releases/download/v"$STACK_VERSION"/stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz.sha256 \ + && sha256sum -cs stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz.sha256 \ + && tar -xzf stack-"$STACK_VERSION"-linux-"$(uname -m)".tar.gz \ + && mv stack-"$STACK_VERSION"-linux-"$(uname -m)"/stack /usr/local/bin/stack \ + ## Clean up + && rm -rf /tmp/* + +FROM ghc-stage1 AS ghc-stage2 + +## Install Cabal (the tool) built with the GHC bootstrap version +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" + +FROM ghc-stage1 AS test + +WORKDIR /usr/local/src + +## Install Cabal (the tool) built with the GHC target version +COPY --from=ghc-stage2 /root/.local/bin/cabal /usr/local/bin/cabal + +COPY Main.hs Main.hs + +RUN ghc -static -optl-pthread -optl-static Main.hs \ + && file Main \ + && ./Main \ + ## Test cabal workflow + && mkdir cabal-test \ + && cd cabal-test \ + && cabal update \ + && cabal init -n --is-executable -p tester -l MIT \ + && cabal run + +FROM ghc-base + +## Install GHC and Stack +COPY --from=ghc-stage1 /usr/local /usr/local + +## Install Cabal (the tool) built with the GHC target version +COPY --from=ghc-stage2 /root/.local/bin/cabal /usr/local/bin/cabal + +CMD ["ghci"]