Wolfgang Jeltsch pushed to branch wip/jeltsch/ghc-9-14-building-base at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -68,7 +68,7 @@ stages:
    68 68
       - tool-lint      # Source linting of the tools
    
    69 69
       - quick-build    # A very quick smoke-test to weed out broken commits
    
    70 70
       - full-build     # Build all the things
    
    71
    -  - testing        # head.hackage correctness and compiler performance testing
    
    71
    +  - testing        # Various tests
    
    72 72
       - packaging      # Source distribution, etc.
    
    73 73
       - deploy         # push documentation
    
    74 74
     
    
    ... ... @@ -1156,6 +1156,44 @@ ghc-wasm-meta-unreg:
    1156 1156
         UPSTREAM_GHC_FLAVOUR: unreg
    
    1157 1157
         UPSTREAM_GHC_JOB_NAME: x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf
    
    1158 1158
     
    
    1159
    +############################################################
    
    1160
    +# Testing the compatibility of `base` with other GHCs
    
    1161
    +############################################################
    
    1162
    +
    
    1163
    +base-with-other-ghcs-linux:
    
    1164
    +  stage: testing
    
    1165
    +  needs:
    
    1166
    +    - job: x86_64-linux-deb13-validate
    
    1167
    +      optional: true
    
    1168
    +    - job: nightly-x86_64-linux-deb13-validate
    
    1169
    +      optional: true
    
    1170
    +    - job: release-x86_64-linux-deb13-release
    
    1171
    +      optional: true
    
    1172
    +  dependencies: null
    
    1173
    +  image: debian:13
    
    1174
    +  tags:
    
    1175
    +    - x86_64-linux
    
    1176
    +  script: .gitlab/base-ci.sh x86_64-deb13-linux 9.14.1
    
    1177
    +  rules:
    
    1178
    +    - *full-ci
    
    1179
    +
    
    1180
    +base-with-other-ghcs-windows:
    
    1181
    +  stage: testing
    
    1182
    +  needs:
    
    1183
    +    - job: x86_64-windows-validate
    
    1184
    +      optional: true
    
    1185
    +    - job: nightly-x86_64-windows-validate
    
    1186
    +      optional: true
    
    1187
    +    - job: release-x86_64-windows-release
    
    1188
    +      optional: true
    
    1189
    +  dependencies: null
    
    1190
    +  image: null
    
    1191
    +  tags:
    
    1192
    +    - new-x86_64-windows
    
    1193
    +  script: bash .gitlab/base-ci.sh x86_64-unknown-mingw32 9.14.1
    
    1194
    +  rules:
    
    1195
    +    - *full-ci
    
    1196
    +
    
    1159 1197
     ############################################################
    
    1160 1198
     # Documentation deployment via GitLab Pages
    
    1161 1199
     ############################################################
    

  • .gitlab/base-ci.sh
    1
    +#!/usr/bin/env bash
    
    2
    +
    
    3
    +# This script supports testing the compatibility of the in-tree `base` with
    
    4
    +# different non-in-tree GHCs. We deliberately use a script separate from
    
    5
    +# `.gitlab/ci.sh` for this purpose, because such support is supposed to become
    
    6
    +# part of the CI infrastructure of a separately maintained `base`.
    
    7
    +#
    
    8
    +# Currently, this script can only test that the in-tree `base` can be *built*
    
    9
    +# with certain *released* GHCs.
    
    10
    +#
    
    11
    +# This script can run on both Unix and Windows. Since GHC’s CI infrastructure
    
    12
    +# does not offer Cabal pre-installed on Windows, this script uses a `Setup.hs`
    
    13
    +# file to build `base`, which works across operating systems.
    
    14
    +
    
    15
    +# Establish error propagation
    
    16
    +set -e -o pipefail
    
    17
    +
    
    18
    +# Process arguments
    
    19
    +if [ $# -lt 1 ]
    
    20
    +then
    
    21
    +  echo 'Build `base` with released GHCs'
    
    22
    +  echo "Usage: base-ci ⟨platform⟩ ⟨ghc-version⟩ …"
    
    23
    +  exit 1
    
    24
    +fi >&2
    
    25
    +platform=$1
    
    26
    +shift
    
    27
    +ghc_versions=$*
    
    28
    +
    
    29
    +# Save project root
    
    30
    +project_root=$PWD
    
    31
    +
    
    32
    +# Create directories for other GHCs
    
    33
    +mkdir other-ghcs
    
    34
    +mkdir other-ghcs/src
    
    35
    +mkdir other-ghcs/opt
    
    36
    +
    
    37
    +# Amend the `base` sources
    
    38
    +cd libraries/base
    
    39
    +sed -E -e 's/^( *ghc-internal)[^[:alnum:]-].*(,|$)/\1\2/' \
    
    40
    +  < base.cabal.in \
    
    41
    +  > base.cabal
    
    42
    +cat <<. >Setup.hs
    
    43
    +import Distribution.Simple
    
    44
    +main = defaultMain
    
    45
    +.
    
    46
    +cd "${project_root}"
    
    47
    +
    
    48
    +# Build `base` with the different GHCs
    
    49
    +for ghc_version in ${ghc_versions}
    
    50
    +do
    
    51
    +  # Install the GHC
    
    52
    +  ghc_installation=${project_root}/other-ghcs/opt/${ghc_version}
    
    53
    +  cd other-ghcs/src
    
    54
    +  archive_file=ghc-${ghc_version}-${platform}.tar.xz
    
    55
    +  curl https://downloads.haskell.org/~ghc/${ghc_version}/${archive_file} \
    
    56
    +    >${ghc_version}.tar.xz
    
    57
    +  tar -xJf ${ghc_version}.tar.xz
    
    58
    +  if [ -f ghc-${ghc_version}-*/configure ]
    
    59
    +  then # Unix
    
    60
    +    cd ghc-${ghc_version}-*
    
    61
    +    ./configure --prefix "${ghc_installation}"
    
    62
    +    make install
    
    63
    +  else # Windows
    
    64
    +    mv ghc-${ghc_version}-* "${ghc_installation}"
    
    65
    +  fi
    
    66
    +  cd "${project_root}"
    
    67
    +
    
    68
    +  # Build `base` with the installed GHC
    
    69
    +  cd libraries/base
    
    70
    +  "${ghc_installation}/bin/runghc" Setup.hs configure \
    
    71
    +    --with-compiler "${ghc_installation}/bin/ghc" \
    
    72
    +    --disable-optimization
    
    73
    +  "${ghc_installation}/bin/runghc" Setup.hs build
    
    74
    +  cd "${project_root}"
    
    75
    +done