Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

10 changed files:

Changes:

  • .gitignore
    ... ... @@ -120,7 +120,6 @@ _darcs/
    120 120
     /compiler/GHC/CmmToLlvm/Version/Bounds.hs
    
    121 121
     /compiler/ghc.cabal
    
    122 122
     /compiler/ghc.cabal.old
    
    123
    -/distrib/configure.ac
    
    124 123
     /distrib/ghc.iss
    
    125 124
     /docs/index.html
    
    126 125
     /docs/man
    

  • .gitlab/ci.sh
    ... ... @@ -62,9 +62,10 @@ Common Modes:
    62 62
     Environment variables affecting the build:
    
    63 63
     
    
    64 64
       CROSS_TARGET      Triple of cross-compilation target.
    
    65
    -  CROSS_STAGE       The stage of the cross-compiler to build either
    
    66
    -                      * 2: Build a normal cross-compiler bindist
    
    67
    -                      * 3: Build a target executable bindist (with the stage2 cross-compiler)
    
    65
    +  FINAL_CROSS_STAGE The final stage of the cross-compiler to build either
    
    66
    +                      * 2: Build a cross-compiler bindist
    
    67
    +                      * 3: Also build the target executable bindist
    
    68
    +                          (builds stages 2 and 3; implies the bindist of 2)
    
    68 69
       VERBOSE           Set to non-empty for verbose build output
    
    69 70
       RUNTEST_ARGS      Arguments passed to runtest.py
    
    70 71
       TEST_WAYS         Testsuite ways to run
    
    ... ... @@ -573,10 +574,17 @@ function build_hadrian() {
    573 574
         export XZ_OPT="${XZ_OPT:-} -T$cores"
    
    574 575
       fi
    
    575 576
     
    
    576
    -  case "${CROSS_STAGE:-2}" in
    
    577
    +  case "${FINAL_CROSS_STAGE:-2}" in
    
    577 578
         2) BINDIST_TARGET="binary-dist";;
    
    578
    -    3) BINDIST_TARGET="binary-dist-stage3";;
    
    579
    -    *) fail "Unknown CROSS_STAGE, must be 2 or 3";;
    
    579
    +    # Stage2 bindists are (almost) a byproduct of Stage3 bindists. So, we
    
    580
    +    # bundle both of them when the Stage3 bindist is built.
    
    581
    +    3)
    
    582
    +      BINDIST_TARGET="binary-dist binary-dist-stage3"
    
    583
    +      if [[ -z "${BIN_DIST_NAME_STAGE3:-}" ]]; then
    
    584
    +        fail "FINAL_CROSS_STAGE=3 requires BIN_DIST_NAME_STAGE3 to be set"
    
    585
    +      fi
    
    586
    +      ;;
    
    587
    +    *) fail "Unknown FINAL_CROSS_STAGE, must be 2 or 3";;
    
    580 588
       esac
    
    581 589
     
    
    582 590
       if [[ -n "${REINSTALL_GHC:-}" ]]; then
    
    ... ... @@ -590,6 +598,9 @@ function build_hadrian() {
    590 598
             *)
    
    591 599
               run_hadrian test:all_deps $BINDIST_TARGET
    
    592 600
               mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz"
    
    601
    +          if [[ "${FINAL_CROSS_STAGE:-2}" == "3" ]]; then
    
    602
    +            mv _build/bindist-stage3/ghc*.tar.xz "$BIN_DIST_NAME_STAGE3.tar.xz"
    
    603
    +          fi
    
    593 604
               ;;
    
    594 605
         esac
    
    595 606
       fi
    
    ... ... @@ -648,16 +659,6 @@ function install_bindist() {
    648 659
       end_section install-bindist
    
    649 660
     }
    
    650 661
     
    
    651
    -function find_bindist_tar() {
    
    652
    -  local tar_files
    
    653
    -  tar_files=( *ghc*.tar.xz )
    
    654
    -  if [[ ${#tar_files[@]} -gt 0 ]]; then
    
    655
    -    bindist_tar="${tar_files[0]}"
    
    656
    -  else
    
    657
    -    unset bindist_tar
    
    658
    -  fi
    
    659
    -}
    
    660
    -
    
    661 662
     # stage 1 tests -- these do not run as part
    
    662 663
     # of the test stage but already as part of the
    
    663 664
     # build stage as they don't require a bindist
    
    ... ... @@ -691,55 +692,92 @@ function test_hadrian_stage1() {
    691 692
         fi
    
    692 693
     }
    
    693 694
     
    
    694
    -function test_hadrian() {
    
    695
    -
    
    696
    -   # if a bindist tar exists, the variable $bindist_tar will be set
    
    697
    -   # that way we can later check for its existance to find whether
    
    698
    -   # we are running with a bindist.
    
    699
    -   find_bindist_tar
    
    700
    -   dist_dir="_build/bindist"
    
    701
    -
    
    702
    -   if [ -n "$bindist_tar" ]; then
    
    703
    -     mkdir -p "$dist_dir"
    
    704
    -     tar -xf "$bindist_tar" -C "$dist_dir"
    
    705
    -   fi
    
    706
    -
    
    695
    +# Smoke-test the cross-compiled Stage2 and Stage2 bindists using the emulator.
    
    696
    +# For cross jobs with a working emulator this runs instead of `test_hadrian`
    
    697
    +# as a separate validation step after the build.
    
    698
    +function smoke_test() {
    
    699
    +  check_msys2_deps _build/stage1/bin/ghc --version
    
    707 700
       check_release_build
    
    708 701
     
    
    709
    -  # GitLab's log viewer renders ANSI colors, but stdout here is not a tty,
    
    710
    -  # so the driver must be told to emit them.
    
    711
    -  RUNTEST_ARGS="${RUNTEST_ARGS:-} --force-colors"
    
    712
    -
    
    713
    -
    
    714 702
       if [[ "${CROSS_EMULATOR:-}" == "NOT_SET" ]]; then
    
    715 703
         info "Cannot test cross-compiled build without CROSS_EMULATOR being set."
    
    716 704
         return
    
    717
    -  # If we have set CROSS_EMULATOR, then can't test using normal testsuite.
    
    718
    -  elif [ -n "${CROSS_EMULATOR:-}" ] && [[ "${CROSS_TARGET:-}" != *"wasm"* ]]; then
    
    719
    -    info "Cross compiling with CROSS_EMULATOR='$CROSS_EMULATOR' and CROSS_TARGET='$CROSS_TARGET'"
    
    720
    -    local instdir="$TOP/_build/install"
    
    721
    -    local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
    
    722
    -    install_bindist $dist_dir/ghc-*/ "$instdir"
    
    723
    -    echo 'main = putStrLn "hello world"' > expected
    
    724
    -    run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello
    
    705
    +  fi
    
    706
    +
    
    707
    +  local instdir="$TOP/_build/install"
    
    708
    +  local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
    
    709
    +  install_bindist _build/bindist/ghc-*/ "$instdir"
    
    710
    +  echo 'main = putStrLn "hello world"' > expected
    
    711
    +  run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello
    
    712
    +
    
    713
    +  if [[ "${CROSS_TARGET:-no_cross_target}" =~ "mingw" ]]; then
    
    714
    +    ${CROSS_EMULATOR:-} ./hello.exe > actual
    
    715
    +  else
    
    716
    +    ${CROSS_EMULATOR:-} ./hello > actual
    
    717
    +  fi
    
    718
    +
    
    719
    +  # We have to use `-w` to make the test more stable across supported
    
    720
    +  # platforms, i.e. Windows:
    
    721
    +  # $ cmp expected actual
    
    722
    +  # differ: byte 30, line 1
    
    723
    +  # $ diff expected actual
    
    724
    +  # 1c1
    
    725
    +  # < main = putStrLn "hello world"
    
    726
    +  # ---
    
    727
    +  # > main = putStrLn "hello world"
    
    728
    +  run diff -w expected actual
    
    729
    +
    
    730
    +  if [[ "${FINAL_CROSS_STAGE:-2}" == "3" ]]; then
    
    731
    +    local stage3_dir
    
    732
    +    stage3_dir="$(echo _build/bindist-stage3/ghc-*/)"
    
    733
    +    local stage3_ghc="$stage3_dir/bin/ghc$exe"
    
    734
    +
    
    735
    +    info "Smoke-testing stage3 compiler..."
    
    736
    +    run ${CROSS_EMULATOR} "$stage3_ghc" --info > stage3-info
    
    737
    +    cat stage3-info
    
    738
    +
    
    739
    +    # The stage3 compiler is a native target compiler: it must not consider
    
    740
    +    # itself a cross-compiler, and GHCi support must be compiled in when the
    
    741
    +    # target supports it.
    
    742
    +    grep -q '"cross compiling","NO"' stage3-info \
    
    743
    +      || fail "stage3 compiler reports itself as cross-compiling"
    
    744
    +
    
    745
    +    if grep -q '"Use interpreter","YES"' stage3-info; then
    
    746
    +      echo 'ghci works' > ghci-expected
    
    747
    +      ${CROSS_EMULATOR:-} "$stage3_ghc" -e 'putStrLn "ghci works"' > ghci-actual
    
    748
    +      run diff -w ghci-expected ghci-actual
    
    749
    +    fi
    
    750
    +
    
    751
    +    run ${CROSS_EMULATOR} "$stage3_ghc" -package ghc "$TOP/.gitlab/hello.hs" -o hello-stage3
    
    725 752
     
    
    726 753
         if [[ "${CROSS_TARGET:-no_cross_target}" =~ "mingw" ]]; then
    
    727
    -      ${CROSS_EMULATOR:-} ./hello.exe > actual
    
    754
    +      ${CROSS_EMULATOR:-} ./hello-stage3.exe > actual-stage3
    
    728 755
         else
    
    729
    -      ${CROSS_EMULATOR:-} ./hello > actual
    
    756
    +      ${CROSS_EMULATOR:-} ./hello-stage3 > actual-stage3
    
    730 757
         fi
    
    731 758
     
    
    732
    -    # We have to use `-w` to make the test more stable across supported
    
    733
    -    # platforms, i.e. Windows:
    
    734
    -    # $ cmp expected actual
    
    735
    -    # differ: byte 30, line 1
    
    736
    -    # $ diff expected actual
    
    737
    -    # 1c1
    
    738
    -    # < main = putStrLn "hello world"
    
    739
    -    # ---
    
    740
    -    # > main = putStrLn "hello world"
    
    741
    -    run diff -w expected actual
    
    742
    -  elif [[ -n "${REINSTALL_GHC:-}" ]]; then
    
    759
    +    run diff -w expected actual-stage3
    
    760
    +  fi
    
    761
    +}
    
    762
    +
    
    763
    +function test_hadrian() {
    
    764
    +  # Extract the bindist tar built by the build job, if there is one
    
    765
    +  # (bindists are always named $BIN_DIST_NAME.tar.xz). If there is no
    
    766
    +  # bindist, we're testing an in-tree build (e.g. REINSTALL_GHC).
    
    767
    +  local dist_dir="_build/bindist"
    
    768
    +  local bindist_tar="${BIN_DIST_NAME:-}.tar.xz"
    
    769
    +  if [[ -n "${BIN_DIST_NAME:-}" && -e "$bindist_tar" ]]; then
    
    770
    +    mkdir -p "$dist_dir"
    
    771
    +    tar -xf "$bindist_tar" -C "$dist_dir"
    
    772
    +  fi
    
    773
    +
    
    774
    +  check_release_build
    
    775
    +
    
    776
    +  # GitLab's log viewer renders ANSI colors, but stdout here is not a tty,
    
    777
    +  # so the driver must be told to emit them.
    
    778
    +  RUNTEST_ARGS="${RUNTEST_ARGS:-} --force-colors"
    
    779
    +
    
    780
    +  if [[ -n "${REINSTALL_GHC:-}" ]]; then
    
    743 781
         info "Running with reinstall GHC $REINSTALL_GHC"
    
    744 782
         run_hadrian \
    
    745 783
           test \
    
    ... ... @@ -1168,6 +1206,7 @@ case ${1:-help} in
    1168 1206
         res=0
    
    1169 1207
         time_it "stage1 tests" test_hadrian_stage1 || res=$?
    
    1170 1208
         exit $res ;;
    
    1209
    +  smoke_test) time_it "smoke-test" smoke_test ;;
    
    1171 1210
       run_hadrian) shift; run_hadrian "$@" ;;
    
    1172 1211
       perf_test) run_perf_test ;;
    
    1173 1212
       abi_test) abi_test ;;
    

  • .gitlab/generate-ci/gen_ci.hs
    ... ... @@ -13,6 +13,7 @@
    13 13
     {-# LANGUAGE DerivingStrategies #-}
    
    14 14
     {-# LANGUAGE NamedFieldPuns #-}
    
    15 15
     {-# LANGUAGE TypeFamilies #-}
    
    16
    +{-# LANGUAGE MultiWayIf #-}
    
    16 17
     
    
    17 18
     import Data.Aeson as A
    
    18 19
     import qualified Data.Map as Map
    
    ... ... @@ -113,26 +114,49 @@ data Opsys
    113 114
       = Linux LinuxDistro
    
    114 115
       | Darwin
    
    115 116
       | FreeBSD14
    
    116
    -  | Windows deriving (Eq)
    
    117
    +  | Windows deriving (Eq, Show)
    
    117 118
     
    
    118 119
     data LinuxDistro
    
    119 120
       = Debian13
    
    120 121
       | Debian12
    
    121
    -  | Debian12Wine
    
    122
    -  | Debian13Riscv
    
    123 122
       | Debian11
    
    124
    -  | Debian11Js
    
    125 123
       | Fedora43
    
    126
    -  | Ubuntu2404LoongArch64
    
    127 124
       | Ubuntu2404
    
    128 125
       | Ubuntu2204
    
    129 126
       | Alpine312
    
    130 127
       | Alpine323
    
    131
    -  | AlpineWasm
    
    132 128
       | Rocky8
    
    133
    -  deriving (Eq)
    
    134
    -
    
    135
    -data Arch = Amd64 | AArch64 | I386
    
    129
    +  deriving (Eq, Show)
    
    130
    +
    
    131
    +data Arch = Amd64 | AArch64 | I386 | RiscV64 | LoongArch | Wasm32 | JavaScript
    
    132
    +  deriving (Show)
    
    133
    +
    
    134
    +-- | Describes what the docker image is for: the development flavour of the
    
    135
    +-- build environment, orthogonal to the image's own architecture ('Arch').
    
    136
    +-- E.g. @FlavorRiscV@ denotes the image that carries the RISC-V cross
    
    137
    +-- toolchain.
    
    138
    +data ImageFlavor
    
    139
    +  = FlavorVanilla
    
    140
    +  | FlavorRiscV
    
    141
    +  | FlavorLoongArch
    
    142
    +  | FlavorWine
    
    143
    +  | FlavorEmscripten
    
    144
    +  | FlavorWasm
    
    145
    +  deriving (Eq, Show)
    
    146
    +
    
    147
    +-- | OS element of a configure target triple: this is the OS of the *target*
    
    148
    +-- platform, not the build environment (that is 'Opsys'/'LinuxDistro').
    
    149
    +data TargetOs
    
    150
    +  = TargetOsLinuxGnu
    
    151
    +  | TargetOsGhcjs
    
    152
    +  | TargetOsMingw32
    
    153
    +  | TargetOsWasi
    
    154
    +  deriving (Eq, Show)
    
    155
    +
    
    156
    +data TargetPlatform = TargetPlatform
    
    157
    +  { tpArch :: Arch     -- ^ target architecture, e.g. 'RiscV64'
    
    158
    +  , tpOs   :: TargetOs -- ^ target OS, e.g. 'TargetOsLinuxGnu'
    
    159
    +  }
    
    136 160
     
    
    137 161
     data BignumBackend = Native | Gmp deriving Eq
    
    138 162
     
    
    ... ... @@ -161,8 +185,8 @@ data BuildConfig
    161 185
                     , withAssertions :: Bool
    
    162 186
                     , withNuma       :: Bool
    
    163 187
                     , withZstd       :: Bool
    
    164
    -                , crossTarget    :: Maybe String
    
    165
    -                , crossStage     :: Maybe Int
    
    188
    +                , crossTarget    :: Maybe TargetPlatform
    
    189
    +                , crossStages    :: Maybe CrossStages
    
    166 190
                     , crossEmulator  :: CrossEmulator
    
    167 191
                     , configureWrapper :: Maybe String
    
    168 192
                     , fullyStatic    :: Bool
    
    ... ... @@ -184,7 +208,7 @@ configureArgsStr bc = unwords $
    184 208
          ["--enable-unregisterised"| unregisterised bc ]
    
    185 209
       ++ ["--disable-tables-next-to-code" | not (tablesNextToCode bc) ]
    
    186 210
       ++ ["--with-intree-gmp" | Just _ <- [crossTarget bc] ]
    
    187
    -  ++ ["--with-system-libffi" | crossTarget bc == Just "wasm32-wasi" ]
    
    211
    +  ++ ["--with-system-libffi" | (tpOs <$> crossTarget bc) == Just TargetOsWasi ]
    
    188 212
       ++ ["--enable-ipe-data-compression" | withZstd bc ]
    
    189 213
       ++ ["--enable-strict-ghc-toolchain-check"]
    
    190 214
     
    
    ... ... @@ -233,7 +257,7 @@ vanilla = BuildConfig
    233 257
       , withNuma = False
    
    234 258
       , withZstd = False
    
    235 259
       , crossTarget = Nothing
    
    236
    -  , crossStage  = Nothing
    
    260
    +  , crossStages = Nothing
    
    237 261
       , crossEmulator = NoEmulator
    
    238 262
       , configureWrapper = Nothing
    
    239 263
       , fullyStatic = False
    
    ... ... @@ -280,17 +304,54 @@ static = vanilla { fullyStatic = True }
    280 304
     staticNativeInt :: BuildConfig
    
    281 305
     staticNativeInt = static { bignumBackend = Native }
    
    282 306
     
    
    283
    -crossConfig :: String       -- ^ target triple
    
    307
    +-- | The cross stages a build produces binary distributions for
    
    308
    +data CrossStages
    
    309
    +  = -- | Builds a cross-compiler (build == host, host /= target):
    
    310
    +    -- its bindist runs on the build host.
    
    311
    +    Stage2
    
    312
    +  | -- | Implies `Stage2` and additionally builds a cross-compiled compiler
    
    313
    +    -- (build /= host, host == target).
    
    314
    +    Stage2And3
    
    315
    +  deriving stock (Eq, Ord)
    
    316
    +
    
    317
    +crossConfig :: TargetPlatform -- ^ target platform
    
    284 318
                 -> CrossEmulator -- ^ emulator for testing
    
    285 319
                 -> Maybe String -- ^ Configure wrapper
    
    320
    +            -> CrossStages -- ^ final cross stages to build bindists for
    
    286 321
                 -> BuildConfig
    
    287
    -crossConfig triple emulator configure_wrapper =
    
    288
    -    vanilla { crossTarget = Just triple
    
    289
    -            , crossStage  = Just 2
    
    322
    +crossConfig targetPlatform emulator configure_wrapper crossStage =
    
    323
    +    vanilla { crossTarget = Just targetPlatform
    
    324
    +            , crossStages  = Just crossStage
    
    290 325
                 , crossEmulator = emulator
    
    291 326
                 , configureWrapper = configure_wrapper
    
    292 327
                 }
    
    293 328
     
    
    329
    +-- | The docker image flavour of a build, derived from its cross target
    
    330
    +-- (the image must carry the target's toolchain) or 'FlavorVanilla' for
    
    331
    +-- plain builds.
    
    332
    +buildFlavor :: BuildConfig -> ImageFlavor
    
    333
    +buildFlavor bc = maybe FlavorVanilla flavorOf (crossTarget bc)
    
    334
    +  where
    
    335
    +    flavorOf :: TargetPlatform -> ImageFlavor
    
    336
    +    flavorOf TargetPlatform{ tpArch = arch, tpOs = os } = case (arch, os) of
    
    337
    +      (AArch64,    TargetOsLinuxGnu) -> FlavorVanilla
    
    338
    +      (AArch64,    TargetOsMingw32)  -> FlavorWine
    
    339
    +      (RiscV64,    TargetOsLinuxGnu) -> FlavorRiscV
    
    340
    +      (LoongArch,  TargetOsLinuxGnu) -> FlavorLoongArch
    
    341
    +      (Wasm32,     TargetOsWasi)     -> FlavorWasm
    
    342
    +      (JavaScript, TargetOsGhcjs)    -> FlavorEmscripten
    
    343
    +      _                              -> error $
    
    344
    +        "flavorOf: no image flavour for target " ++ show arch ++ "/" ++ show os
    
    345
    +
    
    346
    +-- | The configure target triple the build system consumes, e.g.
    
    347
    +-- @"riscv64-linux-gnu"@.
    
    348
    +renderTriple :: TargetPlatform -> String
    
    349
    +renderTriple TargetPlatform{ tpArch = arch, tpOs = os } = case os of
    
    350
    +  TargetOsLinuxGnu -> archName arch ++ "-linux-gnu"
    
    351
    +  TargetOsGhcjs    -> archName arch ++ "-unknown-ghcjs"
    
    352
    +  TargetOsMingw32  -> archName arch ++ "-unknown-mingw32"
    
    353
    +  TargetOsWasi     -> archName arch ++ "-wasi"
    
    354
    +
    
    294 355
     llvm :: BuildConfig
    
    295 356
     llvm = vanilla { llvmBootstrap = True, testsuiteWays = ["llvm", "optllvm"] }
    
    296 357
     
    
    ... ... @@ -312,16 +373,16 @@ usePerfProfilingTestsuite bc = bc { testsuiteUsePerf = True }
    312 373
     
    
    313 374
     -- | These tags have to match what we call the runners on gitlab
    
    314 375
     runnerTag :: Arch -> Opsys -> String
    
    315
    -runnerTag arch (Linux _) =
    
    316
    -  case arch of
    
    317
    -    Amd64                -> "x86_64-linux"
    
    318
    -    AArch64              -> "aarch64-linux"
    
    319
    -    I386                 -> "x86_64-linux"
    
    320
    -runnerTag AArch64 Darwin  = "aarch64-darwin"
    
    321
    -runnerTag Amd64 Darwin    = "x86_64-darwin-m1"
    
    322
    -runnerTag Amd64 Windows   = "new-x86_64-windows"
    
    323
    -runnerTag Amd64 FreeBSD14 = "x86_64-freebsd14"
    
    324
    -runnerTag _ _             = error "Invalid arch/opsys"
    
    376
    +runnerTag arch opsys = case (arch, opsys) of
    
    377
    +  (Amd64,   Linux{})    -> "x86_64-linux"
    
    378
    +  (AArch64, Linux{})    -> "aarch64-linux"
    
    379
    +  (I386,    Linux{})    -> "x86_64-linux"
    
    380
    +  (AArch64, Darwin)     -> "aarch64-darwin"
    
    381
    +  (Amd64,   Darwin)     -> "x86_64-darwin-m1"
    
    382
    +  (Amd64,   Windows)    -> "new-x86_64-windows"
    
    383
    +  (Amd64,   FreeBSD14)  -> "x86_64-freebsd14"
    
    384
    +  _                     -> error $ "runnerTag: no runner for "
    
    385
    +                                      ++ show arch ++ "/" ++ show opsys
    
    325 386
     
    
    326 387
     tags :: Arch -> Opsys -> BuildConfig -> [String]
    
    327 388
     tags arch opsys _bc = [runnerTag arch opsys] -- Tag for which runners we can use
    
    ... ... @@ -329,52 +390,92 @@ tags arch opsys _bc = [runnerTag arch opsys] -- Tag for which runners we can use
    329 390
     runnerPerfTag :: Arch -> Opsys -> String
    
    330 391
     runnerPerfTag arch sys = runnerTag arch sys ++ "-perf"
    
    331 392
     
    
    332
    --- These names are used to find the docker image so they have to match what is
    
    333
    --- in the docker registry.
    
    393
    +-- | These names are used to find the docker image so they have to match what
    
    394
    +-- is in the docker registry.
    
    334 395
     distroName :: LinuxDistro -> String
    
    335 396
     distroName Debian13      = "deb13"
    
    336 397
     distroName Debian12      = "deb12"
    
    337 398
     distroName Debian11      = "deb11"
    
    338
    -distroName Debian11Js    = "deb11-emsdk-closure"
    
    339
    -distroName Debian13Riscv = "deb13-riscv"
    
    340
    -distroName Debian12Wine  = "deb12-wine"
    
    341 399
     distroName Fedora43      = "fedora43"
    
    342
    -distroName Ubuntu2404LoongArch64 = "ubuntu24_04-loongarch"
    
    343 400
     distroName Ubuntu2204    = "ubuntu22_04"
    
    344 401
     distroName Ubuntu2404    = "ubuntu24_04"
    
    345 402
     distroName Alpine312     = "alpine3_12"
    
    346 403
     distroName Alpine323     = "alpine3_23"
    
    347
    -distroName AlpineWasm    = "alpine3_23-wasm"
    
    348 404
     distroName Rocky8        = "rocky8"
    
    349 405
     
    
    350
    -opsysName :: Opsys -> String
    
    351
    -opsysName (Linux distro) = "linux-" ++ distroName distro
    
    352
    -opsysName Darwin         = "darwin"
    
    353
    -opsysName FreeBSD14      = "freebsd14"
    
    354
    -opsysName Windows        = "windows"
    
    406
    +-- | The distro tag used in docker image names, extended with the toolchain
    
    407
    +-- suffix of the image flavour (e.g. 'Debian13'' + 'FlavorRiscV' ->
    
    408
    +-- @"deb13-riscv"@).
    
    409
    +distroImageTag :: LinuxDistro -> ImageFlavor -> String
    
    410
    +distroImageTag distro flavor = distroName distro ++ flavorSuffix flavor
    
    411
    +  where
    
    412
    +    flavorSuffix :: ImageFlavor -> String
    
    413
    +    flavorSuffix FlavorVanilla    = ""
    
    414
    +    flavorSuffix FlavorRiscV      = "-riscv"
    
    415
    +    flavorSuffix FlavorLoongArch  = "-loongarch"
    
    416
    +    flavorSuffix FlavorWine       = "-wine"
    
    417
    +    flavorSuffix FlavorEmscripten = "-emsdk-closure"
    
    418
    +    flavorSuffix FlavorWasm       = "-wasm"
    
    419
    +
    
    420
    +-- | OS name as it appears for job identity and docker image tags, qualified
    
    421
    +-- by the working image flavour if any (e.g. @"linux-deb13-riscv"@).
    
    422
    +opsysNameWithFlavor :: Opsys -> ImageFlavor -> String
    
    423
    +opsysNameWithFlavor (Linux distro) flavor = "linux-" ++ distroImageTag distro flavor
    
    424
    +opsysNameWithFlavor opsys         _       = opsysName opsys
    
    425
    +  where
    
    426
    +    opsysName :: Opsys -> String
    
    427
    +    opsysName (Linux distro) = "linux-" ++ distroName distro
    
    428
    +    opsysName Darwin         = "darwin"
    
    429
    +    opsysName FreeBSD14      = "freebsd14"
    
    430
    +    opsysName Windows        = "windows"
    
    355 431
     
    
    356 432
     archName :: Arch -> String
    
    357
    -archName Amd64   = "x86_64"
    
    358
    -archName AArch64 = "aarch64"
    
    359
    -archName I386    = "i386"
    
    433
    +archName Amd64       = "x86_64"
    
    434
    +archName AArch64     = "aarch64"
    
    435
    +archName I386        = "i386"
    
    436
    +archName RiscV64     = "riscv64"
    
    437
    +archName LoongArch   = "loongarch64"
    
    438
    +archName Wasm32      = "wasm32"
    
    439
    +archName JavaScript  = "javascript"
    
    360 440
     
    
    361 441
     binDistName :: Arch -> Opsys -> BuildConfig -> String
    
    362
    -binDistName arch opsys bc = "ghc-" ++ testEnv arch opsys bc
    
    442
    +binDistName arch  opsys bc = "ghc-" ++ testEnvWith (archName arch) opsys bc
    
    443
    +
    
    444
    +-- | Name of the stage3 (target-platform) bindist.
    
    445
    +--
    
    446
    +-- Because that bindist lives on its target, it is named as if built natively
    
    447
    +-- on the target: target architecture, the OS of the job, and no
    
    448
    +-- cross/toolchain flavour markers.
    
    449
    +stage3BinDistName :: Opsys -> BuildConfig -> Maybe String
    
    450
    +stage3BinDistName opsys bc
    
    451
    +  | buildsTargetBindist
    
    452
    +  , Just TargetPlatform{ tpArch = arch } <- crossTarget bc
    
    453
    +  = Just $ binDistName arch opsys (bc { crossTarget = Nothing })
    
    454
    +  | otherwise
    
    455
    +  = Nothing
    
    456
    +  where
    
    457
    +    -- Whether any bindist produced by this build configuration runs on its
    
    458
    +    -- target platform rather than on the build host.
    
    459
    +    buildsTargetBindist :: Bool
    
    460
    +    buildsTargetBindist = crossStages bc == Just Stage2And3
    
    363 461
     
    
    364 462
     -- | Test env should create a string which changes whenever the 'BuildConfig' changes.
    
    365 463
     -- Either the change is reflected by modifying the flavourString or directly (as is
    
    366 464
     -- the case for settings which affect environment variables)
    
    367 465
     testEnv :: Arch -> Opsys -> BuildConfig -> String
    
    368
    -testEnv arch opsys bc =
    
    466
    +testEnv arch = testEnvWith (archName arch)
    
    467
    +
    
    468
    +testEnvWith :: String -> Opsys -> BuildConfig -> String
    
    469
    +testEnvWith archN opsys bc =
    
    369 470
       intercalate "-" $ concat
    
    370
    -    [ [ archName arch
    
    371
    -      , opsysName opsys ]
    
    471
    +    [ [ archN
    
    472
    +      , opsysNameWithFlavor opsys (buildFlavor bc) ]
    
    372 473
         , ["int_" ++ bignumString (bignumBackend bc) | bignumBackend bc /= Gmp]
    
    373 474
         , ["unreg" | unregisterised bc ]
    
    374 475
         , ["numa"  | withNuma bc ]
    
    375 476
         , ["zstd"  | withZstd bc ]
    
    376 477
         , ["no_tntc"  | not (tablesNextToCode bc) ]
    
    377
    -    , ["cross_"++triple  | Just triple <- pure $ crossTarget bc ]
    
    478
    +    , ["cross_"++renderTriple ct | Just ct <- pure $ crossTarget bc ]
    
    378 479
         , [flavourString (mkJobFlavour bc)]
    
    379 480
         ]
    
    380 481
     
    
    ... ... @@ -397,18 +498,18 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f
    397 498
         flavour_string TextWithSIMDUTF = "text_simdutf"
    
    398 499
     
    
    399 500
     -- The path to the docker image (just for linux builders)
    
    400
    -dockerImage :: Arch -> Opsys -> Maybe String
    
    401
    -dockerImage arch (Linux distro) =
    
    501
    +dockerImage :: Arch -> Opsys -> BuildConfig -> Maybe String
    
    502
    +dockerImage arch (Linux distro) bc =
    
    402 503
         Just image
    
    403 504
       where
    
    404 505
         image = mconcat
    
    405 506
           [ "registry.gitlab.haskell.org/ghc/ci-images/"
    
    406 507
           , archName arch
    
    407 508
           , "-linux-"
    
    408
    -      , distroName distro
    
    509
    +      , distroImageTag distro (buildFlavor bc)
    
    409 510
           , ":$DOCKER_REV"
    
    410 511
           ]
    
    411
    -dockerImage _ _ = Nothing
    
    512
    +dockerImage _ _ _ = Nothing
    
    412 513
     
    
    413 514
     -----------------------------------------------------------------------------
    
    414 515
     -- Platform-specific variables
    
    ... ... @@ -449,8 +550,8 @@ brokenTest :: TestName -- ^ test name
    449 550
                -> Variables
    
    450 551
     brokenTest test _why = "BROKEN_TESTS" =: test
    
    451 552
     
    
    452
    -opsysVariables :: Arch -> Opsys -> Variables
    
    453
    -opsysVariables _ FreeBSD14 = mconcat
    
    553
    +opsysVariables :: Arch -> Opsys -> ImageFlavor -> Variables
    
    554
    +opsysVariables _ FreeBSD14 _ = mconcat
    
    454 555
       [ -- N.B. we use iconv from ports as I see linker errors when we attempt
    
    455 556
         -- to use the "native" iconv embedded in libc as suggested by the
    
    456 557
         -- porting guide [1].
    
    ... ... @@ -464,8 +565,8 @@ opsysVariables _ FreeBSD14 = mconcat
    464 565
       , "FETCH_GHC_VERSION" =: "9.10.3"
    
    465 566
       , "CABAL_INSTALL_VERSION" =: "3.14.2.0"
    
    466 567
       ]
    
    467
    -opsysVariables arch (Linux distro) = distroVariables arch distro
    
    468
    -opsysVariables AArch64 (Darwin {}) = mconcat
    
    568
    +opsysVariables arch (Linux distro) flavor = distroVariables arch distro flavor
    
    569
    +opsysVariables AArch64 (Darwin {}) _ = mconcat
    
    469 570
       [ "NIX_SYSTEM" =: "aarch64-darwin"
    
    470 571
       , "MACOSX_DEPLOYMENT_TARGET" =: "11.0"
    
    471 572
       , "LANG" =: "en_US.UTF-8"
    
    ... ... @@ -473,7 +574,7 @@ opsysVariables AArch64 (Darwin {}) = mconcat
    473 574
         -- Fonts can't be installed on darwin
    
    474 575
       , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
    
    475 576
       ]
    
    476
    -opsysVariables Amd64 (Darwin {}) = mconcat
    
    577
    +opsysVariables Amd64 (Darwin {}) _ = mconcat
    
    477 578
       [ "NIX_SYSTEM" =: "x86_64-darwin"
    
    478 579
       , "MACOSX_DEPLOYMENT_TARGET" =: "11.0"
    
    479 580
         -- Only Sierra and onwards supports clock_gettime. See #12858
    
    ... ... @@ -486,16 +587,15 @@ opsysVariables Amd64 (Darwin {}) = mconcat
    486 587
       , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi"
    
    487 588
         -- Fonts can't be installed on darwin
    
    488 589
       , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
    
    489
    -
    
    490 590
       ]
    
    491
    -opsysVariables _ (Windows {}) = mconcat
    
    591
    +opsysVariables _ (Windows {}) _ = mconcat
    
    492 592
       [ "MSYSTEM" =: "CLANG64"
    
    493 593
       , "LANG" =: "en_US.UTF-8"
    
    494 594
       , "CABAL_INSTALL_VERSION" =: "3.14.2.0"
    
    495 595
       , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
    
    496 596
       , "FETCH_GHC_VERSION" =: "9.10.3"
    
    497 597
       ]
    
    498
    -opsysVariables _ _ = mempty
    
    598
    +opsysVariables _ _ _ = mempty
    
    499 599
     
    
    500 600
     alpineVariables :: Arch -> Variables
    
    501 601
     alpineVariables arch = mconcat $
    
    ... ... @@ -514,10 +614,13 @@ alpineVariables arch = mconcat $
    514 614
       ]
    
    515 615
     
    
    516 616
     
    
    517
    -distroVariables :: Arch -> LinuxDistro -> Variables
    
    518
    -distroVariables arch Alpine312 = alpineVariables arch
    
    519
    -distroVariables arch Alpine323 = alpineVariables arch
    
    520
    -distroVariables _ _ = mempty
    
    617
    +distroVariables :: Arch -> LinuxDistro -> ImageFlavor -> Variables
    
    618
    +distroVariables arch Alpine312 _ = alpineVariables arch
    
    619
    +-- The wasm image runs its own (libc-free) toolchain, so the alpine broken
    
    620
    +-- tests do not apply to it.
    
    621
    +distroVariables _ Alpine323 FlavorWasm = mempty
    
    622
    +distroVariables arch Alpine323 _ = alpineVariables arch
    
    623
    +distroVariables _ _ _ = mempty
    
    521 624
     
    
    522 625
     -----------------------------------------------------------------------------
    
    523 626
     -- Cache settings, what to cache and when can we share the cache
    
    ... ... @@ -529,8 +632,8 @@ data Cache
    529 632
               }
    
    530 633
     
    
    531 634
     -- The cache doesn't depend on the BuildConfig because we only cache the cabal store.
    
    532
    -mkCacheKey :: Arch -> Opsys -> String
    
    533
    -mkCacheKey arch opsys = archName arch <> "-" <> opsysName opsys <> "-$CACHE_REV"
    
    635
    +mkCacheKey :: Arch -> Opsys -> ImageFlavor -> String
    
    636
    +mkCacheKey arch opsys flavor = archName arch <> "-" <> opsysNameWithFlavor opsys flavor <> "-$CACHE_REV"
    
    534 637
     
    
    535 638
     instance ToJSON Cache where
    
    536 639
       toJSON Cache {..} = object
    
    ... ... @@ -815,7 +918,7 @@ data Job
    815 918
             , jobArtifacts :: Artifacts
    
    816 919
             , jobCache :: Cache
    
    817 920
             , jobRules :: OnOffRules
    
    818
    -        , jobPlatform  :: (Arch, Opsys)
    
    921
    +        , jobPlatform  :: (Arch, Opsys, ImageFlavor)
    
    819 922
             }
    
    820 923
     
    
    821 924
     instance Show Job where
    
    ... ... @@ -845,18 +948,23 @@ job :: Arch -> Opsys -> BuildConfig -> BuildAndTestJob Job
    845 948
     job arch opsys buildConfig =
    
    846 949
       MkBuildAndTestJob
    
    847 950
         { buildJob = NamedJob { name = jobName, jobInfo = Job { jobScript = jobBuildScript, jobStage = "full-build", jobNeeds =  [("hadrian-ghc-in-ghci", False)], jobArtifacts = buildJobArtifacts, ..} }
    
    848
    -    , testJobs =
    
    849
    -      NamedJob { name = jobName <> "-test", jobInfo = testJobInfo } :
    
    850
    -      [ NamedJob
    
    851
    -        { name = jobName <> "-testperf"
    
    852
    -        , jobInfo = testJobInfo
    
    853
    -          { jobVariables = testJobInfo.jobVariables <> "RUNTEST_ARGS" =: "--config perf_path=perf"
    
    854
    -          , jobTags = [runnerPerfTag arch opsys]
    
    855
    -          } }
    
    856
    -        | testsuiteUsePerf buildConfig  ] }
    
    951
    +    , testJobs = if
    
    952
    +       -- if we need an emulator to run the testsuite, we skip for now
    
    953
    +       -- in future we should run the testsuite using an appropriate target
    
    954
    +       -- platform runner
    
    955
    +       | Emulator {} <- crossEmulator buildConfig -> []
    
    956
    +       | otherwise ->
    
    957
    +            NamedJob { name = jobName <> "-test", jobInfo = testJobInfo } :
    
    958
    +            [ NamedJob
    
    959
    +              { name = jobName <> "-testperf"
    
    960
    +              , jobInfo = testJobInfo
    
    961
    +                { jobVariables = testJobInfo.jobVariables <> "RUNTEST_ARGS" =: "--config perf_path=perf"
    
    962
    +                , jobTags = [runnerPerfTag arch opsys]
    
    963
    +                } }
    
    964
    +              | testsuiteUsePerf buildConfig  ] }
    
    857 965
       where
    
    858 966
         testJobInfo = Job {jobScript = jobTestScript, jobNeeds = [(jobName, True)], jobStage = "testing", jobArtifacts = testJobArtifacts, ..}
    
    859
    -    jobPlatform = (arch, opsys)
    
    967
    +    jobPlatform = (arch, opsys, buildFlavor buildConfig)
    
    860 968
     
    
    861 969
         jobRules = emptyRules jobName
    
    862 970
     
    
    ... ... @@ -864,7 +972,7 @@ job arch opsys buildConfig =
    864 972
     
    
    865 973
         jobTags = tags arch opsys buildConfig
    
    866 974
     
    
    867
    -    jobDockerImage = dockerImage arch opsys
    
    975
    +    jobDockerImage = dockerImage arch opsys buildConfig
    
    868 976
     
    
    869 977
         jobTestScript
    
    870 978
           | Windows <- opsys
    
    ... ... @@ -883,7 +991,7 @@ job arch opsys buildConfig =
    883 991
           = [ "bash .gitlab/ci.sh setup"
    
    884 992
             , "bash .gitlab/ci.sh configure"
    
    885 993
             , "bash .gitlab/ci.sh build_hadrian"
    
    886
    -        , "bash .gitlab/ci.sh test_hadrian_stage1"
    
    994
    +        , "bash " ++ testStep
    
    887 995
             ]
    
    888 996
           | otherwise
    
    889 997
           = [ "find libraries -name config.sub -exec cp config.sub {} \\;" | Darwin == opsys ] ++
    
    ... ... @@ -892,9 +1000,16 @@ job arch opsys buildConfig =
    892 1000
             [ ".gitlab/ci.sh setup"
    
    893 1001
             , ".gitlab/ci.sh configure"
    
    894 1002
             , ".gitlab/ci.sh build_hadrian"
    
    895
    -        , ".gitlab/ci.sh test_hadrian_stage1"
    
    1003
    +        , testStep
    
    896 1004
             ]
    
    897 1005
     
    
    1006
    +    -- Cross jobs with a working emulator smoke-test the bindist under the
    
    1007
    +    -- emulator as a separate step after the build; everything else runs the
    
    1008
    +    -- testsuite.
    
    1009
    +    testStep
    
    1010
    +      | Emulator _ <- crossEmulator buildConfig = ".gitlab/ci.sh smoke_test"
    
    1011
    +      | otherwise                               = ".gitlab/ci.sh test_hadrian_stage1"
    
    1012
    +
    
    898 1013
         jobAfterScript
    
    899 1014
           | Windows <- opsys =
    
    900 1015
           [ "bash .gitlab/ci.sh save_cache"
    
    ... ... @@ -911,16 +1026,20 @@ job arch opsys buildConfig =
    911 1026
         jobFlavour = mkJobFlavour buildConfig
    
    912 1027
     
    
    913 1028
         jobVariables = mconcat
    
    914
    -      [ opsysVariables arch opsys
    
    1029
    +      [ opsysVariables arch opsys (buildFlavor buildConfig)
    
    915 1030
           , "TEST_ENV" =: testEnv arch opsys buildConfig
    
    916 1031
           , "BIN_DIST_NAME" =: binDistName arch opsys buildConfig
    
    1032
    +      , maybe mempty ("BIN_DIST_NAME_STAGE3" =:) (stage3BinDistName opsys buildConfig)
    
    917 1033
           , "BUILD_FLAVOUR" =: flavourString jobFlavour
    
    918 1034
           , "BIGNUM_BACKEND" =: bignumString (bignumBackend buildConfig)
    
    919 1035
           , "CONFIGURE_ARGS" =: configureArgsStr buildConfig
    
    920 1036
           , "INSTALL_CONFIGURE_ARGS" =: "--enable-strict-ghc-toolchain-check"
    
    921 1037
           , maybe mempty ("CONFIGURE_WRAPPER" =:) (configureWrapper buildConfig)
    
    922
    -      , maybe mempty ("CROSS_TARGET" =:) (crossTarget buildConfig)
    
    923
    -      , maybe mempty (("CROSS_STAGE" =:) . show) (crossStage buildConfig)
    
    1038
    +      , maybe mempty (("CROSS_TARGET" =:) . renderTriple) (crossTarget buildConfig)
    
    1039
    +      , case crossStages buildConfig of
    
    1040
    +          Nothing          -> mempty
    
    1041
    +          Just Stage2      -> "FINAL_CROSS_STAGE" =: "2"
    
    1042
    +          Just Stage2And3  -> "FINAL_CROSS_STAGE" =: "3"
    
    924 1043
           , case crossEmulator buildConfig of
    
    925 1044
               NoEmulator
    
    926 1045
                 -- we need an emulator but it isn't set. Won't run the testsuite
    
    ... ... @@ -952,6 +1071,8 @@ job arch opsys buildConfig =
    952 1071
         trim :: String -> String
    
    953 1072
         trim = dropWhileEnd isSpace . dropWhile isSpace
    
    954 1073
     
    
    1074
    +    stage3Artifacts = maybe [] (\n -> [n ++ ".tar.xz"]) (stage3BinDistName opsys buildConfig)
    
    1075
    +
    
    955 1076
         -- Keep in sync with the exclude list in `function clean()` in
    
    956 1077
         -- `.gitlab/ci.sh`!
    
    957 1078
         buildJobArtifacts = Artifacts
    
    ... ... @@ -961,6 +1082,7 @@ job arch opsys buildConfig =
    961 1082
                             , "junit.xml"
    
    962 1083
                             , "unexpected-test-output.tar.gz"
    
    963 1084
                             , "_build/stage1/haddock-timing-files"]
    
    1085
    +                        ++ stage3Artifacts
    
    964 1086
           , artifactsWhen = ArtifactsAlways
    
    965 1087
           }
    
    966 1088
     
    
    ... ... @@ -980,7 +1102,7 @@ job arch opsys buildConfig =
    980 1102
               Cache { cachePaths = [], cacheKey = "no-caching" }
    
    981 1103
           | otherwise = Cache
    
    982 1104
               { cachePaths = [ "cabal-cache", "toolchain" ]
    
    983
    -          , cacheKey = mkCacheKey arch opsys
    
    1105
    +          , cacheKey = mkCacheKey arch opsys (buildFlavor buildConfig)
    
    984 1106
     
    
    985 1107
               }
    
    986 1108
     
    
    ... ... @@ -1212,7 +1334,6 @@ debian_x86 =
    1212 1334
       , disableValidate (standardBuilds Amd64 (Linux Debian12))
    
    1213 1335
       , disableValidate (standardBuilds Amd64 (Linux Debian13))
    
    1214 1336
     
    
    1215
    -
    
    1216 1337
         -- Validate only builds
    
    1217 1338
       , fastCI (validateBuilds Amd64 (Linux validate_debian) debug)
    
    1218 1339
       , validateBuilds Amd64 (Linux validate_debian) nativeInt
    
    ... ... @@ -1335,16 +1456,17 @@ alpine_aarch64 = [
    1335 1456
     cross_jobs :: [JobGroup Job]
    
    1336 1457
     cross_jobs = [
    
    1337 1458
         -- x86 -> aarch64
    
    1338
    -    validateBuilds Amd64 (Linux Debian13) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing)
    
    1459
    +    validateBuilds Amd64 (Linux Debian13) (crossConfig (TargetPlatform AArch64 TargetOsLinuxGnu) (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing Stage2)
    
    1339 1460
     
    
    1340
    -    -- x86_64 -> riscv
    
    1341
    -  , addValidateRule RiscV (validateBuilds Amd64 (Linux Debian13Riscv) (crossConfig "riscv64-linux-gnu" (Emulator "qemu-riscv64 -L /usr/riscv64-linux-gnu") Nothing))
    
    1461
    +    -- Stage2: x86_64 (build/host) -> riscv64 (target)
    
    1462
    +    -- Stage3: x86_64 (build) -> riscv64 (host/target)
    
    1463
    +  , addValidateRule RiscV (validateBuilds Amd64 (Linux Debian13) (crossConfig (TargetPlatform RiscV64 TargetOsLinuxGnu) (Emulator "qemu-riscv64 -L /usr/riscv64-linux-gnu") Nothing Stage2And3))
    
    1342 1464
     
    
    1343 1465
         -- x86_64 -> loongarch64
    
    1344
    -  , addValidateRule LoongArch64 (validateBuilds Amd64 (Linux Ubuntu2404LoongArch64) (crossConfig "loongarch64-linux-gnu" (Emulator "qemu-loongarch64 -L /usr/loongarch64-linux-gnu") Nothing))
    
    1466
    +  , addValidateRule LoongArch64 (validateBuilds Amd64 (Linux Ubuntu2404) (crossConfig (TargetPlatform LoongArch TargetOsLinuxGnu) (Emulator "qemu-loongarch64 -L /usr/loongarch64-linux-gnu") Nothing Stage2))
    
    1345 1467
     
    
    1346 1468
         -- Javascript
    
    1347
    -  , addValidateRule JSBackend (validateBuilds Amd64 (Linux Debian11Js) javascriptConfig)
    
    1469
    +  , addValidateRule JSBackend (validateBuilds Amd64 (Linux Debian11) javascriptConfig)
    
    1348 1470
     
    
    1349 1471
         -- Wasm
    
    1350 1472
       , make_wasm_jobs wasm_build_config
    
    ... ... @@ -1356,13 +1478,13 @@ cross_jobs = [
    1356 1478
         -- Linux Aarch64 (Wine + FEX + MSYS64) => Windows Aarch64
    
    1357 1479
       , makeWinArmJobs
    
    1358 1480
           $ addValidateRule WinArm64
    
    1359
    -        (validateBuilds AArch64 (Linux Debian12Wine) winAarch64Config)
    
    1481
    +        (validateBuilds AArch64 (Linux Debian12) winAarch64Config)
    
    1360 1482
       , makeWinArmJobs
    
    1361 1483
           $ addValidateRule WinArm64LLVM
    
    1362
    -        (validateBuilds AArch64 (Linux Debian12Wine) (winAarch64Config {llvmBootstrap = True}))
    
    1484
    +        (validateBuilds AArch64 (Linux Debian12) (winAarch64Config {llvmBootstrap = True}))
    
    1363 1485
       ]
    
    1364 1486
       where
    
    1365
    -    javascriptConfig = (crossConfig "javascript-unknown-ghcjs" (NoEmulatorNeeded TimeoutIncrease) (Just "emconfigure"))
    
    1487
    +    javascriptConfig = (crossConfig (TargetPlatform JavaScript TargetOsGhcjs) (NoEmulatorNeeded TimeoutIncrease) (Just "emconfigure") Stage2)
    
    1366 1488
                              { bignumBackend = Native }
    
    1367 1489
     
    
    1368 1490
         makeWinArmJobs = modifyJobs
    
    ... ... @@ -1401,7 +1523,7 @@ cross_jobs = [
    1401 1523
                 llvm_prefix = "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-"
    
    1402 1524
                 cflags = "-fuse-ld=" ++ llvm_prefix ++ "ld --rtlib=compiler-rt"
    
    1403 1525
     
    
    1404
    -    winAarch64Config = (crossConfig "aarch64-unknown-mingw32" (Emulator "/opt/wine-arm64ec-msys2-deb12/bin/wine") Nothing)
    
    1526
    +    winAarch64Config = (crossConfig (TargetPlatform AArch64 TargetOsMingw32) (Emulator "/opt/wine-arm64ec-msys2-deb12/bin/wine") Nothing Stage2)
    
    1405 1527
                              { bignumBackend = Native }
    
    1406 1528
     
    
    1407 1529
         make_wasm_jobs cfg =
    
    ... ... @@ -1411,10 +1533,10 @@ cross_jobs = [
    1411 1533
                 . setVariable "HADRIAN_ARGS" "--docs=no-sphinx-pdfs --docs=no-sphinx-man"
    
    1412 1534
                 . delVariable "INSTALL_CONFIGURE_ARGS"
    
    1413 1535
             )
    
    1414
    -        $ addValidateRule WasmBackend $ validateBuilds Amd64 (Linux AlpineWasm) cfg
    
    1536
    +        $ addValidateRule WasmBackend $ validateBuilds Amd64 (Linux Alpine323) cfg
    
    1415 1537
     
    
    1416 1538
         wasm_build_config =
    
    1417
    -      (crossConfig "wasm32-wasi" (NoEmulatorNeeded NoTimeoutIncrease) Nothing)
    
    1539
    +      (crossConfig (TargetPlatform Wasm32 TargetOsWasi) (NoEmulatorNeeded NoTimeoutIncrease) Nothing Stage2)
    
    1418 1540
             { hostFullyStatic = True
    
    1419 1541
             , buildFlavour    = Release -- TODO: This needs to be validate but wasm backend doesn't pass yet
    
    1420 1542
             , textWithSIMDUTF = True
    
    ... ... @@ -1439,8 +1561,8 @@ job_groups =
    1439 1561
     -- Platform mapping for GHCup metadata
    
    1440 1562
     ---------------------------------------------------------------------
    
    1441 1563
     
    
    1442
    -mkPlatform :: Arch -> Opsys -> String
    
    1443
    -mkPlatform arch opsys = archName arch <> "-" <> opsysName opsys
    
    1564
    +mkPlatform :: (Arch, Opsys, ImageFlavor) -> String
    
    1565
    +mkPlatform (arch, opsys, flavor) = archName arch <> "-" <> opsysNameWithFlavor opsys flavor
    
    1444 1566
     
    
    1445 1567
     -- | This map tells us for a specific arch/opsys combo what the job name for
    
    1446 1568
     -- nightly/release pipelines is. This is used by the ghcup metadata generation so that
    
    ... ... @@ -1488,7 +1610,7 @@ platform_mapping = Map.map go combined_result
    1488 1610
           -- for now we only support buildJob platform equals testjob platform
    
    1489 1611
           -- if this restriction were to be lifted, we just had to indicate that the
    
    1490 1612
           -- specific testjob runs on a different platform
    
    1491
    -      [ (uncurry mkPlatform (jobPlatform (jobInfo (buildJob j))), j)
    
    1613
    +      [ (mkPlatform (jobPlatform (jobInfo (buildJob j))), j)
    
    1492 1614
           | (sel -> Just j) <- job_groups
    
    1493 1615
           ]
    
    1494 1616
     
    

  • .gitlab/jobs.yaml
    ... ... @@ -547,7 +547,7 @@
    547 547
           ".gitlab/ci.sh setup",
    
    548 548
           ".gitlab/ci.sh configure",
    
    549 549
           ".gitlab/ci.sh build_hadrian",
    
    550
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    550
    +      ".gitlab/ci.sh smoke_test"
    
    551 551
         ],
    
    552 552
         "stage": "full-build",
    
    553 553
         "tags": [
    
    ... ... @@ -563,9 +563,9 @@
    563 563
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    564 564
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    565 565
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    566
    -      "CROSS_STAGE": "2",
    
    567 566
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    568 567
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    568
    +      "FINAL_CROSS_STAGE": "2",
    
    569 569
           "HADRIAN_ARGS": "--docs=none",
    
    570 570
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    571 571
           "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    ... ... @@ -631,7 +631,7 @@
    631 631
           ".gitlab/ci.sh setup",
    
    632 632
           ".gitlab/ci.sh configure",
    
    633 633
           ".gitlab/ci.sh build_hadrian",
    
    634
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    634
    +      ".gitlab/ci.sh smoke_test"
    
    635 635
         ],
    
    636 636
         "stage": "full-build",
    
    637 637
         "tags": [
    
    ... ... @@ -647,90 +647,9 @@
    647 647
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    648 648
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    649 649
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    650
    -      "CROSS_STAGE": "2",
    
    651
    -      "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    652
    -      "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    653
    -      "HADRIAN_ARGS": "--docs=none",
    
    654
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    655
    -      "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    656
    -      "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    657
    -      "MergeObjsCmd": "",
    
    658
    -      "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm",
    
    659
    -      "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    660
    -      "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    661
    -      "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    662
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    663
    -      "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    664
    -      "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    665
    -      "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    666
    -      "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm",
    
    667
    -      "TEST_WAYS": "",
    
    668
    -      "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    669
    -      "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres"
    
    670
    -    }
    
    671
    -  },
    
    672
    -  "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm-test": {
    
    673
    -    "after_script": [
    
    674
    -      ".gitlab/ci.sh save_cache",
    
    675
    -      ".gitlab/ci.sh save_test_output",
    
    676
    -      ".gitlab/ci.sh clean",
    
    677
    -      "cat ci_timings.txt"
    
    678
    -    ],
    
    679
    -    "allow_failure": false,
    
    680
    -    "artifacts": {
    
    681
    -      "expire_in": "2 weeks",
    
    682
    -      "paths": [
    
    683
    -        "junit.xml",
    
    684
    -        "unexpected-test-output.tar.gz"
    
    685
    -      ],
    
    686
    -      "reports": {
    
    687
    -        "junit": "junit.xml"
    
    688
    -      },
    
    689
    -      "when": "always"
    
    690
    -    },
    
    691
    -    "cache": {
    
    692
    -      "key": "aarch64-linux-deb12-wine-$CACHE_REV",
    
    693
    -      "paths": [
    
    694
    -        "cabal-cache",
    
    695
    -        "toolchain"
    
    696
    -      ]
    
    697
    -    },
    
    698
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV",
    
    699
    -    "needs": [
    
    700
    -      {
    
    701
    -        "artifacts": true,
    
    702
    -        "job": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm"
    
    703
    -      }
    
    704
    -    ],
    
    705
    -    "rules": [
    
    706
    -      {
    
    707
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate\\+llvm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    708
    -        "when": "on_success"
    
    709
    -      }
    
    710
    -    ],
    
    711
    -    "script": [
    
    712
    -      "sudo chown ghc:ghc -R .",
    
    713
    -      ".gitlab/ci.sh setup",
    
    714
    -      ".gitlab/ci.sh configure",
    
    715
    -      ".gitlab/ci.sh test_hadrian"
    
    716
    -    ],
    
    717
    -    "stage": "testing",
    
    718
    -    "tags": [
    
    719
    -      "aarch64-linux"
    
    720
    -    ],
    
    721
    -    "variables": {
    
    722
    -      "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar",
    
    723
    -      "BIGNUM_BACKEND": "native",
    
    724
    -      "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm",
    
    725
    -      "BUILD_FLAVOUR": "validate+llvm",
    
    726
    -      "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    727
    -      "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    728
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    729
    -      "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    730
    -      "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    731
    -      "CROSS_STAGE": "2",
    
    732 650
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    733 651
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    652
    +      "FINAL_CROSS_STAGE": "2",
    
    734 653
           "HADRIAN_ARGS": "--docs=none",
    
    735 654
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    736 655
           "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    ... ... @@ -750,87 +669,6 @@
    750 669
           "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres"
    
    751 670
         }
    
    752 671
       },
    
    753
    -  "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate-test": {
    
    754
    -    "after_script": [
    
    755
    -      ".gitlab/ci.sh save_cache",
    
    756
    -      ".gitlab/ci.sh save_test_output",
    
    757
    -      ".gitlab/ci.sh clean",
    
    758
    -      "cat ci_timings.txt"
    
    759
    -    ],
    
    760
    -    "allow_failure": false,
    
    761
    -    "artifacts": {
    
    762
    -      "expire_in": "2 weeks",
    
    763
    -      "paths": [
    
    764
    -        "junit.xml",
    
    765
    -        "unexpected-test-output.tar.gz"
    
    766
    -      ],
    
    767
    -      "reports": {
    
    768
    -        "junit": "junit.xml"
    
    769
    -      },
    
    770
    -      "when": "always"
    
    771
    -    },
    
    772
    -    "cache": {
    
    773
    -      "key": "aarch64-linux-deb12-wine-$CACHE_REV",
    
    774
    -      "paths": [
    
    775
    -        "cabal-cache",
    
    776
    -        "toolchain"
    
    777
    -      ]
    
    778
    -    },
    
    779
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV",
    
    780
    -    "needs": [
    
    781
    -      {
    
    782
    -        "artifacts": true,
    
    783
    -        "job": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate"
    
    784
    -      }
    
    785
    -    ],
    
    786
    -    "rules": [
    
    787
    -      {
    
    788
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    789
    -        "when": "on_success"
    
    790
    -      }
    
    791
    -    ],
    
    792
    -    "script": [
    
    793
    -      "sudo chown ghc:ghc -R .",
    
    794
    -      ".gitlab/ci.sh setup",
    
    795
    -      ".gitlab/ci.sh configure",
    
    796
    -      ".gitlab/ci.sh test_hadrian"
    
    797
    -    ],
    
    798
    -    "stage": "testing",
    
    799
    -    "tags": [
    
    800
    -      "aarch64-linux"
    
    801
    -    ],
    
    802
    -    "variables": {
    
    803
    -      "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar",
    
    804
    -      "BIGNUM_BACKEND": "native",
    
    805
    -      "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate",
    
    806
    -      "BUILD_FLAVOUR": "validate",
    
    807
    -      "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    808
    -      "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    809
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    810
    -      "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    811
    -      "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    812
    -      "CROSS_STAGE": "2",
    
    813
    -      "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    814
    -      "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    815
    -      "HADRIAN_ARGS": "--docs=none",
    
    816
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    817
    -      "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    818
    -      "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    819
    -      "MergeObjsCmd": "",
    
    820
    -      "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm",
    
    821
    -      "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    822
    -      "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    823
    -      "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    824
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    825
    -      "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    826
    -      "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    827
    -      "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    828
    -      "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate",
    
    829
    -      "TEST_WAYS": "",
    
    830
    -      "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    831
    -      "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres"
    
    832
    -    }
    
    833
    -  },
    
    834 672
       "aarch64-linux-deb13-validate": {
    
    835 673
         "after_script": [
    
    836 674
           ".gitlab/ci.sh save_cache",
    
    ... ... @@ -2126,7 +1964,7 @@
    2126 1964
           ".gitlab/ci.sh setup",
    
    2127 1965
           ".gitlab/ci.sh configure",
    
    2128 1966
           ".gitlab/ci.sh build_hadrian",
    
    2129
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    1967
    +      ".gitlab/ci.sh smoke_test"
    
    2130 1968
         ],
    
    2131 1969
         "stage": "full-build",
    
    2132 1970
         "tags": [
    
    ... ... @@ -2142,9 +1980,9 @@
    2142 1980
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2143 1981
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2144 1982
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    2145
    -      "CROSS_STAGE": "2",
    
    2146 1983
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    2147 1984
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    1985
    +      "FINAL_CROSS_STAGE": "2",
    
    2148 1986
           "HADRIAN_ARGS": "--docs=none",
    
    2149 1987
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2150 1988
           "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    ... ... @@ -2211,7 +2049,7 @@
    2211 2049
           ".gitlab/ci.sh setup",
    
    2212 2050
           ".gitlab/ci.sh configure",
    
    2213 2051
           ".gitlab/ci.sh build_hadrian",
    
    2214
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    2052
    +      ".gitlab/ci.sh smoke_test"
    
    2215 2053
         ],
    
    2216 2054
         "stage": "full-build",
    
    2217 2055
         "tags": [
    
    ... ... @@ -2227,9 +2065,9 @@
    2227 2065
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2228 2066
           "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2229 2067
           "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    2230
    -      "CROSS_STAGE": "2",
    
    2231 2068
           "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    2232 2069
           "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    2070
    +      "FINAL_CROSS_STAGE": "2",
    
    2233 2071
           "HADRIAN_ARGS": "--docs=none",
    
    2234 2072
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2235 2073
           "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    ... ... @@ -2250,170 +2088,6 @@
    2250 2088
           "XZ_OPT": "-9"
    
    2251 2089
         }
    
    2252 2090
       },
    
    2253
    -  "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm-test": {
    
    2254
    -    "after_script": [
    
    2255
    -      ".gitlab/ci.sh save_cache",
    
    2256
    -      ".gitlab/ci.sh save_test_output",
    
    2257
    -      ".gitlab/ci.sh clean",
    
    2258
    -      "cat ci_timings.txt"
    
    2259
    -    ],
    
    2260
    -    "allow_failure": false,
    
    2261
    -    "artifacts": {
    
    2262
    -      "expire_in": "8 weeks",
    
    2263
    -      "paths": [
    
    2264
    -        "junit.xml",
    
    2265
    -        "unexpected-test-output.tar.gz"
    
    2266
    -      ],
    
    2267
    -      "reports": {
    
    2268
    -        "junit": "junit.xml"
    
    2269
    -      },
    
    2270
    -      "when": "always"
    
    2271
    -    },
    
    2272
    -    "cache": {
    
    2273
    -      "key": "aarch64-linux-deb12-wine-$CACHE_REV",
    
    2274
    -      "paths": [
    
    2275
    -        "cabal-cache",
    
    2276
    -        "toolchain"
    
    2277
    -      ]
    
    2278
    -    },
    
    2279
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV",
    
    2280
    -    "needs": [
    
    2281
    -      {
    
    2282
    -        "artifacts": true,
    
    2283
    -        "job": "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm"
    
    2284
    -      }
    
    2285
    -    ],
    
    2286
    -    "rules": [
    
    2287
    -      {
    
    2288
    -        "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)",
    
    2289
    -        "when": "on_success"
    
    2290
    -      }
    
    2291
    -    ],
    
    2292
    -    "script": [
    
    2293
    -      "sudo chown ghc:ghc -R .",
    
    2294
    -      ".gitlab/ci.sh setup",
    
    2295
    -      ".gitlab/ci.sh configure",
    
    2296
    -      ".gitlab/ci.sh test_hadrian"
    
    2297
    -    ],
    
    2298
    -    "stage": "testing",
    
    2299
    -    "tags": [
    
    2300
    -      "aarch64-linux"
    
    2301
    -    ],
    
    2302
    -    "variables": {
    
    2303
    -      "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar",
    
    2304
    -      "BIGNUM_BACKEND": "native",
    
    2305
    -      "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm",
    
    2306
    -      "BUILD_FLAVOUR": "validate+llvm",
    
    2307
    -      "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    2308
    -      "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2309
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2310
    -      "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2311
    -      "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    2312
    -      "CROSS_STAGE": "2",
    
    2313
    -      "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    2314
    -      "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    2315
    -      "HADRIAN_ARGS": "--docs=none",
    
    2316
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2317
    -      "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    2318
    -      "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    2319
    -      "MergeObjsCmd": "",
    
    2320
    -      "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm",
    
    2321
    -      "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    2322
    -      "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    2323
    -      "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    2324
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2325
    -      "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    2326
    -      "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    2327
    -      "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    2328
    -      "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm",
    
    2329
    -      "TEST_WAYS": "",
    
    2330
    -      "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2331
    -      "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres",
    
    2332
    -      "XZ_OPT": "-9"
    
    2333
    -    }
    
    2334
    -  },
    
    2335
    -  "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate-test": {
    
    2336
    -    "after_script": [
    
    2337
    -      ".gitlab/ci.sh save_cache",
    
    2338
    -      ".gitlab/ci.sh save_test_output",
    
    2339
    -      ".gitlab/ci.sh clean",
    
    2340
    -      "cat ci_timings.txt"
    
    2341
    -    ],
    
    2342
    -    "allow_failure": false,
    
    2343
    -    "artifacts": {
    
    2344
    -      "expire_in": "8 weeks",
    
    2345
    -      "paths": [
    
    2346
    -        "junit.xml",
    
    2347
    -        "unexpected-test-output.tar.gz"
    
    2348
    -      ],
    
    2349
    -      "reports": {
    
    2350
    -        "junit": "junit.xml"
    
    2351
    -      },
    
    2352
    -      "when": "always"
    
    2353
    -    },
    
    2354
    -    "cache": {
    
    2355
    -      "key": "aarch64-linux-deb12-wine-$CACHE_REV",
    
    2356
    -      "paths": [
    
    2357
    -        "cabal-cache",
    
    2358
    -        "toolchain"
    
    2359
    -      ]
    
    2360
    -    },
    
    2361
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV",
    
    2362
    -    "needs": [
    
    2363
    -      {
    
    2364
    -        "artifacts": true,
    
    2365
    -        "job": "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate"
    
    2366
    -      }
    
    2367
    -    ],
    
    2368
    -    "rules": [
    
    2369
    -      {
    
    2370
    -        "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)",
    
    2371
    -        "when": "on_success"
    
    2372
    -      }
    
    2373
    -    ],
    
    2374
    -    "script": [
    
    2375
    -      "sudo chown ghc:ghc -R .",
    
    2376
    -      ".gitlab/ci.sh setup",
    
    2377
    -      ".gitlab/ci.sh configure",
    
    2378
    -      ".gitlab/ci.sh test_hadrian"
    
    2379
    -    ],
    
    2380
    -    "stage": "testing",
    
    2381
    -    "tags": [
    
    2382
    -      "aarch64-linux"
    
    2383
    -    ],
    
    2384
    -    "variables": {
    
    2385
    -      "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar",
    
    2386
    -      "BIGNUM_BACKEND": "native",
    
    2387
    -      "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate",
    
    2388
    -      "BUILD_FLAVOUR": "validate",
    
    2389
    -      "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    2390
    -      "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2391
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    2392
    -      "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2393
    -      "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine",
    
    2394
    -      "CROSS_STAGE": "2",
    
    2395
    -      "CROSS_TARGET": "aarch64-unknown-mingw32",
    
    2396
    -      "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++",
    
    2397
    -      "HADRIAN_ARGS": "--docs=none",
    
    2398
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    2399
    -      "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld",
    
    2400
    -      "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang",
    
    2401
    -      "MergeObjsCmd": "",
    
    2402
    -      "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm",
    
    2403
    -      "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy",
    
    2404
    -      "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump",
    
    2405
    -      "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib",
    
    2406
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    2407
    -      "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size",
    
    2408
    -      "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings",
    
    2409
    -      "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip",
    
    2410
    -      "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate",
    
    2411
    -      "TEST_WAYS": "",
    
    2412
    -      "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt",
    
    2413
    -      "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres",
    
    2414
    -      "XZ_OPT": "-9"
    
    2415
    -    }
    
    2416
    -  },
    
    2417 2091
       "nightly-aarch64-linux-deb13-validate": {
    
    2418 2092
         "after_script": [
    
    2419 2093
           ".gitlab/ci.sh save_cache",
    
    ... ... @@ -3873,8 +3547,8 @@
    3873 3547
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    3874 3548
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    3875 3549
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    3876
    -      "CROSS_STAGE": "2",
    
    3877 3550
           "CROSS_TARGET": "wasm32-wasi",
    
    3551
    +      "FINAL_CROSS_STAGE": "2",
    
    3878 3552
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    3879 3553
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    3880 3554
           "RUNTEST_ARGS": "",
    
    ... ... @@ -3937,8 +3611,8 @@
    3937 3611
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    3938 3612
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    3939 3613
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    3940
    -      "CROSS_STAGE": "2",
    
    3941 3614
           "CROSS_TARGET": "wasm32-wasi",
    
    3615
    +      "FINAL_CROSS_STAGE": "2",
    
    3942 3616
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    3943 3617
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    3944 3618
           "RUNTEST_ARGS": "",
    
    ... ... @@ -4004,8 +3678,8 @@
    4004 3678
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    4005 3679
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    4006 3680
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    4007
    -      "CROSS_STAGE": "2",
    
    4008 3681
           "CROSS_TARGET": "wasm32-wasi",
    
    3682
    +      "FINAL_CROSS_STAGE": "2",
    
    4009 3683
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    4010 3684
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    4011 3685
           "RUNTEST_ARGS": "",
    
    ... ... @@ -4068,8 +3742,8 @@
    4068 3742
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    4069 3743
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    4070 3744
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    4071
    -      "CROSS_STAGE": "2",
    
    4072 3745
           "CROSS_TARGET": "wasm32-wasi",
    
    3746
    +      "FINAL_CROSS_STAGE": "2",
    
    4073 3747
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    4074 3748
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    4075 3749
           "RUNTEST_ARGS": "",
    
    ... ... @@ -4135,8 +3809,8 @@
    4135 3809
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    4136 3810
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    4137 3811
           "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    4138
    -      "CROSS_STAGE": "2",
    
    4139 3812
           "CROSS_TARGET": "wasm32-wasi",
    
    3813
    +      "FINAL_CROSS_STAGE": "2",
    
    4140 3814
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    4141 3815
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    4142 3816
           "RUNTEST_ARGS": "",
    
    ... ... @@ -4199,8 +3873,8 @@
    4199 3873
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    4200 3874
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    4201 3875
           "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    4202
    -      "CROSS_STAGE": "2",
    
    4203 3876
           "CROSS_TARGET": "wasm32-wasi",
    
    3877
    +      "FINAL_CROSS_STAGE": "2",
    
    4204 3878
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    4205 3879
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    4206 3880
           "RUNTEST_ARGS": "",
    
    ... ... @@ -4267,8 +3941,8 @@
    4267 3941
           "BUILD_FLAVOUR": "validate",
    
    4268 3942
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    4269 3943
           "CONFIGURE_WRAPPER": "emconfigure",
    
    4270
    -      "CROSS_STAGE": "2",
    
    4271 3944
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    3945
    +      "FINAL_CROSS_STAGE": "2",
    
    4272 3946
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    4273 3947
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    4274 3948
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate",
    
    ... ... @@ -4331,8 +4005,8 @@
    4331 4005
           "BUILD_FLAVOUR": "validate",
    
    4332 4006
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    4333 4007
           "CONFIGURE_WRAPPER": "emconfigure",
    
    4334
    -      "CROSS_STAGE": "2",
    
    4335 4008
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    4009
    +      "FINAL_CROSS_STAGE": "2",
    
    4336 4010
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    4337 4011
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    4338 4012
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate",
    
    ... ... @@ -4761,7 +4435,7 @@
    4761 4435
           ".gitlab/ci.sh setup",
    
    4762 4436
           ".gitlab/ci.sh configure",
    
    4763 4437
           ".gitlab/ci.sh build_hadrian",
    
    4764
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    4438
    +      ".gitlab/ci.sh smoke_test"
    
    4765 4439
         ],
    
    4766 4440
         "stage": "full-build",
    
    4767 4441
         "tags": [
    
    ... ... @@ -4773,72 +4447,8 @@
    4773 4447
           "BUILD_FLAVOUR": "validate",
    
    4774 4448
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    4775 4449
           "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu",
    
    4776
    -      "CROSS_STAGE": "2",
    
    4777
    -      "CROSS_TARGET": "aarch64-linux-gnu",
    
    4778
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    4779
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    4780
    -      "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate",
    
    4781
    -      "TEST_WAYS": "",
    
    4782
    -      "XZ_OPT": "-9"
    
    4783
    -    }
    
    4784
    -  },
    
    4785
    -  "nightly-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate-test": {
    
    4786
    -    "after_script": [
    
    4787
    -      ".gitlab/ci.sh save_cache",
    
    4788
    -      ".gitlab/ci.sh save_test_output",
    
    4789
    -      ".gitlab/ci.sh clean",
    
    4790
    -      "cat ci_timings.txt"
    
    4791
    -    ],
    
    4792
    -    "allow_failure": false,
    
    4793
    -    "artifacts": {
    
    4794
    -      "expire_in": "8 weeks",
    
    4795
    -      "paths": [
    
    4796
    -        "junit.xml",
    
    4797
    -        "unexpected-test-output.tar.gz"
    
    4798
    -      ],
    
    4799
    -      "reports": {
    
    4800
    -        "junit": "junit.xml"
    
    4801
    -      },
    
    4802
    -      "when": "always"
    
    4803
    -    },
    
    4804
    -    "cache": {
    
    4805
    -      "key": "x86_64-linux-deb13-$CACHE_REV",
    
    4806
    -      "paths": [
    
    4807
    -        "cabal-cache",
    
    4808
    -        "toolchain"
    
    4809
    -      ]
    
    4810
    -    },
    
    4811
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV",
    
    4812
    -    "needs": [
    
    4813
    -      {
    
    4814
    -        "artifacts": true,
    
    4815
    -        "job": "nightly-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate"
    
    4816
    -      }
    
    4817
    -    ],
    
    4818
    -    "rules": [
    
    4819
    -      {
    
    4820
    -        "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)",
    
    4821
    -        "when": "on_success"
    
    4822
    -      }
    
    4823
    -    ],
    
    4824
    -    "script": [
    
    4825
    -      "sudo chown ghc:ghc -R .",
    
    4826
    -      ".gitlab/ci.sh setup",
    
    4827
    -      ".gitlab/ci.sh configure",
    
    4828
    -      ".gitlab/ci.sh test_hadrian"
    
    4829
    -    ],
    
    4830
    -    "stage": "testing",
    
    4831
    -    "tags": [
    
    4832
    -      "x86_64-linux"
    
    4833
    -    ],
    
    4834
    -    "variables": {
    
    4835
    -      "BIGNUM_BACKEND": "gmp",
    
    4836
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate",
    
    4837
    -      "BUILD_FLAVOUR": "validate",
    
    4838
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    4839
    -      "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu",
    
    4840
    -      "CROSS_STAGE": "2",
    
    4841 4450
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    4451
    +      "FINAL_CROSS_STAGE": "2",
    
    4842 4452
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    4843 4453
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    4844 4454
           "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate",
    
    ... ... @@ -5420,75 +5030,11 @@
    5420 5030
         "artifacts": {
    
    5421 5031
           "expire_in": "8 weeks",
    
    5422 5032
           "paths": [
    
    5423
    -        "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate.tar.xz",
    
    5424
    -        "junit.xml",
    
    5425
    -        "unexpected-test-output.tar.gz",
    
    5426
    -        "_build/stage1/haddock-timing-files"
    
    5427
    -      ],
    
    5428
    -      "reports": {
    
    5429
    -        "junit": "junit.xml"
    
    5430
    -      },
    
    5431
    -      "when": "always"
    
    5432
    -    },
    
    5433
    -    "cache": {
    
    5434
    -      "key": "x86_64-linux-deb13-riscv-$CACHE_REV",
    
    5435
    -      "paths": [
    
    5436
    -        "cabal-cache",
    
    5437
    -        "toolchain"
    
    5438
    -      ]
    
    5439
    -    },
    
    5440
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13-riscv:$DOCKER_REV",
    
    5441
    -    "needs": [
    
    5442
    -      {
    
    5443
    -        "artifacts": false,
    
    5444
    -        "job": "hadrian-ghc-in-ghci"
    
    5445
    -      }
    
    5446
    -    ],
    
    5447
    -    "rules": [
    
    5448
    -      {
    
    5449
    -        "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)",
    
    5450
    -        "when": "on_success"
    
    5451
    -      }
    
    5452
    -    ],
    
    5453
    -    "script": [
    
    5454
    -      "sudo chown ghc:ghc -R .",
    
    5455
    -      ".gitlab/ci.sh setup",
    
    5456
    -      ".gitlab/ci.sh configure",
    
    5457
    -      ".gitlab/ci.sh build_hadrian",
    
    5458
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    5459
    -    ],
    
    5460
    -    "stage": "full-build",
    
    5461
    -    "tags": [
    
    5462
    -      "x86_64-linux"
    
    5463
    -    ],
    
    5464
    -    "variables": {
    
    5465
    -      "BIGNUM_BACKEND": "gmp",
    
    5466
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    5467
    -      "BUILD_FLAVOUR": "validate",
    
    5468
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    5469
    -      "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu",
    
    5470
    -      "CROSS_STAGE": "2",
    
    5471
    -      "CROSS_TARGET": "riscv64-linux-gnu",
    
    5472
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    5473
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    5474
    -      "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    5475
    -      "TEST_WAYS": "",
    
    5476
    -      "XZ_OPT": "-9"
    
    5477
    -    }
    
    5478
    -  },
    
    5479
    -  "nightly-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate-test": {
    
    5480
    -    "after_script": [
    
    5481
    -      ".gitlab/ci.sh save_cache",
    
    5482
    -      ".gitlab/ci.sh save_test_output",
    
    5483
    -      ".gitlab/ci.sh clean",
    
    5484
    -      "cat ci_timings.txt"
    
    5485
    -    ],
    
    5486
    -    "allow_failure": false,
    
    5487
    -    "artifacts": {
    
    5488
    -      "expire_in": "8 weeks",
    
    5489
    -      "paths": [
    
    5033
    +        "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate.tar.xz",
    
    5490 5034
             "junit.xml",
    
    5491
    -        "unexpected-test-output.tar.gz"
    
    5035
    +        "unexpected-test-output.tar.gz",
    
    5036
    +        "_build/stage1/haddock-timing-files",
    
    5037
    +        "ghc-riscv64-linux-deb13-validate.tar.xz"
    
    5492 5038
           ],
    
    5493 5039
           "reports": {
    
    5494 5040
             "junit": "junit.xml"
    
    ... ... @@ -5505,8 +5051,8 @@
    5505 5051
         "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13-riscv:$DOCKER_REV",
    
    5506 5052
         "needs": [
    
    5507 5053
           {
    
    5508
    -        "artifacts": true,
    
    5509
    -        "job": "nightly-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate"
    
    5054
    +        "artifacts": false,
    
    5055
    +        "job": "hadrian-ghc-in-ghci"
    
    5510 5056
           }
    
    5511 5057
         ],
    
    5512 5058
         "rules": [
    
    ... ... @@ -5519,20 +5065,22 @@
    5519 5065
           "sudo chown ghc:ghc -R .",
    
    5520 5066
           ".gitlab/ci.sh setup",
    
    5521 5067
           ".gitlab/ci.sh configure",
    
    5522
    -      ".gitlab/ci.sh test_hadrian"
    
    5068
    +      ".gitlab/ci.sh build_hadrian",
    
    5069
    +      ".gitlab/ci.sh smoke_test"
    
    5523 5070
         ],
    
    5524
    -    "stage": "testing",
    
    5071
    +    "stage": "full-build",
    
    5525 5072
         "tags": [
    
    5526 5073
           "x86_64-linux"
    
    5527 5074
         ],
    
    5528 5075
         "variables": {
    
    5529 5076
           "BIGNUM_BACKEND": "gmp",
    
    5530 5077
           "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    5078
    +      "BIN_DIST_NAME_STAGE3": "ghc-riscv64-linux-deb13-validate",
    
    5531 5079
           "BUILD_FLAVOUR": "validate",
    
    5532 5080
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    5533 5081
           "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu",
    
    5534
    -      "CROSS_STAGE": "2",
    
    5535 5082
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    5083
    +      "FINAL_CROSS_STAGE": "3",
    
    5536 5084
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    5537 5085
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    5538 5086
           "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    ... ... @@ -7221,7 +6769,7 @@
    7221 6769
           ".gitlab/ci.sh setup",
    
    7222 6770
           ".gitlab/ci.sh configure",
    
    7223 6771
           ".gitlab/ci.sh build_hadrian",
    
    7224
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    6772
    +      ".gitlab/ci.sh smoke_test"
    
    7225 6773
         ],
    
    7226 6774
         "stage": "full-build",
    
    7227 6775
         "tags": [
    
    ... ... @@ -7233,72 +6781,8 @@
    7233 6781
           "BUILD_FLAVOUR": "validate",
    
    7234 6782
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    7235 6783
           "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu",
    
    7236
    -      "CROSS_STAGE": "2",
    
    7237
    -      "CROSS_TARGET": "loongarch64-linux-gnu",
    
    7238
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7239
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    7240
    -      "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    7241
    -      "TEST_WAYS": "",
    
    7242
    -      "XZ_OPT": "-9"
    
    7243
    -    }
    
    7244
    -  },
    
    7245
    -  "nightly-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate-test": {
    
    7246
    -    "after_script": [
    
    7247
    -      ".gitlab/ci.sh save_cache",
    
    7248
    -      ".gitlab/ci.sh save_test_output",
    
    7249
    -      ".gitlab/ci.sh clean",
    
    7250
    -      "cat ci_timings.txt"
    
    7251
    -    ],
    
    7252
    -    "allow_failure": false,
    
    7253
    -    "artifacts": {
    
    7254
    -      "expire_in": "8 weeks",
    
    7255
    -      "paths": [
    
    7256
    -        "junit.xml",
    
    7257
    -        "unexpected-test-output.tar.gz"
    
    7258
    -      ],
    
    7259
    -      "reports": {
    
    7260
    -        "junit": "junit.xml"
    
    7261
    -      },
    
    7262
    -      "when": "always"
    
    7263
    -    },
    
    7264
    -    "cache": {
    
    7265
    -      "key": "x86_64-linux-ubuntu24_04-loongarch-$CACHE_REV",
    
    7266
    -      "paths": [
    
    7267
    -        "cabal-cache",
    
    7268
    -        "toolchain"
    
    7269
    -      ]
    
    7270
    -    },
    
    7271
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu24_04-loongarch:$DOCKER_REV",
    
    7272
    -    "needs": [
    
    7273
    -      {
    
    7274
    -        "artifacts": true,
    
    7275
    -        "job": "nightly-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate"
    
    7276
    -      }
    
    7277
    -    ],
    
    7278
    -    "rules": [
    
    7279
    -      {
    
    7280
    -        "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)",
    
    7281
    -        "when": "on_success"
    
    7282
    -      }
    
    7283
    -    ],
    
    7284
    -    "script": [
    
    7285
    -      "sudo chown ghc:ghc -R .",
    
    7286
    -      ".gitlab/ci.sh setup",
    
    7287
    -      ".gitlab/ci.sh configure",
    
    7288
    -      ".gitlab/ci.sh test_hadrian"
    
    7289
    -    ],
    
    7290
    -    "stage": "testing",
    
    7291
    -    "tags": [
    
    7292
    -      "x86_64-linux"
    
    7293
    -    ],
    
    7294
    -    "variables": {
    
    7295
    -      "BIGNUM_BACKEND": "gmp",
    
    7296
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    7297
    -      "BUILD_FLAVOUR": "validate",
    
    7298
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    7299
    -      "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu",
    
    7300
    -      "CROSS_STAGE": "2",
    
    7301 6784
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    6785
    +      "FINAL_CROSS_STAGE": "2",
    
    7302 6786
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    7303 6787
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    7304 6788
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    ... ... @@ -11718,8 +11202,8 @@
    11718 11202
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    11719 11203
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    11720 11204
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    11721
    -      "CROSS_STAGE": "2",
    
    11722 11205
           "CROSS_TARGET": "wasm32-wasi",
    
    11206
    +      "FINAL_CROSS_STAGE": "2",
    
    11723 11207
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    11724 11208
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    11725 11209
           "RUNTEST_ARGS": "",
    
    ... ... @@ -11781,8 +11265,8 @@
    11781 11265
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    11782 11266
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    11783 11267
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    11784
    -      "CROSS_STAGE": "2",
    
    11785 11268
           "CROSS_TARGET": "wasm32-wasi",
    
    11269
    +      "FINAL_CROSS_STAGE": "2",
    
    11786 11270
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    11787 11271
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    11788 11272
           "RUNTEST_ARGS": "",
    
    ... ... @@ -11848,8 +11332,8 @@
    11848 11332
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    11849 11333
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    11850 11334
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    11851
    -      "CROSS_STAGE": "2",
    
    11852 11335
           "CROSS_TARGET": "wasm32-wasi",
    
    11336
    +      "FINAL_CROSS_STAGE": "2",
    
    11853 11337
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    11854 11338
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    11855 11339
           "RUNTEST_ARGS": "",
    
    ... ... @@ -11912,8 +11396,8 @@
    11912 11396
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    11913 11397
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    11914 11398
           "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    11915
    -      "CROSS_STAGE": "2",
    
    11916 11399
           "CROSS_TARGET": "wasm32-wasi",
    
    11400
    +      "FINAL_CROSS_STAGE": "2",
    
    11917 11401
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    11918 11402
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    11919 11403
           "RUNTEST_ARGS": "",
    
    ... ... @@ -11979,8 +11463,8 @@
    11979 11463
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    11980 11464
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    11981 11465
           "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    11982
    -      "CROSS_STAGE": "2",
    
    11983 11466
           "CROSS_TARGET": "wasm32-wasi",
    
    11467
    +      "FINAL_CROSS_STAGE": "2",
    
    11984 11468
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    11985 11469
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    11986 11470
           "RUNTEST_ARGS": "",
    
    ... ... @@ -12043,8 +11527,8 @@
    12043 11527
           "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf",
    
    12044 11528
           "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf",
    
    12045 11529
           "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check",
    
    12046
    -      "CROSS_STAGE": "2",
    
    12047 11530
           "CROSS_TARGET": "wasm32-wasi",
    
    11531
    +      "FINAL_CROSS_STAGE": "2",
    
    12048 11532
           "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}",
    
    12049 11533
           "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man",
    
    12050 11534
           "RUNTEST_ARGS": "",
    
    ... ... @@ -12110,8 +11594,8 @@
    12110 11594
           "BUILD_FLAVOUR": "validate",
    
    12111 11595
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    12112 11596
           "CONFIGURE_WRAPPER": "emconfigure",
    
    12113
    -      "CROSS_STAGE": "2",
    
    12114 11597
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    11598
    +      "FINAL_CROSS_STAGE": "2",
    
    12115 11599
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    12116 11600
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    12117 11601
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate",
    
    ... ... @@ -12173,8 +11657,8 @@
    12173 11657
           "BUILD_FLAVOUR": "validate",
    
    12174 11658
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    12175 11659
           "CONFIGURE_WRAPPER": "emconfigure",
    
    12176
    -      "CROSS_STAGE": "2",
    
    12177 11660
           "CROSS_TARGET": "javascript-unknown-ghcjs",
    
    11661
    +      "FINAL_CROSS_STAGE": "2",
    
    12178 11662
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    12179 11663
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    12180 11664
           "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate",
    
    ... ... @@ -12596,7 +12080,7 @@
    12596 12080
           ".gitlab/ci.sh setup",
    
    12597 12081
           ".gitlab/ci.sh configure",
    
    12598 12082
           ".gitlab/ci.sh build_hadrian",
    
    12599
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    12083
    +      ".gitlab/ci.sh smoke_test"
    
    12600 12084
         ],
    
    12601 12085
         "stage": "full-build",
    
    12602 12086
         "tags": [
    
    ... ... @@ -12608,71 +12092,8 @@
    12608 12092
           "BUILD_FLAVOUR": "validate",
    
    12609 12093
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    12610 12094
           "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu",
    
    12611
    -      "CROSS_STAGE": "2",
    
    12612
    -      "CROSS_TARGET": "aarch64-linux-gnu",
    
    12613
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    12614
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    12615
    -      "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate",
    
    12616
    -      "TEST_WAYS": ""
    
    12617
    -    }
    
    12618
    -  },
    
    12619
    -  "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate-test": {
    
    12620
    -    "after_script": [
    
    12621
    -      ".gitlab/ci.sh save_cache",
    
    12622
    -      ".gitlab/ci.sh save_test_output",
    
    12623
    -      ".gitlab/ci.sh clean",
    
    12624
    -      "cat ci_timings.txt"
    
    12625
    -    ],
    
    12626
    -    "allow_failure": false,
    
    12627
    -    "artifacts": {
    
    12628
    -      "expire_in": "2 weeks",
    
    12629
    -      "paths": [
    
    12630
    -        "junit.xml",
    
    12631
    -        "unexpected-test-output.tar.gz"
    
    12632
    -      ],
    
    12633
    -      "reports": {
    
    12634
    -        "junit": "junit.xml"
    
    12635
    -      },
    
    12636
    -      "when": "always"
    
    12637
    -    },
    
    12638
    -    "cache": {
    
    12639
    -      "key": "x86_64-linux-deb13-$CACHE_REV",
    
    12640
    -      "paths": [
    
    12641
    -        "cabal-cache",
    
    12642
    -        "toolchain"
    
    12643
    -      ]
    
    12644
    -    },
    
    12645
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV",
    
    12646
    -    "needs": [
    
    12647
    -      {
    
    12648
    -        "artifacts": true,
    
    12649
    -        "job": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate"
    
    12650
    -      }
    
    12651
    -    ],
    
    12652
    -    "rules": [
    
    12653
    -      {
    
    12654
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-cross_aarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    12655
    -        "when": "on_success"
    
    12656
    -      }
    
    12657
    -    ],
    
    12658
    -    "script": [
    
    12659
    -      "sudo chown ghc:ghc -R .",
    
    12660
    -      ".gitlab/ci.sh setup",
    
    12661
    -      ".gitlab/ci.sh configure",
    
    12662
    -      ".gitlab/ci.sh test_hadrian"
    
    12663
    -    ],
    
    12664
    -    "stage": "testing",
    
    12665
    -    "tags": [
    
    12666
    -      "x86_64-linux"
    
    12667
    -    ],
    
    12668
    -    "variables": {
    
    12669
    -      "BIGNUM_BACKEND": "gmp",
    
    12670
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate",
    
    12671
    -      "BUILD_FLAVOUR": "validate",
    
    12672
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    12673
    -      "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu",
    
    12674
    -      "CROSS_STAGE": "2",
    
    12675 12095
           "CROSS_TARGET": "aarch64-linux-gnu",
    
    12096
    +      "FINAL_CROSS_STAGE": "2",
    
    12676 12097
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    12677 12098
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    12678 12099
           "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate",
    
    ... ... @@ -13249,7 +12670,8 @@
    13249 12670
             "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate.tar.xz",
    
    13250 12671
             "junit.xml",
    
    13251 12672
             "unexpected-test-output.tar.gz",
    
    13252
    -        "_build/stage1/haddock-timing-files"
    
    12673
    +        "_build/stage1/haddock-timing-files",
    
    12674
    +        "ghc-riscv64-linux-deb13-validate.tar.xz"
    
    13253 12675
           ],
    
    13254 12676
           "reports": {
    
    13255 12677
             "junit": "junit.xml"
    
    ... ... @@ -13281,7 +12703,7 @@
    13281 12703
           ".gitlab/ci.sh setup",
    
    13282 12704
           ".gitlab/ci.sh configure",
    
    13283 12705
           ".gitlab/ci.sh build_hadrian",
    
    13284
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    12706
    +      ".gitlab/ci.sh smoke_test"
    
    13285 12707
         ],
    
    13286 12708
         "stage": "full-build",
    
    13287 12709
         "tags": [
    
    ... ... @@ -13290,74 +12712,12 @@
    13290 12712
         "variables": {
    
    13291 12713
           "BIGNUM_BACKEND": "gmp",
    
    13292 12714
           "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    12715
    +      "BIN_DIST_NAME_STAGE3": "ghc-riscv64-linux-deb13-validate",
    
    13293 12716
           "BUILD_FLAVOUR": "validate",
    
    13294 12717
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    13295 12718
           "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu",
    
    13296
    -      "CROSS_STAGE": "2",
    
    13297
    -      "CROSS_TARGET": "riscv64-linux-gnu",
    
    13298
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    13299
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    13300
    -      "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    13301
    -      "TEST_WAYS": ""
    
    13302
    -    }
    
    13303
    -  },
    
    13304
    -  "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate-test": {
    
    13305
    -    "after_script": [
    
    13306
    -      ".gitlab/ci.sh save_cache",
    
    13307
    -      ".gitlab/ci.sh save_test_output",
    
    13308
    -      ".gitlab/ci.sh clean",
    
    13309
    -      "cat ci_timings.txt"
    
    13310
    -    ],
    
    13311
    -    "allow_failure": false,
    
    13312
    -    "artifacts": {
    
    13313
    -      "expire_in": "2 weeks",
    
    13314
    -      "paths": [
    
    13315
    -        "junit.xml",
    
    13316
    -        "unexpected-test-output.tar.gz"
    
    13317
    -      ],
    
    13318
    -      "reports": {
    
    13319
    -        "junit": "junit.xml"
    
    13320
    -      },
    
    13321
    -      "when": "always"
    
    13322
    -    },
    
    13323
    -    "cache": {
    
    13324
    -      "key": "x86_64-linux-deb13-riscv-$CACHE_REV",
    
    13325
    -      "paths": [
    
    13326
    -        "cabal-cache",
    
    13327
    -        "toolchain"
    
    13328
    -      ]
    
    13329
    -    },
    
    13330
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13-riscv:$DOCKER_REV",
    
    13331
    -    "needs": [
    
    13332
    -      {
    
    13333
    -        "artifacts": true,
    
    13334
    -        "job": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate"
    
    13335
    -      }
    
    13336
    -    ],
    
    13337
    -    "rules": [
    
    13338
    -      {
    
    13339
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*RISC-V.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    13340
    -        "when": "on_success"
    
    13341
    -      }
    
    13342
    -    ],
    
    13343
    -    "script": [
    
    13344
    -      "sudo chown ghc:ghc -R .",
    
    13345
    -      ".gitlab/ci.sh setup",
    
    13346
    -      ".gitlab/ci.sh configure",
    
    13347
    -      ".gitlab/ci.sh test_hadrian"
    
    13348
    -    ],
    
    13349
    -    "stage": "testing",
    
    13350
    -    "tags": [
    
    13351
    -      "x86_64-linux"
    
    13352
    -    ],
    
    13353
    -    "variables": {
    
    13354
    -      "BIGNUM_BACKEND": "gmp",
    
    13355
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    13356
    -      "BUILD_FLAVOUR": "validate",
    
    13357
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    13358
    -      "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu",
    
    13359
    -      "CROSS_STAGE": "2",
    
    13360 12719
           "CROSS_TARGET": "riscv64-linux-gnu",
    
    12720
    +      "FINAL_CROSS_STAGE": "3",
    
    13361 12721
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    13362 12722
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    13363 12723
           "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate",
    
    ... ... @@ -15021,7 +14381,7 @@
    15021 14381
           ".gitlab/ci.sh setup",
    
    15022 14382
           ".gitlab/ci.sh configure",
    
    15023 14383
           ".gitlab/ci.sh build_hadrian",
    
    15024
    -      ".gitlab/ci.sh test_hadrian_stage1"
    
    14384
    +      ".gitlab/ci.sh smoke_test"
    
    15025 14385
         ],
    
    15026 14386
         "stage": "full-build",
    
    15027 14387
         "tags": [
    
    ... ... @@ -15033,71 +14393,8 @@
    15033 14393
           "BUILD_FLAVOUR": "validate",
    
    15034 14394
           "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    15035 14395
           "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu",
    
    15036
    -      "CROSS_STAGE": "2",
    
    15037
    -      "CROSS_TARGET": "loongarch64-linux-gnu",
    
    15038
    -      "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    15039
    -      "RUNTEST_ARGS": "-e config.timeout=900",
    
    15040
    -      "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    15041
    -      "TEST_WAYS": ""
    
    15042
    -    }
    
    15043
    -  },
    
    15044
    -  "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate-test": {
    
    15045
    -    "after_script": [
    
    15046
    -      ".gitlab/ci.sh save_cache",
    
    15047
    -      ".gitlab/ci.sh save_test_output",
    
    15048
    -      ".gitlab/ci.sh clean",
    
    15049
    -      "cat ci_timings.txt"
    
    15050
    -    ],
    
    15051
    -    "allow_failure": false,
    
    15052
    -    "artifacts": {
    
    15053
    -      "expire_in": "2 weeks",
    
    15054
    -      "paths": [
    
    15055
    -        "junit.xml",
    
    15056
    -        "unexpected-test-output.tar.gz"
    
    15057
    -      ],
    
    15058
    -      "reports": {
    
    15059
    -        "junit": "junit.xml"
    
    15060
    -      },
    
    15061
    -      "when": "always"
    
    15062
    -    },
    
    15063
    -    "cache": {
    
    15064
    -      "key": "x86_64-linux-ubuntu24_04-loongarch-$CACHE_REV",
    
    15065
    -      "paths": [
    
    15066
    -        "cabal-cache",
    
    15067
    -        "toolchain"
    
    15068
    -      ]
    
    15069
    -    },
    
    15070
    -    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu24_04-loongarch:$DOCKER_REV",
    
    15071
    -    "needs": [
    
    15072
    -      {
    
    15073
    -        "artifacts": true,
    
    15074
    -        "job": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate"
    
    15075
    -      }
    
    15076
    -    ],
    
    15077
    -    "rules": [
    
    15078
    -      {
    
    15079
    -        "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*loongarch.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
    
    15080
    -        "when": "on_success"
    
    15081
    -      }
    
    15082
    -    ],
    
    15083
    -    "script": [
    
    15084
    -      "sudo chown ghc:ghc -R .",
    
    15085
    -      ".gitlab/ci.sh setup",
    
    15086
    -      ".gitlab/ci.sh configure",
    
    15087
    -      ".gitlab/ci.sh test_hadrian"
    
    15088
    -    ],
    
    15089
    -    "stage": "testing",
    
    15090
    -    "tags": [
    
    15091
    -      "x86_64-linux"
    
    15092
    -    ],
    
    15093
    -    "variables": {
    
    15094
    -      "BIGNUM_BACKEND": "gmp",
    
    15095
    -      "BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    
    15096
    -      "BUILD_FLAVOUR": "validate",
    
    15097
    -      "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check",
    
    15098
    -      "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu",
    
    15099
    -      "CROSS_STAGE": "2",
    
    15100 14396
           "CROSS_TARGET": "loongarch64-linux-gnu",
    
    14397
    +      "FINAL_CROSS_STAGE": "2",
    
    15101 14398
           "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
    
    15102 14399
           "RUNTEST_ARGS": "-e config.timeout=900",
    
    15103 14400
           "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate",
    

  • changelog.d/stage3-cross-bindists
    1
    +section: packaging
    
    2
    +synopsis: Fully cross-compiled binary distributions
    
    3
    +mrs: !15417
    
    4
    +issues: #26924
    
    5
    +description: Hadrian can now build cross-compiled binary distributions that run
    
    6
    +  native on another target architecture (e.g. AArch64 -> RISC-V).

  • hadrian/src/BindistConfig.hs
    ... ... @@ -24,6 +24,10 @@ crossBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage1
    24 24
     targetBindist ::  BindistConfig
    
    25 25
     targetBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage2 }
    
    26 26
     
    
    27
    +-- | Folder relative to build root ("bindist" or "bindist-stage3")
    
    28
    +bindistFolder :: BindistConfig ->  FilePath
    
    29
    +bindistFolder conf | executable_stage conf == Stage2 = "bindist-stage3"
    
    30
    +bindistFolder _conf = "bindist"
    
    27 31
     
    
    28 32
     -- | The implicit bindist config, if we don't know any better.
    
    29 33
     implicitBindistConfig :: Action BindistConfig
    

  • hadrian/src/Oracles/Setting.hs
    ... ... @@ -7,7 +7,7 @@ module Oracles.Setting (
    7 7
         -- * Helpers
    
    8 8
         ghcCanonVersion, cmdLineLengthLimit, targetSupportsRPaths, topDirectory,
    
    9 9
         libsuf, ghcVersionStage, shPath, perStageTarget, crossStage, queryTarget, queryPerStageTargetSpec,
    
    10
    -    isHostStage,
    
    10
    +    isHostStage, libraryStageFor,
    
    11 11
     
    
    12 12
         -- ** Target platform things
    
    13 13
         anyTargetOs, anyTargetArch, anyHostOs,
    
    ... ... @@ -262,3 +262,22 @@ crossStage st = do
    262 262
       st_target <- perStageTarget (succStage st)
    
    263 263
       st_host   <- perStageTarget st
    
    264 264
       return (targetPlatformTriple st_target /= targetPlatformTriple st_host)
    
    265
    +
    
    266
    +-- | The 'Stage' whose libraries and package database are used by a compiler
    
    267
    +-- built at (or running from) @compilerStage@.
    
    268
    +--
    
    269
    +-- Usually @compilerStage@ itself, but differs in two cases:
    
    270
    +--
    
    271
    +--  * 'Stage0' has no library or package database of its own; it uses 'Stage1'\'s.
    
    272
    +--  * A cross compiler uses the successor stage's libraries (built for the
    
    273
    +--  target, not the host).
    
    274
    +libraryStageFor :: Stage -> Action Stage
    
    275
    +libraryStageFor compilerStage = do
    
    276
    +  isCross <-
    
    277
    +    if compilerStage < Stage3
    
    278
    +      then
    
    279
    +        crossStage compilerStage
    
    280
    +      else return False
    
    281
    +  return $ case compilerStage of
    
    282
    +    Stage0 {} -> Stage1
    
    283
    +    _ -> if isCross then succStage compilerStage else compilerStage

  • hadrian/src/Rules/BinaryDist.hs
    ... ... @@ -13,66 +13,100 @@ import Rules.Generate (generateSettings)
    13 13
     import Settings
    
    14 14
     import qualified System.Directory.Extra as IO
    
    15 15
     import Settings.Program (programContext)
    
    16
    -import Target
    
    17
    -import Utilities
    
    18 16
     import BindistConfig
    
    19 17
     
    
    20 18
     {-
    
    21 19
     Note [Binary distributions]
    
    22 20
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    23 21
     
    
    24
    -Hadrian produces binary distributions under:
    
    22
    +Hadrian produces binary distributions that run on the build host architecture
    
    23
    +(build == host, target == host || target /= host) under:
    
    25 24
       <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz
    
    26 25
     
    
    27
    -It is generated by creating an archive from:
    
    28
    -  <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/
    
    26
    +For stage3 (build /= host, host == target) bindists, a separate parent folder
    
    27
    +is used:
    
    28
    +  <build root>/bindist-stage3/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz
    
    29 29
     
    
    30
    -It does so by following the steps below.
    
    30
    +While regular bindists are usual same-arch compilers or cross-compilers, stage3
    
    31
    +bindists are cross-compiled compilers.
    
    31 32
     
    
    32
    -- make sure we have a complete stage 2 compiler + haddock
    
    33
    +Bindists are generated by creating an archive from:
    
    34
    +  <build root>/<bindist|bindist-stage3>/ghc-<X>.<Y>.<Z>-<arch>-<os>/
    
    35
    +
    
    36
    +Stage2 cross-compilers are a by-product of creating stage3 cross-compiled
    
    37
    +compilers. The additional build dir (bindist-stage3) lets us keep both, such
    
    38
    +that we can build them in one go on CI.
    
    39
    +Configuration files (e.g. configure script and default.host.target) differ in
    
    40
    +this case and keeping both targets separated also saves us some headache
    
    41
    +dealing with stale files.
    
    42
    +
    
    43
    +This table introduces variables to simplify the following step descriptions:
    
    44
    +
    
    45
    +| compiler kind    | <bindist-dir>  | <executable-stage-dir> | <library-stage-dir> |
    
    46
    +|------------------|----------------|------------------------|---------------------|
    
    47
    +| native           | bindist        | stage1/                | stage1/             |
    
    48
    +| cross-compiler   | bindist        | stage1/                | stage2/             |
    
    49
    +| cross-compiled   | bindist-stage3 | stage2/                | stage2/             |
    
    50
    +
    
    51
    +These are the steps to build a bindist:
    
    52
    +
    
    53
    +- make sure we have a complete compiler + libraries + haddock for the stage(s)
    
    54
    +  to bundle
    
    33 55
     
    
    34 56
     - copy the specific binaries which should be in the bindist to the
    
    35 57
       bin folder and add the version suffix:
    
    36
    -    <build root>/stage1/bin/xxxx
    
    58
    +    <build root>/<executable-stage-dir>/bin/xxxx
    
    37 59
       to
    
    38
    -    <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER>
    
    60
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx-<VER>
    
    61
    +  where the optional <target>- prefix is the cross triple for cross-compilers.
    
    39 62
     
    
    40 63
     - create symlink (or bash) wrapper from unversioned to versioned executable:
    
    41
    -    <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx
    
    64
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx
    
    42 65
       points to:
    
    43
    -    <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER>
    
    66
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx-<VER>
    
    44 67
     
    
    45 68
     - copy the lib directories of the compiler we built:
    
    46
    -    <build root>/stage1/lib
    
    69
    +    <build root>/<library-stage-dir>/lib
    
    70
    +  to
    
    71
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib
    
    72
    +
    
    73
    +- for cross-compilers, overwrite the implicitly copied (previous step)
    
    74
    +  <build root>/<library-stage-dir>/lib/targets/default.target file with that of
    
    75
    +  the executable stage. I.e. copy:
    
    76
    +    <build root>/<executable-stage-dir>/lib/targets/default.target
    
    47 77
       to
    
    48
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib
    
    78
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib/targets/default.target
    
    79
    +
    
    80
    +- overwrite the also implicitly copied (with <build root>/<library-stage-dir>/lib)
    
    81
    +  <build root>/<library-stage-dir>/lib/settings file with a regenerated one, such
    
    82
    +  that the bindist's compiler is described.
    
    49 83
     
    
    50 84
     - copy the generated docs (user guide, haddocks, etc):
    
    51
    -    <build root>/docs/
    
    85
    +    <build root>/doc/
    
    52 86
       to
    
    53
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/docs/
    
    87
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/doc/
    
    54 88
     
    
    55
    -- use autoreconf to generate a `configure` script from
    
    56
    -  aclocal.m4 and distrib/configure.ac, that we move to:
    
    57
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure
    
    89
    +- use autoreconf to generate a staged `configure` script in
    
    90
    +    <build root>/<executable-stage>/distrib
    
    91
    +  that we move to:
    
    92
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure
    
    58 93
     
    
    59 94
     - write a (fixed) Makefile capable of supporting 'make install' to:
    
    60
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/Makefile
    
    95
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/Makefile
    
    61 96
     
    
    62 97
     - write some (fixed) supporting bash code for the wrapper scripts to:
    
    63
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program>
    
    98
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program>
    
    64 99
     
    
    65 100
       where <program> is the name of the executable that the bash file will
    
    66 101
       help wrapping.
    
    67 102
     
    
    68
    -- copy supporting configure/make related files
    
    69
    -  (see @bindistInstallFiles@) to:
    
    70
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/<file>
    
    103
    +- copy supporting configure/make related files (see @bindistInstallFiles@) to:
    
    104
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/<file>
    
    71 105
     
    
    72 106
     - create a .tar.xz archive of the directory:
    
    73
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/
    
    107
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/
    
    74 108
       at
    
    75
    -    <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz
    
    109
    +    <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz
    
    76 110
     
    
    77 111
     
    
    78 112
     Note [Wrapper scripts and binary distributions]
    
    ... ... @@ -159,12 +193,12 @@ buildBinDistDir root conf@BindistConfig{..} = do
    159 193
         distDir        <- Context.distDir (vanillaContext library_stage rts)
    
    160 194
     
    
    161 195
         let ghcBuildDir      = root -/- stageString library_stage
    
    162
    -        bindistFilesDir  = root -/- "bindist" -/- ghcVersionPretty
    
    196
    +        bindistFilesDir  = root -/- bindistFolder conf -/- ghcVersionPretty
    
    163 197
             ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform
    
    164 198
             rtsIncludeDir    = distDir -/- "include"
    
    165 199
     
    
    166
    -    -- We create the bindist directory at <root>/bindist/ghc-X.Y.Z-platform/
    
    167
    -    -- and populate it with Stage2 build results
    
    200
    +    -- We create the bindist directory at <root>/<bindistFolder>/ghc-X.Y.Z-platform/
    
    201
    +    -- and populate it with build results
    
    168 202
         createDirectory bindistFilesDir
    
    169 203
         createDirectory (bindistFilesDir -/- "bin")
    
    170 204
         createDirectory (bindistFilesDir -/- "lib")
    
    ... ... @@ -225,12 +259,19 @@ buildBinDistDir root conf@BindistConfig{..} = do
    225 259
     
    
    226 260
         copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir
    
    227 261
     
    
    262
    +    -- For cross-compilers we need to override the `targets/default.target`
    
    263
    +    -- file that was implicitly copied from the library stage, because this
    
    264
    +    -- describes a target native compiler (stage3) and not a cross-compiler.
    
    265
    +    when (library_stage /= executable_stage) $
    
    266
    +        copyFile (root -/- stageString executable_stage -/- "lib" -/- "targets" -/- "default.target")
    
    267
    +                 (bindistFilesDir -/- "lib" -/- "targets" -/- "default.target")
    
    268
    +
    
    228 269
         -- Regenerate settings file without LibDir. For bindists, LibDir should
    
    229 270
         -- be derived from topdir at runtime such that the GHC binary is
    
    230 271
         -- relocatable. The package DB is always at "package.conf.d" relative to
    
    231 272
         -- the lib dir, matching the known bindist layout.
    
    232 273
         let bindistSettings = bindistFilesDir -/- "lib" -/- "settings"
    
    233
    -        bindistContext = vanillaContext library_stage compiler
    
    274
    +        bindistContext = vanillaContext executable_stage compiler
    
    234 275
         bindistSettingsContent <- interpretInContext bindistContext $
    
    235 276
             generateSettings library_stage bindistSettings False "package.conf.d"
    
    236 277
         writeFileAtomic bindistSettings bindistSettingsContent
    
    ... ... @@ -244,10 +285,10 @@ buildBinDistDir root conf@BindistConfig{..} = do
    244 285
         --
    
    245 286
         -- N.B. the ghc-pkg executable may be prefixed with a target triple
    
    246 287
         -- (c.f. #20267).
    
    247
    -
    
    248
    -    -- Not going to work for cross
    
    249
    -    ghcPkgName <- programName (vanillaContext Stage1 ghcPkg)
    
    250
    -    ghcPkgProg <- exeSpawnPath (bindistFilesDir -/- "bin" -/- ghcPkgName)
    
    288
    +    -- Stage1 is also correct for cross-compiler scenarios, because it runs on
    
    289
    +    -- the build host.
    
    290
    +    ghcPkgPath <- programPath =<< programContext Stage1 ghcPkg
    
    291
    +    ghcPkgProg <- exeSpawnPath ghcPkgPath
    
    251 292
         cmdExe ghcPkgProg ["recache", "--package-db", bindistFilesDir -/- "lib" -/- "package.conf.d" ]
    
    252 293
             :: Action ()
    
    253 294
     
    
    ... ... @@ -345,8 +386,8 @@ bindistRules = do
    345 386
           buildBinDistDir root cfg
    
    346 387
     
    
    347 388
         phony "binary-dist-dir-cross" $ buildBinDistDir root crossBindist
    
    348
    -    -- MP: Not working yet
    
    349
    -    -- phony "binary-dist-dir-stage3" $ buildBinDistDir root targetBindist
    
    389
    +
    
    390
    +    phony "binary-dist-dir-stage3" $ buildBinDistDir root targetBindist
    
    350 391
     
    
    351 392
         let buildBinDist compressor = do
    
    352 393
               win_host <- isWinHost
    
    ... ... @@ -378,49 +419,27 @@ bindistRules = do
    378 419
           phony (name <> "-dist-xz") $ mk_bindist Xz
    
    379 420
     
    
    380 421
         phony "binary-dist-cross" $ buildBinDistX "binary-dist-dir-cross" "bindist" Xz
    
    381
    -    phony "binary-dist-stage3" $ buildBinDistX "binary-dist-dir-stage3" "bindist" Xz
    
    382
    -
    
    383
    -    -- Prepare binary distribution configure script
    
    384
    -    -- (generated under <ghc root>/distrib/configure by 'autoreconf')
    
    385
    -    root -/- "bindist" -/- "ghc-*" -/- "configure" %> \configurePath -> do
    
    386
    -        need ["distrib" -/- "configure.ac"]
    
    387
    -        ghcRoot <- topDirectory
    
    388
    -        copyFile (ghcRoot -/- "aclocal.m4") (ghcRoot -/- "distrib" -/- "aclocal.m4")
    
    389
    -        copyDirectory (ghcRoot -/- "m4") (ghcRoot -/- "distrib")
    
    390
    -
    
    391
    -        -- Note [Autoreconf unix paths from ACLOCAL_PATH]
    
    392
    -        -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    393
    -        -- On Windows, autoreconf fails when the ACLOCAL_PATH env variable contains Windows-
    
    394
    -        -- style paths. This happens because MSYS2 automatically converts env variables to
    
    395
    -        -- Windows-style paths. To fix this, we convert ACLOCAL_PATH back to Unix style.
    
    396
    -        -- This is done both in the boot Python script and here when building a bindist.
    
    397
    -        -- See Note [MSYS paths].
    
    398
    -        win_host <- isWinHost
    
    399
    -        aclocalPathMay <- if win_host then getEnv "ACLOCAL_PATH" else pure Nothing
    
    400
    -        let env = [ AddEnv "ACLOCAL_PATH" (windowsToMsysPathList aclocalPath)
    
    401
    -                  | Just aclocalPath <- [aclocalPathMay] ]
    
    402
    -
    
    403
    -        buildWithCmdOptions env $
    
    404
    -            target (vanillaContext Stage1 ghc) (Autoreconf $ ghcRoot -/- "distrib") [] []
    
    405
    -        -- We clean after ourselves, moving the configure script we generated in
    
    406
    -        -- our bindist dir
    
    407
    -        removeFile (ghcRoot -/- "distrib" -/- "aclocal.m4")
    
    408
    -        removeDirectory (ghcRoot -/- "distrib" -/- "m4")
    
    409
    -
    
    410
    -        moveFile (ghcRoot -/- "distrib" -/- "configure") configurePath
    
    411
    -
    
    412
    -    -- Generate the Makefile that enables the "make install" part
    
    413
    -    root -/- "bindist" -/- "ghc-*" -/- "Makefile" %> \makefilePath -> do
    
    414
    -        top <- topDirectory
    
    415
    -        copyFile (top -/- "hadrian" -/- "bindist" -/- "Makefile") makefilePath
    
    416
    -
    
    417
    -    -- Copy various configure-related files needed for a working
    
    418
    -    -- './configure [...] && make install' workflow
    
    419
    -    -- (see the list of files needed in the 'binary-dist' rule above, before
    
    420
    -    -- creating the archive).
    
    421
    -    forM_ bindistInstallFiles $ \file ->
    
    422
    -        root -/- "bindist" -/- "ghc-*" -/- file %> \dest -> do
    
    423
    -            copyFile (fixup file) dest
    
    422
    +    phony "binary-dist-stage3" $ buildBinDistX "binary-dist-dir-stage3" "bindist-stage3" Xz
    
    423
    +
    
    424
    +    forM_ [normalBindist, targetBindist] $ \bindistCfg -> do
    
    425
    +      let bindistFolderName = bindistFolder bindistCfg
    
    426
    +      root -/- bindistFolderName -/- "ghc-*" -/- "configure" %> \configurePath -> do
    
    427
    +          let distribConfigure = root -/- stageString (executable_stage bindistCfg) -/- "distrib" -/- "configure"
    
    428
    +          need [distribConfigure]
    
    429
    +          copyFile distribConfigure configurePath
    
    430
    +
    
    431
    +      -- Copy the Makefile that enables the "make install" part
    
    432
    +      root -/- bindistFolderName -/- "ghc-*" -/- "Makefile" %> \makefilePath -> do
    
    433
    +          top <- topDirectory
    
    434
    +          copyFile (top -/- "hadrian" -/- "bindist" -/- "Makefile") makefilePath
    
    435
    +
    
    436
    +      -- Copy various configure-related files needed for a working
    
    437
    +      -- './configure [...] && make install' workflow
    
    438
    +      -- (see the list of files needed in the 'binary-dist' rule above, before
    
    439
    +      -- creating the archive).
    
    440
    +      forM_ bindistInstallFiles $ \file ->
    
    441
    +          root -/- bindistFolderName -/- "ghc-*" -/- file %> \dest -> do
    
    442
    +              copyFile (fixup file) dest
    
    424 443
     
    
    425 444
       where
    
    426 445
         fixup f | f `elem` ["INSTALL", "README"] = "distrib" -/- f
    
    ... ... @@ -500,7 +519,7 @@ pkgToWrappers stage pkg = do
    500 519
             -- These are the packages which we want to expose to the user and hence
    
    501 520
             -- there are wrappers installed in the bindist.
    
    502 521
           | pkg `elem` [hpcBin, haddock, hp2ps, hsc2hs, ghc, ghcPkg]
    
    503
    -                      -> (:[]) <$> (programName =<< programContext Stage1 pkg)
    
    522
    +                      -> (:[]) <$> (programName =<< programContext stage pkg)
    
    504 523
           | otherwise     -> pure []
    
    505 524
     
    
    506 525
     wrapper :: Stage -> FilePath -> Action String
    
    ... ... @@ -553,7 +572,7 @@ ghciScriptWrapper stage = do
    553 572
     -- | Create a wrapper script calls the executable given as first argument
    
    554 573
     createVersionWrapper :: Stage -> Package -> String -> FilePath -> Action ()
    
    555 574
     createVersionWrapper executable_stage pkg versioned_exe install_path = do
    
    556
    -  ghcPath <- builderPath (Ghc CompileCWithGhc (succStage executable_stage))
    
    575
    +  ghcPath <- builderPath (Ghc CompileCWithGhc executable_stage)
    
    557 576
       top <- topDirectory
    
    558 577
       let version_wrapper_dir = top -/- "hadrian" -/- "bindist" -/- "cwrappers"
    
    559 578
           wrapper_files = [ version_wrapper_dir -/- file | file <- ["version-wrapper.c", "getLocation.c", "cwrapper.c"]]
    

  • hadrian/src/Rules/Generate.hs
    ... ... @@ -25,7 +25,6 @@ import Utilities
    25 25
     import GHC.Toolchain as Toolchain hiding (HsCpp(HsCpp))
    
    26 26
     import GHC.Platform.ArchOS
    
    27 27
     import Settings.Program (ghcWithInterpreter)
    
    28
    -import UserSettings (finalStage)
    
    29 28
     
    
    30 29
     -- | Track this file to rebuild generated files whenever it changes.
    
    31 30
     trackGenerateHs :: Expr ()
    
    ... ... @@ -252,36 +251,36 @@ generateRules = do
    252 251
         (root -/- "ghc-stage2") <~+ ghcWrapper Stage2
    
    253 252
         (root -/- "ghc-stage3") <~+ ghcWrapper Stage3
    
    254 253
     
    
    255
    -    forM_ allStages $ \stage -> do
    
    256
    -        let prefix = root -/- stageString stage -/- "lib"
    
    257
    -            -- For the finalStage, we generate settings for that stage. For
    
    258
    -            -- others we look at the next stage. Why? Because cross-compilers
    
    259
    -            -- require libs from the successor stage, otherwise they are
    
    260
    -            -- compiled for the host and not the target.
    
    261
    -            stage' = if stage /= finalStage then succStage stage else stage
    
    262
    -            go gen file = generate file (semiEmptyTarget stage') gen
    
    254
    +    forM_ allStages $ \compilerStage -> do
    
    255
    +        let
    
    256
    +            prefix = root -/- stageString compilerStage -/- "lib"
    
    257
    +            go gen file = generate file (semiEmptyTarget compilerStage) gen
    
    263 258
             (prefix -/- "settings") %> \out -> do
    
    264
    -            let get_pkg_db stg = packageDbPath (PackageDbLoc stg Final)
    
    265
    -            -- For cross, LibDir points to stage' lib dir, so pkgDb must also
    
    266
    -            -- be relative to stage' lib dir.
    
    267
    -            isCross <- crossStage stage
    
    268
    -            let libStage = case stage of
    
    269
    -                    Stage0 {} -> Stage1
    
    270
    -                    _         -> if isCross then stage' else stage
    
    271
    -            pkgDb <- get_pkg_db libStage
    
    259
    +            libraryStage <- libraryStageFor compilerStage
    
    260
    +            pkgDb <- packageDbPath (PackageDbLoc libraryStage Final)
    
    272 261
                 -- addTrailingPathSeparator needed: makeRelativeNoSysLink uses
    
    273 262
                 -- splitPath where "lib" and "lib/" are distinct components.
    
    274 263
                 let libTopDir = addTrailingPathSeparator $
    
    275
    -                    if isCross
    
    276
    -                      then root -/- stageString stage' -/- "lib"
    
    277
    -                      else prefix
    
    264
    +                    if isStage0 compilerStage
    
    265
    +                      then prefix
    
    266
    +                      else root -/- stageString libraryStage -/- "lib"
    
    278 267
                     relPkgDb = makeRelativeNoSysLink libTopDir pkgDb
    
    279
    -            go (generateSettings libStage out True relPkgDb) out
    
    280
    -        (prefix -/- "targets" -/- "default.target") %> \out -> go (show <$> expr (perStageTarget (succStage stage))) out
    
    268
    +            go (generateSettings libraryStage out True relPkgDb) out
    
    269
    +        (prefix -/- "targets" -/- "default.target") %> \out ->
    
    270
    +            go (generateTargetFile compilerStage) out
    
    281 271
     
    
    282 272
       where
    
    283 273
         file <~+ gen = file %> \out -> generate out emptyTarget gen >> makeExecutable out
    
    284 274
     
    
    275
    +    generateTargetFile :: Stage -> Expr String
    
    276
    +    generateTargetFile compilerStage = do
    
    277
    +        isCrossStage <- if compilerStage < Stage3
    
    278
    +                          then expr (crossStage compilerStage)
    
    279
    +                          else pure False
    
    280
    +        libraryStage <- expr (libraryStageFor compilerStage)
    
    281
    +        tgt <- expr (perStageTarget libraryStage)
    
    282
    +        pure $ show tgt { tgtLocallyExecutable = not isCrossStage }
    
    283
    +
    
    285 284
     -- TODO: Use the Types, Luke! (drop partial function)
    
    286 285
     -- We sometimes need to evaluate expressions that do not require knowing all
    
    287 286
     -- information about the context. In this case, we don't want to know anything.
    
    ... ... @@ -413,6 +412,7 @@ templateRules = do
    413 412
     
    
    414 413
     bindistRules :: Rules ()
    
    415 414
     bindistRules = do
    
    415
    +  root <- buildRootRules
    
    416 416
       templateRule ("mk" -/- "project.mk") $ mconcat
    
    417 417
         [ interpolateSetting "ProjectName" ProjectName
    
    418 418
         , interpolateSetting "ProjectVersion" ProjectVersion
    
    ... ... @@ -424,45 +424,146 @@ bindistRules = do
    424 424
     
    
    425 425
         , interpolateVar "HostOS_CPP" $ fmap cppify $ interp $ queryHost queryOS
    
    426 426
     
    
    427
    -    , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple
    
    428
    -    , interpolateVar "TargetPlatform_CPP" $ cppify <$> getTarget targetPlatformTriple
    
    429
    -    , interpolateVar "TargetArch_CPP" $ cppify <$> getTarget queryArch
    
    430
    -    , interpolateVar "TargetOS_CPP" $ cppify <$> getTarget queryOS
    
    431
    -    , interpolateVar "LLVMTarget" $ getTarget tgtLlvmTarget
    
    432
    -    ]
    
    433
    -  templateRule ("distrib" -/- "configure.ac") $ mconcat
    
    434
    -    [ interpolateSetting "ConfiguredEmsdkVersion" EmsdkVersion
    
    435
    -    , interpolateVar "CrossCompilePrefix" $ do
    
    436
    -        crossCompiling <- interp $ getFlag CrossCompiling
    
    437
    -        tpf <- setting TargetPlatformFull
    
    438
    -        pure $ if crossCompiling then tpf <> "-" else ""
    
    439
    -    , interpolateVar "LeadingUnderscore" $ yesNo <$> getTarget tgtSymbolsHaveLeadingUnderscore
    
    440
    -    , interpolateSetting "LlvmMaxVersion" LlvmMaxVersion
    
    441
    -    , interpolateSetting "LlvmMinVersion" LlvmMinVersion
    
    442
    -    , interpolateVar "LlvmTarget" $ getTarget tgtLlvmTarget
    
    443
    -    , interpolateSetting "ProjectVersion" ProjectVersion
    
    444
    -    , interpolateVar "EnableDistroToolchain" $ interp (staged (lookupStageBuildConfig "settings-use-distro-mingw"))
    
    445
    -    , interpolateVar "TablesNextToCode" $ yesNo <$> getTarget tgtTablesNextToCode
    
    446
    -    , interpolateVar "TargetHasLibm" $ yesNo <$> getTarget tgtHasLibm
    
    447
    -    , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple
    
    448
    -    , interpolateVar "BuildPlatform"  $ interp $ queryBuild targetPlatformTriple
    
    449
    -    , interpolateVar "HostPlatform"   $ interp $ queryHost targetPlatformTriple
    
    450
    -    , interpolateVar "TargetWordBigEndian" $ getTarget isBigEndian
    
    451
    -    , interpolateVar "TargetWordSize" $ getTarget wordSize
    
    452
    -    , interpolateVar "Unregisterised" $ yesNo <$> getTarget tgtUnregisterised
    
    453
    -    , interpolateVar "UseLibdw" $ fmap yesNo $ interp $ staged (fmap (isJust . tgtRTSWithLibdw) . perStageTarget)
    
    454
    -    , interpolateVar "UseLibffiForAdjustors" $ yesNo <$> getTarget tgtUseLibffiForAdjustors
    
    455
    -    , interpolateVar "BaseUnitId" $ bindistUnitId base
    
    456
    -    , interpolateVar "GhcUnitId" $ bindistUnitId compiler
    
    457
    -    , interpolateVar "GhcInternalUnitId" $ bindistUnitId ghcInternal
    
    458
    -    , interpolateVar "GhcWithSMP" $ yesNo <$> targetSupportsSMP Stage2
    
    459
    -    , interpolateVar "TargetPlatformFull" (setting TargetPlatformFull)
    
    460
    -    , interpolateVar "BuildPlatformFull" (setting BuildPlatformFull)
    
    461
    -    , interpolateVar "HostPlatformFull"  (setting HostPlatformFull)
    
    427
    +    -- Stage2 always targets the target (as in build, host, target)
    
    428
    +    -- architecture. Thus, we can use it constant stage here to find
    
    429
    +    -- information about the target architecture.
    
    430
    +    , interpolateVar "TargetPlatform" $ getTarget Stage2 targetPlatformTriple
    
    431
    +    , interpolateVar "TargetPlatform_CPP" $ cppify <$> getTarget Stage2 targetPlatformTriple
    
    432
    +    , interpolateVar "TargetArch_CPP" $ cppify <$> getTarget Stage2 queryArch
    
    433
    +    , interpolateVar "TargetOS_CPP" $ cppify <$> getTarget Stage2 queryOS
    
    434
    +    , interpolateVar "LLVMTarget" $ getTarget Stage2 tgtLlvmTarget
    
    462 435
         ]
    
    436
    +  forM_ [Stage1, Stage2] $ \stage ->
    
    437
    +    let crossStageInterps = Interpolations $ do
    
    438
    +          isCrossStage <- crossStage stage
    
    439
    +          targetPlatform <- setting TargetPlatformFull
    
    440
    +          -- For cross-compiled compilers we need to pretend that they were
    
    441
    +          -- build on the target. For regular compilers we can assume that:
    
    442
    +          -- build == host == target
    
    443
    +          buildPlatform <-
    
    444
    +            if isCrossStage
    
    445
    +              then
    
    446
    +                interp $ queryBuild targetPlatformTriple
    
    447
    +              else getTarget stage targetPlatformTriple
    
    448
    +          hostPlatform <-
    
    449
    +            if isCrossStage
    
    450
    +              then
    
    451
    +                interp $ queryHost targetPlatformTriple
    
    452
    +              else getTarget stage targetPlatformTriple
    
    453
    +          -- The unit ids of the libraries shipped with this bindist. For
    
    454
    +          -- cross compilers these are the target-architecture libraries'
    
    455
    +          -- unit ids (#27919), which the implicit bindist config encodes.
    
    456
    +          baseUnitId <- bindistUnitId base
    
    457
    +          ghcUnitId <- bindistUnitId compiler
    
    458
    +          ghcInternalUnitId <- bindistUnitId ghcInternal
    
    459
    +          buildPlatformFull <- if isCrossStage then setting BuildPlatformFull else setting TargetPlatformFull
    
    460
    +          hostPlatformFull <- if isCrossStage then setting HostPlatformFull else setting TargetPlatformFull
    
    461
    +          pure
    
    462
    +            [ ("CrossCompilePrefix", if isCrossStage then targetPlatform <> "-" else "")
    
    463
    +            , ("TargetPlatformFull", targetPlatform)
    
    464
    +            , ("BuildPlatform", buildPlatform)
    
    465
    +            , ("HostPlatform", hostPlatform)
    
    466
    +            , ("BaseUnitId", baseUnitId)
    
    467
    +            , ("GhcUnitId", ghcUnitId)
    
    468
    +            , ("GhcInternalUnitId", ghcInternalUnitId)
    
    469
    +            , ("BuildPlatformFull", buildPlatformFull)
    
    470
    +            , ("HostPlatformFull", hostPlatformFull)
    
    471
    +            ]
    
    472
    +    in templateRuleFrom
    
    473
    +      ("distrib" -/- "configure.ac" <.> "in")
    
    474
    +      (root -/- stageString stage -/- "distrib" -/- "configure.ac")
    
    475
    +      $ mconcat
    
    476
    +      [ interpolateSetting "ConfiguredEmsdkVersion" EmsdkVersion
    
    477
    +      , interpolateVar "LeadingUnderscore" $ yesNo <$> getLibTarget stage tgtSymbolsHaveLeadingUnderscore
    
    478
    +      , interpolateSetting "LlvmMaxVersion" LlvmMaxVersion
    
    479
    +      , interpolateSetting "LlvmMinVersion" LlvmMinVersion
    
    480
    +      , interpolateVar "LlvmTarget" $ getLibTarget stage tgtLlvmTarget
    
    481
    +      , interpolateSetting "ProjectVersion" ProjectVersion
    
    482
    +      , interpolateVar "EnableDistroToolchain" $ interp (staged (lookupStageBuildConfig "settings-use-distro-mingw"))
    
    483
    +      , interpolateVar "TablesNextToCode" $ yesNo <$> getLibTarget stage tgtTablesNextToCode
    
    484
    +      , interpolateVar "TargetHasLibm" $ yesNo <$> getLibTarget stage tgtHasLibm
    
    485
    +      , interpolateVar "TargetPlatform" $ getLibTarget stage targetPlatformTriple
    
    486
    +      , interpolateVar "TargetWordBigEndian" $ getLibTarget stage isBigEndian
    
    487
    +      , interpolateVar "TargetWordSize" $ getLibTarget stage wordSize
    
    488
    +      , interpolateVar "Unregisterised" $ yesNo <$> getLibTarget stage tgtUnregisterised
    
    489
    +      , interpolateVar "UseLibdw" $ yesNo <$> getLibTarget stage (isJust . tgtRTSWithLibdw)
    
    490
    +      , interpolateVar "UseLibffiForAdjustors" $ yesNo <$> getLibTarget stage tgtUseLibffiForAdjustors
    
    491
    +      , interpolateVar "GhcWithSMP" $ yesNo <$> libStageSupportsSMP stage
    
    492
    +      , crossStageInterps
    
    493
    +      ]
    
    494
    +
    
    495
    +  -- Note [Bindist configure autoconf srcdir]
    
    496
    +  -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    497
    +  -- We can build binary distributions for several stages. These may need
    
    498
    +  -- different `configure` scripts. To avoid race-conditions on temporary
    
    499
    +  -- autoconf files (including `configure`), we generate those in the stages'
    
    500
    +  -- dedicated build folders (`_build/<stage>`).
    
    501
    +  --
    
    502
    +  -- The generated `configure.ac` lives in `_build/<stage>/distrib`, while the
    
    503
    +  -- m4 macros are one level up in _build/<stage>/m4. This mirrors the
    
    504
    +  -- repository layout, where `distrib/configure.ac.in` refers to the macros
    
    505
    +  -- via AC_CONFIG_MACRO_DIRS([../m4]) (i.e. the repository's top-level `m4/`).
    
    506
    +  -- Keeping the same relative layout means the template needs no change.
    
    507
    +  --
    
    508
    +  -- We deliberately do *not* copy the top-level `aclocal.m4`: its m4_include
    
    509
    +  -- directives are relative to the directory aclocal first ran in. Instead we
    
    510
    +  -- run autoreconf next to the staged `configure.ac` and let aclocal pick the
    
    511
    +  -- macro directory up from its AC_CONFIG_MACRO_DIRS([../m4]), regenerating
    
    512
    +  -- `aclocal.m4` with `../m4/...` includes that resolve from there.
    
    513
    +  --
    
    514
    +  -- The other copied files need to be present for autoconf and/or autoreconf.
    
    515
    +  forM_ [Stage1, Stage2] $ \stage -> do
    
    516
    +    let stageDir   = root -/- stageString stage
    
    517
    +        distribDir = stageDir -/- "distrib"
    
    518
    +
    
    519
    +    forM_ ["config.sub", "config.guess", "install-sh"] $ \f ->
    
    520
    +      distribDir -/- f %> \out -> do
    
    521
    +        top <- topDirectory
    
    522
    +        copyFile (top -/- f) out
    
    523
    +
    
    524
    +    stageDir -/- "m4/*.m4" %> \out -> do
    
    525
    +      top <- topDirectory
    
    526
    +      copyFile (top -/- "m4" -/- takeFileName out) out
    
    527
    +
    
    528
    +    distribDir -/- "configure" %> \_ -> do
    
    529
    +      top    <- topDirectory
    
    530
    +      m4Files <- getDirectoryFiles (top -/- "m4") ["*.m4"]
    
    531
    +      need $ [ distribDir -/- "configure.ac"
    
    532
    +             , distribDir -/- "config.sub"
    
    533
    +             , distribDir -/- "config.guess"
    
    534
    +             , distribDir -/- "install-sh"
    
    535
    +             ]
    
    536
    +           ++ [ stageDir -/- "m4" -/- takeFileName f | f <- m4Files ]
    
    537
    +
    
    538
    +      -- Note [Autoreconf unix paths from ACLOCAL_PATH]
    
    539
    +      -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    540
    +      -- On Windows, autoreconf fails when the ACLOCAL_PATH env variable
    
    541
    +      -- contains Windows-style paths. MSYS2 auto-converts env vars to
    
    542
    +      -- Windows-style, so we convert ACLOCAL_PATH back to Unix style here.
    
    543
    +      -- This is done both in the boot Python script and here when
    
    544
    +      -- building a bindist.
    
    545
    +      -- See Note [MSYS paths].
    
    546
    +      win_host <- isWinHost
    
    547
    +      aclocalPathMay <- if win_host then getEnv "ACLOCAL_PATH" else pure Nothing
    
    548
    +      let env = [ AddEnv "ACLOCAL_PATH" (windowsToMsysPathList aclocalPath)
    
    549
    +                | Just aclocalPath <- [aclocalPathMay] ]
    
    550
    +
    
    551
    +      buildWithCmdOptions env $
    
    552
    +        target (vanillaContext stage ghc) (Autoreconf distribDir) [] []
    
    463 553
       where
    
    464 554
         interp = interpretInContext (semiEmptyTarget Stage2)
    
    465
    -    getTarget = interp . queryTarget Stage2
    
    555
    +    getTarget stage = interp . queryTarget stage
    
    556
    +    getLibTarget executableStage f = do
    
    557
    +      libStage <- libraryStageFor executableStage
    
    558
    +      getTarget libStage f
    
    559
    +    -- | 'targetSupportsSMP' lifted to the library stage (see 'getLibTarget').
    
    560
    +    libStageSupportsSMP stage = do
    
    561
    +      libStage <- libraryStageFor stage
    
    562
    +      targetSupportsSMP libStage
    
    563
    +    -- | The unit id of @pkg@ in the stage whose libraries ship with the
    
    564
    +    -- bindist, i.e. the library stage of the implicit bindist config. For
    
    565
    +    -- cross compilers these are the target-architecture unit ids, as
    
    566
    +    -- reported by @ghc --info@ (#27919).
    
    466 567
         bindistUnitId pkg = do
    
    467 568
           stage <- library_stage <$> implicitBindistConfig
    
    468 569
           pkgUnitId stage pkg
    
    ... ... @@ -487,6 +588,14 @@ ghcWrapper stage = do
    487 588
     
    
    488 589
     -- | Generate settings file, optionally including @LibDir@.
    
    489 590
     --
    
    591
    +-- Describes the compiler whose stage is the ambient 'Expr' context
    
    592
    +-- (available here as @executableStage@ via 'getStage'). The @libraryStage@
    
    593
    +-- argument is the stage whose lib dir holds the libraries the described
    
    594
    +-- compiler links against — used both for the @base@ unit-id lookup and for
    
    595
    +-- the @LibDir@ entry. It usually equals @executableStage@ but differs when
    
    596
    +-- the compiler links against libraries from a different stage (cross
    
    597
    +-- compilers, or the Stage0 bootstrap compiler using Stage1's libraries).
    
    598
    +--
    
    490 599
     -- @rel_pkg_db@: package DB path relative to the lib dir (e.g.
    
    491 600
     -- "package.conf.d"). Callers supply the correct relative path. For bindists
    
    492 601
     -- the layout is known statically; for in-tree builds callers compute it. For
    
    ... ... @@ -496,7 +605,7 @@ ghcWrapper stage = do
    496 605
     generateSettings :: Stage -> FilePath -> Bool -> FilePath -> Expr String
    
    497 606
     generateSettings libraryStage settingsFile includeLibDir rel_pkg_db = do
    
    498 607
         ctx <- getContext
    
    499
    -    stage <- getStage
    
    608
    +    executableStage <- getStage
    
    500 609
     
    
    501 610
         -- These are the units supplied in the target package database, which can
    
    502 611
         -- differ from the host units linked into a cross compiler.
    
    ... ... @@ -504,25 +613,18 @@ generateSettings libraryStage settingsFile includeLibDir rel_pkg_db = do
    504 613
         ghc_unit_id <- expr $ pkgUnitId libraryStage compiler
    
    505 614
         ghc_internal_unit_id <- expr $ pkgUnitId libraryStage ghcInternal
    
    506 615
     
    
    507
    -    -- For cross compilers, LibDir points to the succeeding stage's lib dir
    
    508
    -    -- (which contains the target architecture's libraries). For non-cross,
    
    509
    -    -- it points to the preceding stage's lib dir as usual.
    
    510
    -    let compilerStage = predStage stage  -- the GHC that builds packages in this stage
    
    511
    -    isCrossLibDir <- expr $ crossStage compilerStage
    
    512
    -    let stage_dir_stage = if isCrossLibDir then stage else compilerStage
    
    513
    -
    
    514
    -    -- addTrailingPathSeparator is needed because makeRelativeNoSysLink uses
    
    515
    -    -- splitPath internally, where "lib" and "lib/" are distinct components.
    
    516
    -    lib_topDir :: FilePath <- expr $ addTrailingPathSeparator <$> stageLibPath stage_dir_stage
    
    616
    +    lib_topDir :: FilePath <- expr $ addTrailingPathSeparator <$> stageLibPath libraryStage
    
    517 617
         let rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir
    
    518 618
     
    
    519 619
         settings <- traverse sequence $
    
    520
    -          [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit, Context.stage = compilerStage })))
    
    521
    -          , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter compilerStage)
    
    522
    -          -- Hard-coded as Cabal queries these to determine way support and we
    
    523
    -          -- need to always advertise all ways when bootstrapping.
    
    524
    -          -- The settings file is generated at install time when installing a bindist.
    
    525
    -          , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays)
    
    620
    +          [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit })))
    
    621
    +          , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter executableStage)
    
    622
    +          -- Advertise the RTS ways that will actually ship with the compiler
    
    623
    +          -- described by this settings file, i.e. the ways the @libraryStage@
    
    624
    +          -- RTS is built with.
    
    625
    +          -- The settings file is regenerated at install time when installing a bindist.
    
    626
    +          , ("RTS ways", unwords . map show . Set.toList <$>
    
    627
    +              expr (interpretInContext (vanillaContext libraryStage rts) getRtsWays))
    
    526 628
               , ("Relative Global Package DB", pure rel_pkg_db)
    
    527 629
               , ("base unit-id", pure base_unit_id)
    
    528 630
               , ("Project Unit Id", pure ghc_unit_id)
    

  • hadrian/src/Settings/Packages.hs
    ... ... @@ -112,8 +112,11 @@ packageArgs = do
    112 112
                  , compilerStageOption ghcDebugAssertions ? arg "-DDEBUG" ]
    
    113 113
     
    
    114 114
               , builder (Cabal Flags) ? mconcat
    
    115
    -            [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter"
    
    116
    -            , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `cabalFlag` "internal-interpreter"
    
    115
    +            -- In the context of cross-compilation, stage2 runs on the target
    
    116
    +            -- and thus can - if the architecture supports it - provide the
    
    117
    +            -- interpreter natively.
    
    118
    +            [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1, stage2]] `cabalFlag` "interpreter"
    
    119
    +            , andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter"
    
    117 120
                 , ifM stage0
    
    118 121
                       -- We build a threaded stage 1 if the bootstrapping compiler
    
    119 122
                       -- supports it.