[Git][ghc/ghc][master] 4 commits: hadrian: Add Stage3 cross-compiled target bindist (#26924)
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 9ad25cb2 by Sven Tennie at 2026-11-14T06:20:13-05:00 hadrian: Add Stage3 cross-compiled target bindist (#26924) Add a `binary-dist-stage3` Hadrian target that packages target executables (produced by the stage2 compiler) into a separate '_build/bindist-stage3/' folder, distinct from the stage2 regular or cross-compiler bindist in '_build/bindist/'. This allows a single CI pipeline job to produce both a cross-compiler bindist (e.g. x86_64 -> RISC-V) and a target-architecture bindist (e.g. RISC-V -> RISC-V) that can be installed and run natively on the target. To avoid issues with stale files or race-conditions on them, generate the `configure` script per stage in `_build/<stage>/distrib` directories. - - - - - ca91017d by Sven Tennie at 2026-11-14T06:20:13-05:00 ci: Build Stage3 and Stage2 bindists for cross targets in one job (#26924) Building the stage3 target bindist already produces most of the stage2 cross-compiler bindist as a byproduct, so building them in separate jobs duplicates the build efforts for no benefit. Instead of a separate CROSS_STAGE=3 job, the stage3 job now also builds and publishes the stage2 bindist. The stage3 tarball is named and versioned as if it were built natively on the target (target triple prefix, non-cross opsys), so its artifact name stays what downstream consumers already expect and no changes are needed on their side. For now, this is only enabled for the RISC-V job. Others can easily follow. - - - - - 71b41e09 by Sven Tennie at 2026-11-14T06:20:14-05:00 ci: model cross targets as structured TargetPlatform triples (#26924) Storing the cross target as a raw triple forced ad-hoc parsing at every use, and broke the single responsibility rule. Modelling it as a structured `TargetPlatform`` instead, avoids parsing and provides a clear separation of concerns. - - - - - 8067c2f9 by Sven Tennie at 2026-11-14T06:20:14-05:00 ci: extract the cross smoke tests into a separate smoke_test command (#26924) This reduces if-nesting and complexity of the main `test_hadrian` command. The decision how to test is now made by the caller. This is a fair choice, because most test cases can run under emulation - they are just very slow then. The Stage3 smoke test also checks that the target compiler does not report itself as cross-compiling and, when supported, runs a small GHCi expression. - - - - - 10 changed files: - .gitignore - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - + changelog.d/stage3-cross-bindists - hadrian/src/BindistConfig.hs - hadrian/src/Oracles/Setting.hs - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Settings/Packages.hs Changes: ===================================== .gitignore ===================================== @@ -120,7 +120,6 @@ _darcs/ /compiler/GHC/CmmToLlvm/Version/Bounds.hs /compiler/ghc.cabal /compiler/ghc.cabal.old -/distrib/configure.ac /distrib/ghc.iss /docs/index.html /docs/man ===================================== .gitlab/ci.sh ===================================== @@ -62,9 +62,10 @@ Common Modes: Environment variables affecting the build: CROSS_TARGET Triple of cross-compilation target. - CROSS_STAGE The stage of the cross-compiler to build either - * 2: Build a normal cross-compiler bindist - * 3: Build a target executable bindist (with the stage2 cross-compiler) + FINAL_CROSS_STAGE The final stage of the cross-compiler to build either + * 2: Build a cross-compiler bindist + * 3: Also build the target executable bindist + (builds stages 2 and 3; implies the bindist of 2) VERBOSE Set to non-empty for verbose build output RUNTEST_ARGS Arguments passed to runtest.py TEST_WAYS Testsuite ways to run @@ -573,10 +574,17 @@ function build_hadrian() { export XZ_OPT="${XZ_OPT:-} -T$cores" fi - case "${CROSS_STAGE:-2}" in + case "${FINAL_CROSS_STAGE:-2}" in 2) BINDIST_TARGET="binary-dist";; - 3) BINDIST_TARGET="binary-dist-stage3";; - *) fail "Unknown CROSS_STAGE, must be 2 or 3";; + # Stage2 bindists are (almost) a byproduct of Stage3 bindists. So, we + # bundle both of them when the Stage3 bindist is built. + 3) + BINDIST_TARGET="binary-dist binary-dist-stage3" + if [[ -z "${BIN_DIST_NAME_STAGE3:-}" ]]; then + fail "FINAL_CROSS_STAGE=3 requires BIN_DIST_NAME_STAGE3 to be set" + fi + ;; + *) fail "Unknown FINAL_CROSS_STAGE, must be 2 or 3";; esac if [[ -n "${REINSTALL_GHC:-}" ]]; then @@ -590,6 +598,9 @@ function build_hadrian() { *) run_hadrian test:all_deps $BINDIST_TARGET mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" + if [[ "${FINAL_CROSS_STAGE:-2}" == "3" ]]; then + mv _build/bindist-stage3/ghc*.tar.xz "$BIN_DIST_NAME_STAGE3.tar.xz" + fi ;; esac fi @@ -648,16 +659,6 @@ function install_bindist() { end_section install-bindist } -function find_bindist_tar() { - local tar_files - tar_files=( *ghc*.tar.xz ) - if [[ ${#tar_files[@]} -gt 0 ]]; then - bindist_tar="${tar_files[0]}" - else - unset bindist_tar - fi -} - # stage 1 tests -- these do not run as part # of the test stage but already as part of the # build stage as they don't require a bindist @@ -691,55 +692,92 @@ function test_hadrian_stage1() { fi } -function test_hadrian() { - - # if a bindist tar exists, the variable $bindist_tar will be set - # that way we can later check for its existance to find whether - # we are running with a bindist. - find_bindist_tar - dist_dir="_build/bindist" - - if [ -n "$bindist_tar" ]; then - mkdir -p "$dist_dir" - tar -xf "$bindist_tar" -C "$dist_dir" - fi - +# Smoke-test the cross-compiled Stage2 and Stage2 bindists using the emulator. +# For cross jobs with a working emulator this runs instead of `test_hadrian` +# as a separate validation step after the build. +function smoke_test() { + check_msys2_deps _build/stage1/bin/ghc --version check_release_build - # GitLab's log viewer renders ANSI colors, but stdout here is not a tty, - # so the driver must be told to emit them. - RUNTEST_ARGS="${RUNTEST_ARGS:-} --force-colors" - - if [[ "${CROSS_EMULATOR:-}" == "NOT_SET" ]]; then info "Cannot test cross-compiled build without CROSS_EMULATOR being set." return - # If we have set CROSS_EMULATOR, then can't test using normal testsuite. - elif [ -n "${CROSS_EMULATOR:-}" ] && [[ "${CROSS_TARGET:-}" != *"wasm"* ]]; then - info "Cross compiling with CROSS_EMULATOR='$CROSS_EMULATOR' and CROSS_TARGET='$CROSS_TARGET'" - local instdir="$TOP/_build/install" - local test_compiler="$instdir/bin/${cross_prefix}ghc$exe" - install_bindist $dist_dir/ghc-*/ "$instdir" - echo 'main = putStrLn "hello world"' > expected - run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello + fi + + local instdir="$TOP/_build/install" + local test_compiler="$instdir/bin/${cross_prefix}ghc$exe" + install_bindist _build/bindist/ghc-*/ "$instdir" + echo 'main = putStrLn "hello world"' > expected + run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello + + if [[ "${CROSS_TARGET:-no_cross_target}" =~ "mingw" ]]; then + ${CROSS_EMULATOR:-} ./hello.exe > actual + else + ${CROSS_EMULATOR:-} ./hello > actual + fi + + # We have to use `-w` to make the test more stable across supported + # platforms, i.e. Windows: + # $ cmp expected actual + # differ: byte 30, line 1 + # $ diff expected actual + # 1c1 + # < main = putStrLn "hello world" + # --- + # > main = putStrLn "hello world" + run diff -w expected actual + + if [[ "${FINAL_CROSS_STAGE:-2}" == "3" ]]; then + local stage3_dir + stage3_dir="$(echo _build/bindist-stage3/ghc-*/)" + local stage3_ghc="$stage3_dir/bin/ghc$exe" + + info "Smoke-testing stage3 compiler..." + run ${CROSS_EMULATOR} "$stage3_ghc" --info > stage3-info + cat stage3-info + + # The stage3 compiler is a native target compiler: it must not consider + # itself a cross-compiler, and GHCi support must be compiled in when the + # target supports it. + grep -q '"cross compiling","NO"' stage3-info \ + || fail "stage3 compiler reports itself as cross-compiling" + + if grep -q '"Use interpreter","YES"' stage3-info; then + echo 'ghci works' > ghci-expected + ${CROSS_EMULATOR:-} "$stage3_ghc" -e 'putStrLn "ghci works"' > ghci-actual + run diff -w ghci-expected ghci-actual + fi + + run ${CROSS_EMULATOR} "$stage3_ghc" -package ghc "$TOP/.gitlab/hello.hs" -o hello-stage3 if [[ "${CROSS_TARGET:-no_cross_target}" =~ "mingw" ]]; then - ${CROSS_EMULATOR:-} ./hello.exe > actual + ${CROSS_EMULATOR:-} ./hello-stage3.exe > actual-stage3 else - ${CROSS_EMULATOR:-} ./hello > actual + ${CROSS_EMULATOR:-} ./hello-stage3 > actual-stage3 fi - # We have to use `-w` to make the test more stable across supported - # platforms, i.e. Windows: - # $ cmp expected actual - # differ: byte 30, line 1 - # $ diff expected actual - # 1c1 - # < main = putStrLn "hello world" - # --- - # > main = putStrLn "hello world" - run diff -w expected actual - elif [[ -n "${REINSTALL_GHC:-}" ]]; then + run diff -w expected actual-stage3 + fi +} + +function test_hadrian() { + # Extract the bindist tar built by the build job, if there is one + # (bindists are always named $BIN_DIST_NAME.tar.xz). If there is no + # bindist, we're testing an in-tree build (e.g. REINSTALL_GHC). + local dist_dir="_build/bindist" + local bindist_tar="${BIN_DIST_NAME:-}.tar.xz" + if [[ -n "${BIN_DIST_NAME:-}" && -e "$bindist_tar" ]]; then + mkdir -p "$dist_dir" + tar -xf "$bindist_tar" -C "$dist_dir" + fi + + check_release_build + + # GitLab's log viewer renders ANSI colors, but stdout here is not a tty, + # so the driver must be told to emit them. + RUNTEST_ARGS="${RUNTEST_ARGS:-} --force-colors" + + if [[ -n "${REINSTALL_GHC:-}" ]]; then info "Running with reinstall GHC $REINSTALL_GHC" run_hadrian \ test \ @@ -1168,6 +1206,7 @@ case ${1:-help} in res=0 time_it "stage1 tests" test_hadrian_stage1 || res=$? exit $res ;; + smoke_test) time_it "smoke-test" smoke_test ;; run_hadrian) shift; run_hadrian "$@" ;; perf_test) run_perf_test ;; abi_test) abi_test ;; ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -13,6 +13,7 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiWayIf #-} import Data.Aeson as A import qualified Data.Map as Map @@ -113,26 +114,49 @@ data Opsys = Linux LinuxDistro | Darwin | FreeBSD14 - | Windows deriving (Eq) + | Windows deriving (Eq, Show) data LinuxDistro = Debian13 | Debian12 - | Debian12Wine - | Debian13Riscv | Debian11 - | Debian11Js | Fedora43 - | Ubuntu2404LoongArch64 | Ubuntu2404 | Ubuntu2204 | Alpine312 | Alpine323 - | AlpineWasm | Rocky8 - deriving (Eq) - -data Arch = Amd64 | AArch64 | I386 + deriving (Eq, Show) + +data Arch = Amd64 | AArch64 | I386 | RiscV64 | LoongArch | Wasm32 | JavaScript + deriving (Show) + +-- | Describes what the docker image is for: the development flavour of the +-- build environment, orthogonal to the image's own architecture ('Arch'). +-- E.g. @FlavorRiscV@ denotes the image that carries the RISC-V cross +-- toolchain. +data ImageFlavor + = FlavorVanilla + | FlavorRiscV + | FlavorLoongArch + | FlavorWine + | FlavorEmscripten + | FlavorWasm + deriving (Eq, Show) + +-- | OS element of a configure target triple: this is the OS of the *target* +-- platform, not the build environment (that is 'Opsys'/'LinuxDistro'). +data TargetOs + = TargetOsLinuxGnu + | TargetOsGhcjs + | TargetOsMingw32 + | TargetOsWasi + deriving (Eq, Show) + +data TargetPlatform = TargetPlatform + { tpArch :: Arch -- ^ target architecture, e.g. 'RiscV64' + , tpOs :: TargetOs -- ^ target OS, e.g. 'TargetOsLinuxGnu' + } data BignumBackend = Native | Gmp deriving Eq @@ -161,8 +185,8 @@ data BuildConfig , withAssertions :: Bool , withNuma :: Bool , withZstd :: Bool - , crossTarget :: Maybe String - , crossStage :: Maybe Int + , crossTarget :: Maybe TargetPlatform + , crossStages :: Maybe CrossStages , crossEmulator :: CrossEmulator , configureWrapper :: Maybe String , fullyStatic :: Bool @@ -184,7 +208,7 @@ configureArgsStr bc = unwords $ ["--enable-unregisterised"| unregisterised bc ] ++ ["--disable-tables-next-to-code" | not (tablesNextToCode bc) ] ++ ["--with-intree-gmp" | Just _ <- [crossTarget bc] ] - ++ ["--with-system-libffi" | crossTarget bc == Just "wasm32-wasi" ] + ++ ["--with-system-libffi" | (tpOs <$> crossTarget bc) == Just TargetOsWasi ] ++ ["--enable-ipe-data-compression" | withZstd bc ] ++ ["--enable-strict-ghc-toolchain-check"] @@ -233,7 +257,7 @@ vanilla = BuildConfig , withNuma = False , withZstd = False , crossTarget = Nothing - , crossStage = Nothing + , crossStages = Nothing , crossEmulator = NoEmulator , configureWrapper = Nothing , fullyStatic = False @@ -280,17 +304,54 @@ static = vanilla { fullyStatic = True } staticNativeInt :: BuildConfig staticNativeInt = static { bignumBackend = Native } -crossConfig :: String -- ^ target triple +-- | The cross stages a build produces binary distributions for +data CrossStages + = -- | Builds a cross-compiler (build == host, host /= target): + -- its bindist runs on the build host. + Stage2 + | -- | Implies `Stage2` and additionally builds a cross-compiled compiler + -- (build /= host, host == target). + Stage2And3 + deriving stock (Eq, Ord) + +crossConfig :: TargetPlatform -- ^ target platform -> CrossEmulator -- ^ emulator for testing -> Maybe String -- ^ Configure wrapper + -> CrossStages -- ^ final cross stages to build bindists for -> BuildConfig -crossConfig triple emulator configure_wrapper = - vanilla { crossTarget = Just triple - , crossStage = Just 2 +crossConfig targetPlatform emulator configure_wrapper crossStage = + vanilla { crossTarget = Just targetPlatform + , crossStages = Just crossStage , crossEmulator = emulator , configureWrapper = configure_wrapper } +-- | The docker image flavour of a build, derived from its cross target +-- (the image must carry the target's toolchain) or 'FlavorVanilla' for +-- plain builds. +buildFlavor :: BuildConfig -> ImageFlavor +buildFlavor bc = maybe FlavorVanilla flavorOf (crossTarget bc) + where + flavorOf :: TargetPlatform -> ImageFlavor + flavorOf TargetPlatform{ tpArch = arch, tpOs = os } = case (arch, os) of + (AArch64, TargetOsLinuxGnu) -> FlavorVanilla + (AArch64, TargetOsMingw32) -> FlavorWine + (RiscV64, TargetOsLinuxGnu) -> FlavorRiscV + (LoongArch, TargetOsLinuxGnu) -> FlavorLoongArch + (Wasm32, TargetOsWasi) -> FlavorWasm + (JavaScript, TargetOsGhcjs) -> FlavorEmscripten + _ -> error $ + "flavorOf: no image flavour for target " ++ show arch ++ "/" ++ show os + +-- | The configure target triple the build system consumes, e.g. +-- @"riscv64-linux-gnu"@. +renderTriple :: TargetPlatform -> String +renderTriple TargetPlatform{ tpArch = arch, tpOs = os } = case os of + TargetOsLinuxGnu -> archName arch ++ "-linux-gnu" + TargetOsGhcjs -> archName arch ++ "-unknown-ghcjs" + TargetOsMingw32 -> archName arch ++ "-unknown-mingw32" + TargetOsWasi -> archName arch ++ "-wasi" + llvm :: BuildConfig llvm = vanilla { llvmBootstrap = True, testsuiteWays = ["llvm", "optllvm"] } @@ -312,16 +373,16 @@ usePerfProfilingTestsuite bc = bc { testsuiteUsePerf = True } -- | These tags have to match what we call the runners on gitlab runnerTag :: Arch -> Opsys -> String -runnerTag arch (Linux _) = - case arch of - Amd64 -> "x86_64-linux" - AArch64 -> "aarch64-linux" - I386 -> "x86_64-linux" -runnerTag AArch64 Darwin = "aarch64-darwin" -runnerTag Amd64 Darwin = "x86_64-darwin-m1" -runnerTag Amd64 Windows = "new-x86_64-windows" -runnerTag Amd64 FreeBSD14 = "x86_64-freebsd14" -runnerTag _ _ = error "Invalid arch/opsys" +runnerTag arch opsys = case (arch, opsys) of + (Amd64, Linux{}) -> "x86_64-linux" + (AArch64, Linux{}) -> "aarch64-linux" + (I386, Linux{}) -> "x86_64-linux" + (AArch64, Darwin) -> "aarch64-darwin" + (Amd64, Darwin) -> "x86_64-darwin-m1" + (Amd64, Windows) -> "new-x86_64-windows" + (Amd64, FreeBSD14) -> "x86_64-freebsd14" + _ -> error $ "runnerTag: no runner for " + ++ show arch ++ "/" ++ show opsys tags :: Arch -> Opsys -> BuildConfig -> [String] 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 runnerPerfTag :: Arch -> Opsys -> String runnerPerfTag arch sys = runnerTag arch sys ++ "-perf" --- These names are used to find the docker image so they have to match what is --- in the docker registry. +-- | These names are used to find the docker image so they have to match what +-- is in the docker registry. distroName :: LinuxDistro -> String distroName Debian13 = "deb13" distroName Debian12 = "deb12" distroName Debian11 = "deb11" -distroName Debian11Js = "deb11-emsdk-closure" -distroName Debian13Riscv = "deb13-riscv" -distroName Debian12Wine = "deb12-wine" distroName Fedora43 = "fedora43" -distroName Ubuntu2404LoongArch64 = "ubuntu24_04-loongarch" distroName Ubuntu2204 = "ubuntu22_04" distroName Ubuntu2404 = "ubuntu24_04" distroName Alpine312 = "alpine3_12" distroName Alpine323 = "alpine3_23" -distroName AlpineWasm = "alpine3_23-wasm" distroName Rocky8 = "rocky8" -opsysName :: Opsys -> String -opsysName (Linux distro) = "linux-" ++ distroName distro -opsysName Darwin = "darwin" -opsysName FreeBSD14 = "freebsd14" -opsysName Windows = "windows" +-- | The distro tag used in docker image names, extended with the toolchain +-- suffix of the image flavour (e.g. 'Debian13'' + 'FlavorRiscV' -> +-- @"deb13-riscv"@). +distroImageTag :: LinuxDistro -> ImageFlavor -> String +distroImageTag distro flavor = distroName distro ++ flavorSuffix flavor + where + flavorSuffix :: ImageFlavor -> String + flavorSuffix FlavorVanilla = "" + flavorSuffix FlavorRiscV = "-riscv" + flavorSuffix FlavorLoongArch = "-loongarch" + flavorSuffix FlavorWine = "-wine" + flavorSuffix FlavorEmscripten = "-emsdk-closure" + flavorSuffix FlavorWasm = "-wasm" + +-- | OS name as it appears for job identity and docker image tags, qualified +-- by the working image flavour if any (e.g. @"linux-deb13-riscv"@). +opsysNameWithFlavor :: Opsys -> ImageFlavor -> String +opsysNameWithFlavor (Linux distro) flavor = "linux-" ++ distroImageTag distro flavor +opsysNameWithFlavor opsys _ = opsysName opsys + where + opsysName :: Opsys -> String + opsysName (Linux distro) = "linux-" ++ distroName distro + opsysName Darwin = "darwin" + opsysName FreeBSD14 = "freebsd14" + opsysName Windows = "windows" archName :: Arch -> String -archName Amd64 = "x86_64" -archName AArch64 = "aarch64" -archName I386 = "i386" +archName Amd64 = "x86_64" +archName AArch64 = "aarch64" +archName I386 = "i386" +archName RiscV64 = "riscv64" +archName LoongArch = "loongarch64" +archName Wasm32 = "wasm32" +archName JavaScript = "javascript" binDistName :: Arch -> Opsys -> BuildConfig -> String -binDistName arch opsys bc = "ghc-" ++ testEnv arch opsys bc +binDistName arch opsys bc = "ghc-" ++ testEnvWith (archName arch) opsys bc + +-- | Name of the stage3 (target-platform) bindist. +-- +-- Because that bindist lives on its target, it is named as if built natively +-- on the target: target architecture, the OS of the job, and no +-- cross/toolchain flavour markers. +stage3BinDistName :: Opsys -> BuildConfig -> Maybe String +stage3BinDistName opsys bc + | buildsTargetBindist + , Just TargetPlatform{ tpArch = arch } <- crossTarget bc + = Just $ binDistName arch opsys (bc { crossTarget = Nothing }) + | otherwise + = Nothing + where + -- Whether any bindist produced by this build configuration runs on its + -- target platform rather than on the build host. + buildsTargetBindist :: Bool + buildsTargetBindist = crossStages bc == Just Stage2And3 -- | Test env should create a string which changes whenever the 'BuildConfig' changes. -- Either the change is reflected by modifying the flavourString or directly (as is -- the case for settings which affect environment variables) testEnv :: Arch -> Opsys -> BuildConfig -> String -testEnv arch opsys bc = +testEnv arch = testEnvWith (archName arch) + +testEnvWith :: String -> Opsys -> BuildConfig -> String +testEnvWith archN opsys bc = intercalate "-" $ concat - [ [ archName arch - , opsysName opsys ] + [ [ archN + , opsysNameWithFlavor opsys (buildFlavor bc) ] , ["int_" ++ bignumString (bignumBackend bc) | bignumBackend bc /= Gmp] , ["unreg" | unregisterised bc ] , ["numa" | withNuma bc ] , ["zstd" | withZstd bc ] , ["no_tntc" | not (tablesNextToCode bc) ] - , ["cross_"++triple | Just triple <- pure $ crossTarget bc ] + , ["cross_"++renderTriple ct | Just ct <- pure $ crossTarget bc ] , [flavourString (mkJobFlavour bc)] ] @@ -397,18 +498,18 @@ flavourString (Flavour base trans) = base_string base ++ concatMap (("+" ++) . f flavour_string TextWithSIMDUTF = "text_simdutf" -- The path to the docker image (just for linux builders) -dockerImage :: Arch -> Opsys -> Maybe String -dockerImage arch (Linux distro) = +dockerImage :: Arch -> Opsys -> BuildConfig -> Maybe String +dockerImage arch (Linux distro) bc = Just image where image = mconcat [ "registry.gitlab.haskell.org/ghc/ci-images/" , archName arch , "-linux-" - , distroName distro + , distroImageTag distro (buildFlavor bc) , ":$DOCKER_REV" ] -dockerImage _ _ = Nothing +dockerImage _ _ _ = Nothing ----------------------------------------------------------------------------- -- Platform-specific variables @@ -449,8 +550,8 @@ brokenTest :: TestName -- ^ test name -> Variables brokenTest test _why = "BROKEN_TESTS" =: test -opsysVariables :: Arch -> Opsys -> Variables -opsysVariables _ FreeBSD14 = mconcat +opsysVariables :: Arch -> Opsys -> ImageFlavor -> Variables +opsysVariables _ FreeBSD14 _ = mconcat [ -- N.B. we use iconv from ports as I see linker errors when we attempt -- to use the "native" iconv embedded in libc as suggested by the -- porting guide [1]. @@ -464,8 +565,8 @@ opsysVariables _ FreeBSD14 = mconcat , "FETCH_GHC_VERSION" =: "9.10.3" , "CABAL_INSTALL_VERSION" =: "3.14.2.0" ] -opsysVariables arch (Linux distro) = distroVariables arch distro -opsysVariables AArch64 (Darwin {}) = mconcat +opsysVariables arch (Linux distro) flavor = distroVariables arch distro flavor +opsysVariables AArch64 (Darwin {}) _ = mconcat [ "NIX_SYSTEM" =: "aarch64-darwin" , "MACOSX_DEPLOYMENT_TARGET" =: "11.0" , "LANG" =: "en_US.UTF-8" @@ -473,7 +574,7 @@ opsysVariables AArch64 (Darwin {}) = mconcat -- Fonts can't be installed on darwin , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" ] -opsysVariables Amd64 (Darwin {}) = mconcat +opsysVariables Amd64 (Darwin {}) _ = mconcat [ "NIX_SYSTEM" =: "x86_64-darwin" , "MACOSX_DEPLOYMENT_TARGET" =: "11.0" -- Only Sierra and onwards supports clock_gettime. See #12858 @@ -486,16 +587,15 @@ opsysVariables Amd64 (Darwin {}) = mconcat , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi" -- Fonts can't be installed on darwin , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" - ] -opsysVariables _ (Windows {}) = mconcat +opsysVariables _ (Windows {}) _ = mconcat [ "MSYSTEM" =: "CLANG64" , "LANG" =: "en_US.UTF-8" , "CABAL_INSTALL_VERSION" =: "3.14.2.0" , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs" , "FETCH_GHC_VERSION" =: "9.10.3" ] -opsysVariables _ _ = mempty +opsysVariables _ _ _ = mempty alpineVariables :: Arch -> Variables alpineVariables arch = mconcat $ @@ -514,10 +614,13 @@ alpineVariables arch = mconcat $ ] -distroVariables :: Arch -> LinuxDistro -> Variables -distroVariables arch Alpine312 = alpineVariables arch -distroVariables arch Alpine323 = alpineVariables arch -distroVariables _ _ = mempty +distroVariables :: Arch -> LinuxDistro -> ImageFlavor -> Variables +distroVariables arch Alpine312 _ = alpineVariables arch +-- The wasm image runs its own (libc-free) toolchain, so the alpine broken +-- tests do not apply to it. +distroVariables _ Alpine323 FlavorWasm = mempty +distroVariables arch Alpine323 _ = alpineVariables arch +distroVariables _ _ _ = mempty ----------------------------------------------------------------------------- -- Cache settings, what to cache and when can we share the cache @@ -529,8 +632,8 @@ data Cache } -- The cache doesn't depend on the BuildConfig because we only cache the cabal store. -mkCacheKey :: Arch -> Opsys -> String -mkCacheKey arch opsys = archName arch <> "-" <> opsysName opsys <> "-$CACHE_REV" +mkCacheKey :: Arch -> Opsys -> ImageFlavor -> String +mkCacheKey arch opsys flavor = archName arch <> "-" <> opsysNameWithFlavor opsys flavor <> "-$CACHE_REV" instance ToJSON Cache where toJSON Cache {..} = object @@ -815,7 +918,7 @@ data Job , jobArtifacts :: Artifacts , jobCache :: Cache , jobRules :: OnOffRules - , jobPlatform :: (Arch, Opsys) + , jobPlatform :: (Arch, Opsys, ImageFlavor) } instance Show Job where @@ -845,18 +948,23 @@ job :: Arch -> Opsys -> BuildConfig -> BuildAndTestJob Job job arch opsys buildConfig = MkBuildAndTestJob { buildJob = NamedJob { name = jobName, jobInfo = Job { jobScript = jobBuildScript, jobStage = "full-build", jobNeeds = [("hadrian-ghc-in-ghci", False)], jobArtifacts = buildJobArtifacts, ..} } - , testJobs = - NamedJob { name = jobName <> "-test", jobInfo = testJobInfo } : - [ NamedJob - { name = jobName <> "-testperf" - , jobInfo = testJobInfo - { jobVariables = testJobInfo.jobVariables <> "RUNTEST_ARGS" =: "--config perf_path=perf" - , jobTags = [runnerPerfTag arch opsys] - } } - | testsuiteUsePerf buildConfig ] } + , testJobs = if + -- if we need an emulator to run the testsuite, we skip for now + -- in future we should run the testsuite using an appropriate target + -- platform runner + | Emulator {} <- crossEmulator buildConfig -> [] + | otherwise -> + NamedJob { name = jobName <> "-test", jobInfo = testJobInfo } : + [ NamedJob + { name = jobName <> "-testperf" + , jobInfo = testJobInfo + { jobVariables = testJobInfo.jobVariables <> "RUNTEST_ARGS" =: "--config perf_path=perf" + , jobTags = [runnerPerfTag arch opsys] + } } + | testsuiteUsePerf buildConfig ] } where testJobInfo = Job {jobScript = jobTestScript, jobNeeds = [(jobName, True)], jobStage = "testing", jobArtifacts = testJobArtifacts, ..} - jobPlatform = (arch, opsys) + jobPlatform = (arch, opsys, buildFlavor buildConfig) jobRules = emptyRules jobName @@ -864,7 +972,7 @@ job arch opsys buildConfig = jobTags = tags arch opsys buildConfig - jobDockerImage = dockerImage arch opsys + jobDockerImage = dockerImage arch opsys buildConfig jobTestScript | Windows <- opsys @@ -883,7 +991,7 @@ job arch opsys buildConfig = = [ "bash .gitlab/ci.sh setup" , "bash .gitlab/ci.sh configure" , "bash .gitlab/ci.sh build_hadrian" - , "bash .gitlab/ci.sh test_hadrian_stage1" + , "bash " ++ testStep ] | otherwise = [ "find libraries -name config.sub -exec cp config.sub {} \\;" | Darwin == opsys ] ++ @@ -892,9 +1000,16 @@ job arch opsys buildConfig = [ ".gitlab/ci.sh setup" , ".gitlab/ci.sh configure" , ".gitlab/ci.sh build_hadrian" - , ".gitlab/ci.sh test_hadrian_stage1" + , testStep ] + -- Cross jobs with a working emulator smoke-test the bindist under the + -- emulator as a separate step after the build; everything else runs the + -- testsuite. + testStep + | Emulator _ <- crossEmulator buildConfig = ".gitlab/ci.sh smoke_test" + | otherwise = ".gitlab/ci.sh test_hadrian_stage1" + jobAfterScript | Windows <- opsys = [ "bash .gitlab/ci.sh save_cache" @@ -911,16 +1026,20 @@ job arch opsys buildConfig = jobFlavour = mkJobFlavour buildConfig jobVariables = mconcat - [ opsysVariables arch opsys + [ opsysVariables arch opsys (buildFlavor buildConfig) , "TEST_ENV" =: testEnv arch opsys buildConfig , "BIN_DIST_NAME" =: binDistName arch opsys buildConfig + , maybe mempty ("BIN_DIST_NAME_STAGE3" =:) (stage3BinDistName opsys buildConfig) , "BUILD_FLAVOUR" =: flavourString jobFlavour , "BIGNUM_BACKEND" =: bignumString (bignumBackend buildConfig) , "CONFIGURE_ARGS" =: configureArgsStr buildConfig , "INSTALL_CONFIGURE_ARGS" =: "--enable-strict-ghc-toolchain-check" , maybe mempty ("CONFIGURE_WRAPPER" =:) (configureWrapper buildConfig) - , maybe mempty ("CROSS_TARGET" =:) (crossTarget buildConfig) - , maybe mempty (("CROSS_STAGE" =:) . show) (crossStage buildConfig) + , maybe mempty (("CROSS_TARGET" =:) . renderTriple) (crossTarget buildConfig) + , case crossStages buildConfig of + Nothing -> mempty + Just Stage2 -> "FINAL_CROSS_STAGE" =: "2" + Just Stage2And3 -> "FINAL_CROSS_STAGE" =: "3" , case crossEmulator buildConfig of NoEmulator -- we need an emulator but it isn't set. Won't run the testsuite @@ -952,6 +1071,8 @@ job arch opsys buildConfig = trim :: String -> String trim = dropWhileEnd isSpace . dropWhile isSpace + stage3Artifacts = maybe [] (\n -> [n ++ ".tar.xz"]) (stage3BinDistName opsys buildConfig) + -- Keep in sync with the exclude list in `function clean()` in -- `.gitlab/ci.sh`! buildJobArtifacts = Artifacts @@ -961,6 +1082,7 @@ job arch opsys buildConfig = , "junit.xml" , "unexpected-test-output.tar.gz" , "_build/stage1/haddock-timing-files"] + ++ stage3Artifacts , artifactsWhen = ArtifactsAlways } @@ -980,7 +1102,7 @@ job arch opsys buildConfig = Cache { cachePaths = [], cacheKey = "no-caching" } | otherwise = Cache { cachePaths = [ "cabal-cache", "toolchain" ] - , cacheKey = mkCacheKey arch opsys + , cacheKey = mkCacheKey arch opsys (buildFlavor buildConfig) } @@ -1212,7 +1334,6 @@ debian_x86 = , disableValidate (standardBuilds Amd64 (Linux Debian12)) , disableValidate (standardBuilds Amd64 (Linux Debian13)) - -- Validate only builds , fastCI (validateBuilds Amd64 (Linux validate_debian) debug) , validateBuilds Amd64 (Linux validate_debian) nativeInt @@ -1335,16 +1456,17 @@ alpine_aarch64 = [ cross_jobs :: [JobGroup Job] cross_jobs = [ -- x86 -> aarch64 - validateBuilds Amd64 (Linux Debian13) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing) + validateBuilds Amd64 (Linux Debian13) (crossConfig (TargetPlatform AArch64 TargetOsLinuxGnu) (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing Stage2) - -- x86_64 -> riscv - , addValidateRule RiscV (validateBuilds Amd64 (Linux Debian13Riscv) (crossConfig "riscv64-linux-gnu" (Emulator "qemu-riscv64 -L /usr/riscv64-linux-gnu") Nothing)) + -- Stage2: x86_64 (build/host) -> riscv64 (target) + -- Stage3: x86_64 (build) -> riscv64 (host/target) + , addValidateRule RiscV (validateBuilds Amd64 (Linux Debian13) (crossConfig (TargetPlatform RiscV64 TargetOsLinuxGnu) (Emulator "qemu-riscv64 -L /usr/riscv64-linux-gnu") Nothing Stage2And3)) -- x86_64 -> loongarch64 - , addValidateRule LoongArch64 (validateBuilds Amd64 (Linux Ubuntu2404LoongArch64) (crossConfig "loongarch64-linux-gnu" (Emulator "qemu-loongarch64 -L /usr/loongarch64-linux-gnu") Nothing)) + , addValidateRule LoongArch64 (validateBuilds Amd64 (Linux Ubuntu2404) (crossConfig (TargetPlatform LoongArch TargetOsLinuxGnu) (Emulator "qemu-loongarch64 -L /usr/loongarch64-linux-gnu") Nothing Stage2)) -- Javascript - , addValidateRule JSBackend (validateBuilds Amd64 (Linux Debian11Js) javascriptConfig) + , addValidateRule JSBackend (validateBuilds Amd64 (Linux Debian11) javascriptConfig) -- Wasm , make_wasm_jobs wasm_build_config @@ -1356,13 +1478,13 @@ cross_jobs = [ -- Linux Aarch64 (Wine + FEX + MSYS64) => Windows Aarch64 , makeWinArmJobs $ addValidateRule WinArm64 - (validateBuilds AArch64 (Linux Debian12Wine) winAarch64Config) + (validateBuilds AArch64 (Linux Debian12) winAarch64Config) , makeWinArmJobs $ addValidateRule WinArm64LLVM - (validateBuilds AArch64 (Linux Debian12Wine) (winAarch64Config {llvmBootstrap = True})) + (validateBuilds AArch64 (Linux Debian12) (winAarch64Config {llvmBootstrap = True})) ] where - javascriptConfig = (crossConfig "javascript-unknown-ghcjs" (NoEmulatorNeeded TimeoutIncrease) (Just "emconfigure")) + javascriptConfig = (crossConfig (TargetPlatform JavaScript TargetOsGhcjs) (NoEmulatorNeeded TimeoutIncrease) (Just "emconfigure") Stage2) { bignumBackend = Native } makeWinArmJobs = modifyJobs @@ -1401,7 +1523,7 @@ cross_jobs = [ llvm_prefix = "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-" cflags = "-fuse-ld=" ++ llvm_prefix ++ "ld --rtlib=compiler-rt" - winAarch64Config = (crossConfig "aarch64-unknown-mingw32" (Emulator "/opt/wine-arm64ec-msys2-deb12/bin/wine") Nothing) + winAarch64Config = (crossConfig (TargetPlatform AArch64 TargetOsMingw32) (Emulator "/opt/wine-arm64ec-msys2-deb12/bin/wine") Nothing Stage2) { bignumBackend = Native } make_wasm_jobs cfg = @@ -1411,10 +1533,10 @@ cross_jobs = [ . setVariable "HADRIAN_ARGS" "--docs=no-sphinx-pdfs --docs=no-sphinx-man" . delVariable "INSTALL_CONFIGURE_ARGS" ) - $ addValidateRule WasmBackend $ validateBuilds Amd64 (Linux AlpineWasm) cfg + $ addValidateRule WasmBackend $ validateBuilds Amd64 (Linux Alpine323) cfg wasm_build_config = - (crossConfig "wasm32-wasi" (NoEmulatorNeeded NoTimeoutIncrease) Nothing) + (crossConfig (TargetPlatform Wasm32 TargetOsWasi) (NoEmulatorNeeded NoTimeoutIncrease) Nothing Stage2) { hostFullyStatic = True , buildFlavour = Release -- TODO: This needs to be validate but wasm backend doesn't pass yet , textWithSIMDUTF = True @@ -1439,8 +1561,8 @@ job_groups = -- Platform mapping for GHCup metadata --------------------------------------------------------------------- -mkPlatform :: Arch -> Opsys -> String -mkPlatform arch opsys = archName arch <> "-" <> opsysName opsys +mkPlatform :: (Arch, Opsys, ImageFlavor) -> String +mkPlatform (arch, opsys, flavor) = archName arch <> "-" <> opsysNameWithFlavor opsys flavor -- | This map tells us for a specific arch/opsys combo what the job name for -- 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 -- for now we only support buildJob platform equals testjob platform -- if this restriction were to be lifted, we just had to indicate that the -- specific testjob runs on a different platform - [ (uncurry mkPlatform (jobPlatform (jobInfo (buildJob j))), j) + [ (mkPlatform (jobPlatform (jobInfo (buildJob j))), j) | (sel -> Just j) <- job_groups ] ===================================== .gitlab/jobs.yaml ===================================== @@ -547,7 +547,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -563,9 +563,9 @@ "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", "CROSS_TARGET": "aarch64-unknown-mingw32", "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", + "FINAL_CROSS_STAGE": "2", "HADRIAN_ARGS": "--docs=none", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", @@ -631,7 +631,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -647,90 +647,9 @@ "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", - "CROSS_TARGET": "aarch64-unknown-mingw32", - "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", - "HADRIAN_ARGS": "--docs=none", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", - "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "MergeObjsCmd": "", - "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm", - "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy", - "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump", - "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib", - "RUNTEST_ARGS": "-e config.timeout=900", - "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size", - "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings", - "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip", - "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm", - "TEST_WAYS": "", - "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres" - } - }, - "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "2 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "aarch64-linux-deb12-wine-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm" - } - ], - "rules": [ - { - "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)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "aarch64-linux" - ], - "variables": { - "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar", - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", - "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", "CROSS_TARGET": "aarch64-unknown-mingw32", "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", + "FINAL_CROSS_STAGE": "2", "HADRIAN_ARGS": "--docs=none", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", @@ -750,87 +669,6 @@ "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres" } }, - "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "2 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "aarch64-linux-deb12-wine-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate" - } - ], - "rules": [ - { - "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)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "aarch64-linux" - ], - "variables": { - "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar", - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate", - "BUILD_FLAVOUR": "validate", - "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", - "CROSS_TARGET": "aarch64-unknown-mingw32", - "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", - "HADRIAN_ARGS": "--docs=none", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", - "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "MergeObjsCmd": "", - "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm", - "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy", - "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump", - "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib", - "RUNTEST_ARGS": "-e config.timeout=900", - "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size", - "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings", - "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip", - "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate", - "TEST_WAYS": "", - "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres" - } - }, "aarch64-linux-deb13-validate": { "after_script": [ ".gitlab/ci.sh save_cache", @@ -2126,7 +1964,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -2142,9 +1980,9 @@ "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", "CROSS_TARGET": "aarch64-unknown-mingw32", "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", + "FINAL_CROSS_STAGE": "2", "HADRIAN_ARGS": "--docs=none", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", @@ -2211,7 +2049,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -2227,9 +2065,9 @@ "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", "CROSS_TARGET": "aarch64-unknown-mingw32", "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", + "FINAL_CROSS_STAGE": "2", "HADRIAN_ARGS": "--docs=none", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", @@ -2250,170 +2088,6 @@ "XZ_OPT": "-9" } }, - "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "8 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "aarch64-linux-deb12-wine-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm" - } - ], - "rules": [ - { - "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "aarch64-linux" - ], - "variables": { - "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar", - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm", - "BUILD_FLAVOUR": "validate+llvm", - "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", - "CROSS_TARGET": "aarch64-unknown-mingw32", - "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", - "HADRIAN_ARGS": "--docs=none", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", - "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "MergeObjsCmd": "", - "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm", - "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy", - "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump", - "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib", - "RUNTEST_ARGS": "-e config.timeout=900", - "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size", - "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings", - "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip", - "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate+llvm", - "TEST_WAYS": "", - "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres", - "XZ_OPT": "-9" - } - }, - "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "8 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "aarch64-linux-deb12-wine-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb12-wine:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "nightly-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate" - } - ], - "rules": [ - { - "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "aarch64-linux" - ], - "variables": { - "AR": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ar", - "BIGNUM_BACKEND": "native", - "BIN_DIST_NAME": "ghc-aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate", - "BUILD_FLAVOUR": "validate", - "CC": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "CFLAGS": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "CROSS_EMULATOR": "/opt/wine-arm64ec-msys2-deb12/bin/wine", - "CROSS_STAGE": "2", - "CROSS_TARGET": "aarch64-unknown-mingw32", - "CXX": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang++", - "HADRIAN_ARGS": "--docs=none", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "LD": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld", - "LLVMAS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-clang", - "MergeObjsCmd": "", - "NM": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-nm", - "OBJCOPY": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objcopy", - "OBJDUMP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-objdump", - "RANLIB": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-llvm-ranlib", - "RUNTEST_ARGS": "-e config.timeout=900", - "SIZE": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-size", - "STRINGS": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strings", - "STRIP": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-strip", - "TEST_ENV": "aarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate", - "TEST_WAYS": "", - "USER_CONF_CC_OPTS_STAGE2": "-fuse-ld=/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-ld --rtlib=compiler-rt", - "WindresCmd": "/opt/llvm-mingw-linux/bin/aarch64-w64-mingw32-windres", - "XZ_OPT": "-9" - } - }, "nightly-aarch64-linux-deb13-validate": { "after_script": [ ".gitlab/ci.sh save_cache", @@ -3873,8 +3547,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -3937,8 +3611,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -4004,8 +3678,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -4068,8 +3742,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -4135,8 +3809,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -4199,8 +3873,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -4267,8 +3941,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_STAGE": "2", "CROSS_TARGET": "javascript-unknown-ghcjs", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate", @@ -4331,8 +4005,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_STAGE": "2", "CROSS_TARGET": "javascript-unknown-ghcjs", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate", @@ -4761,7 +4435,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -4773,72 +4447,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_STAGE": "2", - "CROSS_TARGET": "aarch64-linux-gnu", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "-e config.timeout=900", - "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate", - "TEST_WAYS": "", - "XZ_OPT": "-9" - } - }, - "nightly-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "8 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "x86_64-linux-deb13-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "nightly-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate" - } - ], - "rules": [ - { - "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "x86_64-linux" - ], - "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_STAGE": "2", "CROSS_TARGET": "aarch64-linux-gnu", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate", @@ -5420,75 +5030,11 @@ "artifacts": { "expire_in": "8 weeks", "paths": [ - "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate.tar.xz", - "junit.xml", - "unexpected-test-output.tar.gz", - "_build/stage1/haddock-timing-files" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "x86_64-linux-deb13-riscv-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13-riscv:$DOCKER_REV", - "needs": [ - { - "artifacts": false, - "job": "hadrian-ghc-in-ghci" - } - ], - "rules": [ - { - "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" - ], - "stage": "full-build", - "tags": [ - "x86_64-linux" - ], - "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu", - "CROSS_STAGE": "2", - "CROSS_TARGET": "riscv64-linux-gnu", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "-e config.timeout=900", - "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", - "TEST_WAYS": "", - "XZ_OPT": "-9" - } - }, - "nightly-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "8 weeks", - "paths": [ + "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate.tar.xz", "junit.xml", - "unexpected-test-output.tar.gz" + "unexpected-test-output.tar.gz", + "_build/stage1/haddock-timing-files", + "ghc-riscv64-linux-deb13-validate.tar.xz" ], "reports": { "junit": "junit.xml" @@ -5505,8 +5051,8 @@ "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13-riscv:$DOCKER_REV", "needs": [ { - "artifacts": true, - "job": "nightly-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate" + "artifacts": false, + "job": "hadrian-ghc-in-ghci" } ], "rules": [ @@ -5519,20 +5065,22 @@ "sudo chown ghc:ghc -R .", ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" + ".gitlab/ci.sh build_hadrian", + ".gitlab/ci.sh smoke_test" ], - "stage": "testing", + "stage": "full-build", "tags": [ "x86_64-linux" ], "variables": { "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", + "BIN_DIST_NAME_STAGE3": "ghc-riscv64-linux-deb13-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu", - "CROSS_STAGE": "2", "CROSS_TARGET": "riscv64-linux-gnu", + "FINAL_CROSS_STAGE": "3", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", @@ -7221,7 +6769,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -7233,72 +6781,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu", - "CROSS_STAGE": "2", - "CROSS_TARGET": "loongarch64-linux-gnu", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "-e config.timeout=900", - "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", - "TEST_WAYS": "", - "XZ_OPT": "-9" - } - }, - "nightly-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "8 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "x86_64-linux-ubuntu24_04-loongarch-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu24_04-loongarch:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "nightly-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate" - } - ], - "rules": [ - { - "if": "(\"true\" == \"true\") && ($RELEASE_JOB != \"yes\") && ($NIGHTLY)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "x86_64-linux" - ], - "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu", - "CROSS_STAGE": "2", "CROSS_TARGET": "loongarch64-linux-gnu", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", @@ -11718,8 +11202,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -11781,8 +11265,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -11848,8 +11332,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -11912,8 +11396,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -11979,8 +11463,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -12043,8 +11527,8 @@ "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release+host_fully_static+text_simdutf", "BUILD_FLAVOUR": "release+host_fully_static+text_simdutf", "CONFIGURE_ARGS": "--enable-unregisterised --with-intree-gmp --with-system-libffi --enable-strict-ghc-toolchain-check", - "CROSS_STAGE": "2", "CROSS_TARGET": "wasm32-wasi", + "FINAL_CROSS_STAGE": "2", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", "RUNTEST_ARGS": "", @@ -12110,8 +11594,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_STAGE": "2", "CROSS_TARGET": "javascript-unknown-ghcjs", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate", @@ -12173,8 +11657,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONFIGURE_WRAPPER": "emconfigure", - "CROSS_STAGE": "2", "CROSS_TARGET": "javascript-unknown-ghcjs", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate", @@ -12596,7 +12080,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -12608,71 +12092,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_STAGE": "2", - "CROSS_TARGET": "aarch64-linux-gnu", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "-e config.timeout=900", - "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate", - "TEST_WAYS": "" - } - }, - "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "2 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "x86_64-linux-deb13-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate" - } - ], - "rules": [ - { - "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)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "x86_64-linux" - ], - "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-cross_aarch64-linux-gnu-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-aarch64 -L /usr/aarch64-linux-gnu", - "CROSS_STAGE": "2", "CROSS_TARGET": "aarch64-linux-gnu", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb13-cross_aarch64-linux-gnu-validate", @@ -13249,7 +12670,8 @@ "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate.tar.xz", "junit.xml", "unexpected-test-output.tar.gz", - "_build/stage1/haddock-timing-files" + "_build/stage1/haddock-timing-files", + "ghc-riscv64-linux-deb13-validate.tar.xz" ], "reports": { "junit": "junit.xml" @@ -13281,7 +12703,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -13290,74 +12712,12 @@ "variables": { "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", + "BIN_DIST_NAME_STAGE3": "ghc-riscv64-linux-deb13-validate", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu", - "CROSS_STAGE": "2", - "CROSS_TARGET": "riscv64-linux-gnu", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "-e config.timeout=900", - "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", - "TEST_WAYS": "" - } - }, - "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "2 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "x86_64-linux-deb13-riscv-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13-riscv:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate" - } - ], - "rules": [ - { - "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)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "x86_64-linux" - ], - "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-riscv64 -L /usr/riscv64-linux-gnu", - "CROSS_STAGE": "2", "CROSS_TARGET": "riscv64-linux-gnu", + "FINAL_CROSS_STAGE": "3", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate", @@ -15021,7 +14381,7 @@ ".gitlab/ci.sh setup", ".gitlab/ci.sh configure", ".gitlab/ci.sh build_hadrian", - ".gitlab/ci.sh test_hadrian_stage1" + ".gitlab/ci.sh smoke_test" ], "stage": "full-build", "tags": [ @@ -15033,71 +14393,8 @@ "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu", - "CROSS_STAGE": "2", - "CROSS_TARGET": "loongarch64-linux-gnu", - "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", - "RUNTEST_ARGS": "-e config.timeout=900", - "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", - "TEST_WAYS": "" - } - }, - "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate-test": { - "after_script": [ - ".gitlab/ci.sh save_cache", - ".gitlab/ci.sh save_test_output", - ".gitlab/ci.sh clean", - "cat ci_timings.txt" - ], - "allow_failure": false, - "artifacts": { - "expire_in": "2 weeks", - "paths": [ - "junit.xml", - "unexpected-test-output.tar.gz" - ], - "reports": { - "junit": "junit.xml" - }, - "when": "always" - }, - "cache": { - "key": "x86_64-linux-ubuntu24_04-loongarch-$CACHE_REV", - "paths": [ - "cabal-cache", - "toolchain" - ] - }, - "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-ubuntu24_04-loongarch:$DOCKER_REV", - "needs": [ - { - "artifacts": true, - "job": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate" - } - ], - "rules": [ - { - "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)", - "when": "on_success" - } - ], - "script": [ - "sudo chown ghc:ghc -R .", - ".gitlab/ci.sh setup", - ".gitlab/ci.sh configure", - ".gitlab/ci.sh test_hadrian" - ], - "stage": "testing", - "tags": [ - "x86_64-linux" - ], - "variables": { - "BIGNUM_BACKEND": "gmp", - "BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", - "BUILD_FLAVOUR": "validate", - "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", - "CROSS_EMULATOR": "qemu-loongarch64 -L /usr/loongarch64-linux-gnu", - "CROSS_STAGE": "2", "CROSS_TARGET": "loongarch64-linux-gnu", + "FINAL_CROSS_STAGE": "2", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", ===================================== changelog.d/stage3-cross-bindists ===================================== @@ -0,0 +1,6 @@ +section: packaging +synopsis: Fully cross-compiled binary distributions +mrs: !15417 +issues: #26924 +description: Hadrian can now build cross-compiled binary distributions that run + 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 targetBindist :: BindistConfig targetBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage2 } +-- | Folder relative to build root ("bindist" or "bindist-stage3") +bindistFolder :: BindistConfig -> FilePath +bindistFolder conf | executable_stage conf == Stage2 = "bindist-stage3" +bindistFolder _conf = "bindist" -- | The implicit bindist config, if we don't know any better. implicitBindistConfig :: Action BindistConfig ===================================== hadrian/src/Oracles/Setting.hs ===================================== @@ -7,7 +7,7 @@ module Oracles.Setting ( -- * Helpers ghcCanonVersion, cmdLineLengthLimit, targetSupportsRPaths, topDirectory, libsuf, ghcVersionStage, shPath, perStageTarget, crossStage, queryTarget, queryPerStageTargetSpec, - isHostStage, + isHostStage, libraryStageFor, -- ** Target platform things anyTargetOs, anyTargetArch, anyHostOs, @@ -262,3 +262,22 @@ crossStage st = do st_target <- perStageTarget (succStage st) st_host <- perStageTarget st return (targetPlatformTriple st_target /= targetPlatformTriple st_host) + +-- | The 'Stage' whose libraries and package database are used by a compiler +-- built at (or running from) @compilerStage@. +-- +-- Usually @compilerStage@ itself, but differs in two cases: +-- +-- * 'Stage0' has no library or package database of its own; it uses 'Stage1'\'s. +-- * A cross compiler uses the successor stage's libraries (built for the +-- target, not the host). +libraryStageFor :: Stage -> Action Stage +libraryStageFor compilerStage = do + isCross <- + if compilerStage < Stage3 + then + crossStage compilerStage + else return False + return $ case compilerStage of + Stage0 {} -> Stage1 + _ -> if isCross then succStage compilerStage else compilerStage ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -13,66 +13,100 @@ import Rules.Generate (generateSettings) import Settings import qualified System.Directory.Extra as IO import Settings.Program (programContext) -import Target -import Utilities import BindistConfig {- Note [Binary distributions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Hadrian produces binary distributions under: +Hadrian produces binary distributions that run on the build host architecture +(build == host, target == host || target /= host) under: <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz -It is generated by creating an archive from: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/ +For stage3 (build /= host, host == target) bindists, a separate parent folder +is used: + <build root>/bindist-stage3/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz -It does so by following the steps below. +While regular bindists are usual same-arch compilers or cross-compilers, stage3 +bindists are cross-compiled compilers. -- make sure we have a complete stage 2 compiler + haddock +Bindists are generated by creating an archive from: + <build root>/<bindist|bindist-stage3>/ghc-<X>.<Y>.<Z>-<arch>-<os>/ + +Stage2 cross-compilers are a by-product of creating stage3 cross-compiled +compilers. The additional build dir (bindist-stage3) lets us keep both, such +that we can build them in one go on CI. +Configuration files (e.g. configure script and default.host.target) differ in +this case and keeping both targets separated also saves us some headache +dealing with stale files. + +This table introduces variables to simplify the following step descriptions: + +| compiler kind | <bindist-dir> | <executable-stage-dir> | <library-stage-dir> | +|------------------|----------------|------------------------|---------------------| +| native | bindist | stage1/ | stage1/ | +| cross-compiler | bindist | stage1/ | stage2/ | +| cross-compiled | bindist-stage3 | stage2/ | stage2/ | + +These are the steps to build a bindist: + +- make sure we have a complete compiler + libraries + haddock for the stage(s) + to bundle - copy the specific binaries which should be in the bindist to the bin folder and add the version suffix: - <build root>/stage1/bin/xxxx + <build root>/<executable-stage-dir>/bin/xxxx to - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx-<VER> + where the optional <target>- prefix is the cross triple for cross-compilers. - create symlink (or bash) wrapper from unversioned to versioned executable: - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx points to: - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx-<VER> - copy the lib directories of the compiler we built: - <build root>/stage1/lib + <build root>/<library-stage-dir>/lib + to + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib + +- for cross-compilers, overwrite the implicitly copied (previous step) + <build root>/<library-stage-dir>/lib/targets/default.target file with that of + the executable stage. I.e. copy: + <build root>/<executable-stage-dir>/lib/targets/default.target to - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib/targets/default.target + +- overwrite the also implicitly copied (with <build root>/<library-stage-dir>/lib) + <build root>/<library-stage-dir>/lib/settings file with a regenerated one, such + that the bindist's compiler is described. - copy the generated docs (user guide, haddocks, etc): - <build root>/docs/ + <build root>/doc/ to - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/docs/ + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/doc/ -- use autoreconf to generate a `configure` script from - aclocal.m4 and distrib/configure.ac, that we move to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure +- use autoreconf to generate a staged `configure` script in + <build root>/<executable-stage>/distrib + that we move to: + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure - write a (fixed) Makefile capable of supporting 'make install' to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/Makefile + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/Makefile - write some (fixed) supporting bash code for the wrapper scripts to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program> + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program> where <program> is the name of the executable that the bash file will help wrapping. -- copy supporting configure/make related files - (see @bindistInstallFiles@) to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/<file> +- copy supporting configure/make related files (see @bindistInstallFiles@) to: + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/<file> - create a .tar.xz archive of the directory: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/ + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/ at - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz Note [Wrapper scripts and binary distributions] @@ -159,12 +193,12 @@ buildBinDistDir root conf@BindistConfig{..} = do distDir <- Context.distDir (vanillaContext library_stage rts) let ghcBuildDir = root -/- stageString library_stage - bindistFilesDir = root -/- "bindist" -/- ghcVersionPretty + bindistFilesDir = root -/- bindistFolder conf -/- ghcVersionPretty ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform rtsIncludeDir = distDir -/- "include" - -- We create the bindist directory at <root>/bindist/ghc-X.Y.Z-platform/ - -- and populate it with Stage2 build results + -- We create the bindist directory at <root>/<bindistFolder>/ghc-X.Y.Z-platform/ + -- and populate it with build results createDirectory bindistFilesDir createDirectory (bindistFilesDir -/- "bin") createDirectory (bindistFilesDir -/- "lib") @@ -225,12 +259,19 @@ buildBinDistDir root conf@BindistConfig{..} = do copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir + -- For cross-compilers we need to override the `targets/default.target` + -- file that was implicitly copied from the library stage, because this + -- describes a target native compiler (stage3) and not a cross-compiler. + when (library_stage /= executable_stage) $ + copyFile (root -/- stageString executable_stage -/- "lib" -/- "targets" -/- "default.target") + (bindistFilesDir -/- "lib" -/- "targets" -/- "default.target") + -- Regenerate settings file without LibDir. For bindists, LibDir should -- be derived from topdir at runtime such that the GHC binary is -- relocatable. The package DB is always at "package.conf.d" relative to -- the lib dir, matching the known bindist layout. let bindistSettings = bindistFilesDir -/- "lib" -/- "settings" - bindistContext = vanillaContext library_stage compiler + bindistContext = vanillaContext executable_stage compiler bindistSettingsContent <- interpretInContext bindistContext $ generateSettings library_stage bindistSettings False "package.conf.d" writeFileAtomic bindistSettings bindistSettingsContent @@ -244,10 +285,10 @@ buildBinDistDir root conf@BindistConfig{..} = do -- -- N.B. the ghc-pkg executable may be prefixed with a target triple -- (c.f. #20267). - - -- Not going to work for cross - ghcPkgName <- programName (vanillaContext Stage1 ghcPkg) - ghcPkgProg <- exeSpawnPath (bindistFilesDir -/- "bin" -/- ghcPkgName) + -- Stage1 is also correct for cross-compiler scenarios, because it runs on + -- the build host. + ghcPkgPath <- programPath =<< programContext Stage1 ghcPkg + ghcPkgProg <- exeSpawnPath ghcPkgPath cmdExe ghcPkgProg ["recache", "--package-db", bindistFilesDir -/- "lib" -/- "package.conf.d" ] :: Action () @@ -345,8 +386,8 @@ bindistRules = do buildBinDistDir root cfg phony "binary-dist-dir-cross" $ buildBinDistDir root crossBindist - -- MP: Not working yet - -- phony "binary-dist-dir-stage3" $ buildBinDistDir root targetBindist + + phony "binary-dist-dir-stage3" $ buildBinDistDir root targetBindist let buildBinDist compressor = do win_host <- isWinHost @@ -378,49 +419,27 @@ bindistRules = do phony (name <> "-dist-xz") $ mk_bindist Xz phony "binary-dist-cross" $ buildBinDistX "binary-dist-dir-cross" "bindist" Xz - phony "binary-dist-stage3" $ buildBinDistX "binary-dist-dir-stage3" "bindist" Xz - - -- Prepare binary distribution configure script - -- (generated under <ghc root>/distrib/configure by 'autoreconf') - root -/- "bindist" -/- "ghc-*" -/- "configure" %> \configurePath -> do - need ["distrib" -/- "configure.ac"] - ghcRoot <- topDirectory - copyFile (ghcRoot -/- "aclocal.m4") (ghcRoot -/- "distrib" -/- "aclocal.m4") - copyDirectory (ghcRoot -/- "m4") (ghcRoot -/- "distrib") - - -- Note [Autoreconf unix paths from ACLOCAL_PATH] - -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -- On Windows, autoreconf fails when the ACLOCAL_PATH env variable contains Windows- - -- style paths. This happens because MSYS2 automatically converts env variables to - -- Windows-style paths. To fix this, we convert ACLOCAL_PATH back to Unix style. - -- This is done both in the boot Python script and here when building a bindist. - -- See Note [MSYS paths]. - win_host <- isWinHost - aclocalPathMay <- if win_host then getEnv "ACLOCAL_PATH" else pure Nothing - let env = [ AddEnv "ACLOCAL_PATH" (windowsToMsysPathList aclocalPath) - | Just aclocalPath <- [aclocalPathMay] ] - - buildWithCmdOptions env $ - target (vanillaContext Stage1 ghc) (Autoreconf $ ghcRoot -/- "distrib") [] [] - -- We clean after ourselves, moving the configure script we generated in - -- our bindist dir - removeFile (ghcRoot -/- "distrib" -/- "aclocal.m4") - removeDirectory (ghcRoot -/- "distrib" -/- "m4") - - moveFile (ghcRoot -/- "distrib" -/- "configure") configurePath - - -- Generate the Makefile that enables the "make install" part - root -/- "bindist" -/- "ghc-*" -/- "Makefile" %> \makefilePath -> do - top <- topDirectory - copyFile (top -/- "hadrian" -/- "bindist" -/- "Makefile") makefilePath - - -- Copy various configure-related files needed for a working - -- './configure [...] && make install' workflow - -- (see the list of files needed in the 'binary-dist' rule above, before - -- creating the archive). - forM_ bindistInstallFiles $ \file -> - root -/- "bindist" -/- "ghc-*" -/- file %> \dest -> do - copyFile (fixup file) dest + phony "binary-dist-stage3" $ buildBinDistX "binary-dist-dir-stage3" "bindist-stage3" Xz + + forM_ [normalBindist, targetBindist] $ \bindistCfg -> do + let bindistFolderName = bindistFolder bindistCfg + root -/- bindistFolderName -/- "ghc-*" -/- "configure" %> \configurePath -> do + let distribConfigure = root -/- stageString (executable_stage bindistCfg) -/- "distrib" -/- "configure" + need [distribConfigure] + copyFile distribConfigure configurePath + + -- Copy the Makefile that enables the "make install" part + root -/- bindistFolderName -/- "ghc-*" -/- "Makefile" %> \makefilePath -> do + top <- topDirectory + copyFile (top -/- "hadrian" -/- "bindist" -/- "Makefile") makefilePath + + -- Copy various configure-related files needed for a working + -- './configure [...] && make install' workflow + -- (see the list of files needed in the 'binary-dist' rule above, before + -- creating the archive). + forM_ bindistInstallFiles $ \file -> + root -/- bindistFolderName -/- "ghc-*" -/- file %> \dest -> do + copyFile (fixup file) dest where fixup f | f `elem` ["INSTALL", "README"] = "distrib" -/- f @@ -500,7 +519,7 @@ pkgToWrappers stage pkg = do -- These are the packages which we want to expose to the user and hence -- there are wrappers installed in the bindist. | pkg `elem` [hpcBin, haddock, hp2ps, hsc2hs, ghc, ghcPkg] - -> (:[]) <$> (programName =<< programContext Stage1 pkg) + -> (:[]) <$> (programName =<< programContext stage pkg) | otherwise -> pure [] wrapper :: Stage -> FilePath -> Action String @@ -553,7 +572,7 @@ ghciScriptWrapper stage = do -- | Create a wrapper script calls the executable given as first argument createVersionWrapper :: Stage -> Package -> String -> FilePath -> Action () createVersionWrapper executable_stage pkg versioned_exe install_path = do - ghcPath <- builderPath (Ghc CompileCWithGhc (succStage executable_stage)) + ghcPath <- builderPath (Ghc CompileCWithGhc executable_stage) top <- topDirectory let version_wrapper_dir = top -/- "hadrian" -/- "bindist" -/- "cwrappers" 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 import GHC.Toolchain as Toolchain hiding (HsCpp(HsCpp)) import GHC.Platform.ArchOS import Settings.Program (ghcWithInterpreter) -import UserSettings (finalStage) -- | Track this file to rebuild generated files whenever it changes. trackGenerateHs :: Expr () @@ -252,36 +251,36 @@ generateRules = do (root -/- "ghc-stage2") <~+ ghcWrapper Stage2 (root -/- "ghc-stage3") <~+ ghcWrapper Stage3 - forM_ allStages $ \stage -> do - let prefix = root -/- stageString stage -/- "lib" - -- For the finalStage, we generate settings for that stage. For - -- others we look at the next stage. Why? Because cross-compilers - -- require libs from the successor stage, otherwise they are - -- compiled for the host and not the target. - stage' = if stage /= finalStage then succStage stage else stage - go gen file = generate file (semiEmptyTarget stage') gen + forM_ allStages $ \compilerStage -> do + let + prefix = root -/- stageString compilerStage -/- "lib" + go gen file = generate file (semiEmptyTarget compilerStage) gen (prefix -/- "settings") %> \out -> do - let get_pkg_db stg = packageDbPath (PackageDbLoc stg Final) - -- For cross, LibDir points to stage' lib dir, so pkgDb must also - -- be relative to stage' lib dir. - isCross <- crossStage stage - let libStage = case stage of - Stage0 {} -> Stage1 - _ -> if isCross then stage' else stage - pkgDb <- get_pkg_db libStage + libraryStage <- libraryStageFor compilerStage + pkgDb <- packageDbPath (PackageDbLoc libraryStage Final) -- addTrailingPathSeparator needed: makeRelativeNoSysLink uses -- splitPath where "lib" and "lib/" are distinct components. let libTopDir = addTrailingPathSeparator $ - if isCross - then root -/- stageString stage' -/- "lib" - else prefix + if isStage0 compilerStage + then prefix + else root -/- stageString libraryStage -/- "lib" relPkgDb = makeRelativeNoSysLink libTopDir pkgDb - go (generateSettings libStage out True relPkgDb) out - (prefix -/- "targets" -/- "default.target") %> \out -> go (show <$> expr (perStageTarget (succStage stage))) out + go (generateSettings libraryStage out True relPkgDb) out + (prefix -/- "targets" -/- "default.target") %> \out -> + go (generateTargetFile compilerStage) out where file <~+ gen = file %> \out -> generate out emptyTarget gen >> makeExecutable out + generateTargetFile :: Stage -> Expr String + generateTargetFile compilerStage = do + isCrossStage <- if compilerStage < Stage3 + then expr (crossStage compilerStage) + else pure False + libraryStage <- expr (libraryStageFor compilerStage) + tgt <- expr (perStageTarget libraryStage) + pure $ show tgt { tgtLocallyExecutable = not isCrossStage } + -- TODO: Use the Types, Luke! (drop partial function) -- We sometimes need to evaluate expressions that do not require knowing all -- information about the context. In this case, we don't want to know anything. @@ -413,6 +412,7 @@ templateRules = do bindistRules :: Rules () bindistRules = do + root <- buildRootRules templateRule ("mk" -/- "project.mk") $ mconcat [ interpolateSetting "ProjectName" ProjectName , interpolateSetting "ProjectVersion" ProjectVersion @@ -424,45 +424,146 @@ bindistRules = do , interpolateVar "HostOS_CPP" $ fmap cppify $ interp $ queryHost queryOS - , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple - , interpolateVar "TargetPlatform_CPP" $ cppify <$> getTarget targetPlatformTriple - , interpolateVar "TargetArch_CPP" $ cppify <$> getTarget queryArch - , interpolateVar "TargetOS_CPP" $ cppify <$> getTarget queryOS - , interpolateVar "LLVMTarget" $ getTarget tgtLlvmTarget - ] - templateRule ("distrib" -/- "configure.ac") $ mconcat - [ interpolateSetting "ConfiguredEmsdkVersion" EmsdkVersion - , interpolateVar "CrossCompilePrefix" $ do - crossCompiling <- interp $ getFlag CrossCompiling - tpf <- setting TargetPlatformFull - pure $ if crossCompiling then tpf <> "-" else "" - , interpolateVar "LeadingUnderscore" $ yesNo <$> getTarget tgtSymbolsHaveLeadingUnderscore - , interpolateSetting "LlvmMaxVersion" LlvmMaxVersion - , interpolateSetting "LlvmMinVersion" LlvmMinVersion - , interpolateVar "LlvmTarget" $ getTarget tgtLlvmTarget - , interpolateSetting "ProjectVersion" ProjectVersion - , interpolateVar "EnableDistroToolchain" $ interp (staged (lookupStageBuildConfig "settings-use-distro-mingw")) - , interpolateVar "TablesNextToCode" $ yesNo <$> getTarget tgtTablesNextToCode - , interpolateVar "TargetHasLibm" $ yesNo <$> getTarget tgtHasLibm - , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple - , interpolateVar "BuildPlatform" $ interp $ queryBuild targetPlatformTriple - , interpolateVar "HostPlatform" $ interp $ queryHost targetPlatformTriple - , interpolateVar "TargetWordBigEndian" $ getTarget isBigEndian - , interpolateVar "TargetWordSize" $ getTarget wordSize - , interpolateVar "Unregisterised" $ yesNo <$> getTarget tgtUnregisterised - , interpolateVar "UseLibdw" $ fmap yesNo $ interp $ staged (fmap (isJust . tgtRTSWithLibdw) . perStageTarget) - , interpolateVar "UseLibffiForAdjustors" $ yesNo <$> getTarget tgtUseLibffiForAdjustors - , interpolateVar "BaseUnitId" $ bindistUnitId base - , interpolateVar "GhcUnitId" $ bindistUnitId compiler - , interpolateVar "GhcInternalUnitId" $ bindistUnitId ghcInternal - , interpolateVar "GhcWithSMP" $ yesNo <$> targetSupportsSMP Stage2 - , interpolateVar "TargetPlatformFull" (setting TargetPlatformFull) - , interpolateVar "BuildPlatformFull" (setting BuildPlatformFull) - , interpolateVar "HostPlatformFull" (setting HostPlatformFull) + -- Stage2 always targets the target (as in build, host, target) + -- architecture. Thus, we can use it constant stage here to find + -- information about the target architecture. + , interpolateVar "TargetPlatform" $ getTarget Stage2 targetPlatformTriple + , interpolateVar "TargetPlatform_CPP" $ cppify <$> getTarget Stage2 targetPlatformTriple + , interpolateVar "TargetArch_CPP" $ cppify <$> getTarget Stage2 queryArch + , interpolateVar "TargetOS_CPP" $ cppify <$> getTarget Stage2 queryOS + , interpolateVar "LLVMTarget" $ getTarget Stage2 tgtLlvmTarget ] + forM_ [Stage1, Stage2] $ \stage -> + let crossStageInterps = Interpolations $ do + isCrossStage <- crossStage stage + targetPlatform <- setting TargetPlatformFull + -- For cross-compiled compilers we need to pretend that they were + -- build on the target. For regular compilers we can assume that: + -- build == host == target + buildPlatform <- + if isCrossStage + then + interp $ queryBuild targetPlatformTriple + else getTarget stage targetPlatformTriple + hostPlatform <- + if isCrossStage + then + interp $ queryHost targetPlatformTriple + else getTarget stage targetPlatformTriple + -- The unit ids of the libraries shipped with this bindist. For + -- cross compilers these are the target-architecture libraries' + -- unit ids (#27919), which the implicit bindist config encodes. + baseUnitId <- bindistUnitId base + ghcUnitId <- bindistUnitId compiler + ghcInternalUnitId <- bindistUnitId ghcInternal + buildPlatformFull <- if isCrossStage then setting BuildPlatformFull else setting TargetPlatformFull + hostPlatformFull <- if isCrossStage then setting HostPlatformFull else setting TargetPlatformFull + pure + [ ("CrossCompilePrefix", if isCrossStage then targetPlatform <> "-" else "") + , ("TargetPlatformFull", targetPlatform) + , ("BuildPlatform", buildPlatform) + , ("HostPlatform", hostPlatform) + , ("BaseUnitId", baseUnitId) + , ("GhcUnitId", ghcUnitId) + , ("GhcInternalUnitId", ghcInternalUnitId) + , ("BuildPlatformFull", buildPlatformFull) + , ("HostPlatformFull", hostPlatformFull) + ] + in templateRuleFrom + ("distrib" -/- "configure.ac" <.> "in") + (root -/- stageString stage -/- "distrib" -/- "configure.ac") + $ mconcat + [ interpolateSetting "ConfiguredEmsdkVersion" EmsdkVersion + , interpolateVar "LeadingUnderscore" $ yesNo <$> getLibTarget stage tgtSymbolsHaveLeadingUnderscore + , interpolateSetting "LlvmMaxVersion" LlvmMaxVersion + , interpolateSetting "LlvmMinVersion" LlvmMinVersion + , interpolateVar "LlvmTarget" $ getLibTarget stage tgtLlvmTarget + , interpolateSetting "ProjectVersion" ProjectVersion + , interpolateVar "EnableDistroToolchain" $ interp (staged (lookupStageBuildConfig "settings-use-distro-mingw")) + , interpolateVar "TablesNextToCode" $ yesNo <$> getLibTarget stage tgtTablesNextToCode + , interpolateVar "TargetHasLibm" $ yesNo <$> getLibTarget stage tgtHasLibm + , interpolateVar "TargetPlatform" $ getLibTarget stage targetPlatformTriple + , interpolateVar "TargetWordBigEndian" $ getLibTarget stage isBigEndian + , interpolateVar "TargetWordSize" $ getLibTarget stage wordSize + , interpolateVar "Unregisterised" $ yesNo <$> getLibTarget stage tgtUnregisterised + , interpolateVar "UseLibdw" $ yesNo <$> getLibTarget stage (isJust . tgtRTSWithLibdw) + , interpolateVar "UseLibffiForAdjustors" $ yesNo <$> getLibTarget stage tgtUseLibffiForAdjustors + , interpolateVar "GhcWithSMP" $ yesNo <$> libStageSupportsSMP stage + , crossStageInterps + ] + + -- Note [Bindist configure autoconf srcdir] + -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -- We can build binary distributions for several stages. These may need + -- different `configure` scripts. To avoid race-conditions on temporary + -- autoconf files (including `configure`), we generate those in the stages' + -- dedicated build folders (`_build/<stage>`). + -- + -- The generated `configure.ac` lives in `_build/<stage>/distrib`, while the + -- m4 macros are one level up in _build/<stage>/m4. This mirrors the + -- repository layout, where `distrib/configure.ac.in` refers to the macros + -- via AC_CONFIG_MACRO_DIRS([../m4]) (i.e. the repository's top-level `m4/`). + -- Keeping the same relative layout means the template needs no change. + -- + -- We deliberately do *not* copy the top-level `aclocal.m4`: its m4_include + -- directives are relative to the directory aclocal first ran in. Instead we + -- run autoreconf next to the staged `configure.ac` and let aclocal pick the + -- macro directory up from its AC_CONFIG_MACRO_DIRS([../m4]), regenerating + -- `aclocal.m4` with `../m4/...` includes that resolve from there. + -- + -- The other copied files need to be present for autoconf and/or autoreconf. + forM_ [Stage1, Stage2] $ \stage -> do + let stageDir = root -/- stageString stage + distribDir = stageDir -/- "distrib" + + forM_ ["config.sub", "config.guess", "install-sh"] $ \f -> + distribDir -/- f %> \out -> do + top <- topDirectory + copyFile (top -/- f) out + + stageDir -/- "m4/*.m4" %> \out -> do + top <- topDirectory + copyFile (top -/- "m4" -/- takeFileName out) out + + distribDir -/- "configure" %> \_ -> do + top <- topDirectory + m4Files <- getDirectoryFiles (top -/- "m4") ["*.m4"] + need $ [ distribDir -/- "configure.ac" + , distribDir -/- "config.sub" + , distribDir -/- "config.guess" + , distribDir -/- "install-sh" + ] + ++ [ stageDir -/- "m4" -/- takeFileName f | f <- m4Files ] + + -- Note [Autoreconf unix paths from ACLOCAL_PATH] + -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -- On Windows, autoreconf fails when the ACLOCAL_PATH env variable + -- contains Windows-style paths. MSYS2 auto-converts env vars to + -- Windows-style, so we convert ACLOCAL_PATH back to Unix style here. + -- This is done both in the boot Python script and here when + -- building a bindist. + -- See Note [MSYS paths]. + win_host <- isWinHost + aclocalPathMay <- if win_host then getEnv "ACLOCAL_PATH" else pure Nothing + let env = [ AddEnv "ACLOCAL_PATH" (windowsToMsysPathList aclocalPath) + | Just aclocalPath <- [aclocalPathMay] ] + + buildWithCmdOptions env $ + target (vanillaContext stage ghc) (Autoreconf distribDir) [] [] where interp = interpretInContext (semiEmptyTarget Stage2) - getTarget = interp . queryTarget Stage2 + getTarget stage = interp . queryTarget stage + getLibTarget executableStage f = do + libStage <- libraryStageFor executableStage + getTarget libStage f + -- | 'targetSupportsSMP' lifted to the library stage (see 'getLibTarget'). + libStageSupportsSMP stage = do + libStage <- libraryStageFor stage + targetSupportsSMP libStage + -- | The unit id of @pkg@ in the stage whose libraries ship with the + -- bindist, i.e. the library stage of the implicit bindist config. For + -- cross compilers these are the target-architecture unit ids, as + -- reported by @ghc --info@ (#27919). bindistUnitId pkg = do stage <- library_stage <$> implicitBindistConfig pkgUnitId stage pkg @@ -487,6 +588,14 @@ ghcWrapper stage = do -- | Generate settings file, optionally including @LibDir@. -- +-- Describes the compiler whose stage is the ambient 'Expr' context +-- (available here as @executableStage@ via 'getStage'). The @libraryStage@ +-- argument is the stage whose lib dir holds the libraries the described +-- compiler links against — used both for the @base@ unit-id lookup and for +-- the @LibDir@ entry. It usually equals @executableStage@ but differs when +-- the compiler links against libraries from a different stage (cross +-- compilers, or the Stage0 bootstrap compiler using Stage1's libraries). +-- -- @rel_pkg_db@: package DB path relative to the lib dir (e.g. -- "package.conf.d"). Callers supply the correct relative path. For bindists -- the layout is known statically; for in-tree builds callers compute it. For @@ -496,7 +605,7 @@ ghcWrapper stage = do generateSettings :: Stage -> FilePath -> Bool -> FilePath -> Expr String generateSettings libraryStage settingsFile includeLibDir rel_pkg_db = do ctx <- getContext - stage <- getStage + executableStage <- getStage -- These are the units supplied in the target package database, which can -- differ from the host units linked into a cross compiler. @@ -504,25 +613,18 @@ generateSettings libraryStage settingsFile includeLibDir rel_pkg_db = do ghc_unit_id <- expr $ pkgUnitId libraryStage compiler ghc_internal_unit_id <- expr $ pkgUnitId libraryStage ghcInternal - -- For cross compilers, LibDir points to the succeeding stage's lib dir - -- (which contains the target architecture's libraries). For non-cross, - -- it points to the preceding stage's lib dir as usual. - let compilerStage = predStage stage -- the GHC that builds packages in this stage - isCrossLibDir <- expr $ crossStage compilerStage - let stage_dir_stage = if isCrossLibDir then stage else compilerStage - - -- addTrailingPathSeparator is needed because makeRelativeNoSysLink uses - -- splitPath internally, where "lib" and "lib/" are distinct components. - lib_topDir :: FilePath <- expr $ addTrailingPathSeparator <$> stageLibPath stage_dir_stage + lib_topDir :: FilePath <- expr $ addTrailingPathSeparator <$> stageLibPath libraryStage let rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir settings <- traverse sequence $ - [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit, Context.stage = compilerStage }))) - , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter compilerStage) - -- Hard-coded as Cabal queries these to determine way support and we - -- need to always advertise all ways when bootstrapping. - -- The settings file is generated at install time when installing a bindist. - , ("RTS ways", unwords . map show . Set.toList <$> getRtsWays) + [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit }))) + , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter executableStage) + -- Advertise the RTS ways that will actually ship with the compiler + -- described by this settings file, i.e. the ways the @libraryStage@ + -- RTS is built with. + -- The settings file is regenerated at install time when installing a bindist. + , ("RTS ways", unwords . map show . Set.toList <$> + expr (interpretInContext (vanillaContext libraryStage rts) getRtsWays)) , ("Relative Global Package DB", pure rel_pkg_db) , ("base unit-id", pure base_unit_id) , ("Project Unit Id", pure ghc_unit_id) ===================================== hadrian/src/Settings/Packages.hs ===================================== @@ -112,8 +112,11 @@ packageArgs = do , compilerStageOption ghcDebugAssertions ? arg "-DDEBUG" ] , builder (Cabal Flags) ? mconcat - [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter" - , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `cabalFlag` "internal-interpreter" + -- In the context of cross-compilation, stage2 runs on the target + -- and thus can - if the architecture supports it - provide the + -- interpreter natively. + [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1, stage2]] `cabalFlag` "interpreter" + , andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter" , ifM stage0 -- We build a threaded stage 1 if the bootstrapping compiler -- supports it. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1543f834476ca41338df87e74dfa347... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1543f834476ca41338df87e74dfa347... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Marge Bot (@marge-bot)