[Git][ghc/ghc][wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL] 4 commits: ci: Introduce CROSS_STAGE variable
Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC Commits: 330bb8ba by Matthew Pickering at 2025-12-28T18:04:15+01:00 ci: Introduce CROSS_STAGE variable In preparation for building and testing stage3 bindists we introduce the CROSS_STAGE variable which is used by a CI job to determine what kind of bindist the CI job should produce. At the moment we are only using CROSS_STAGE=2 but in the future we will have some jobs which set CROSS_STAGE=3 to produce native bindists for a target, but produced by a cross compiler, which can be tested on by another CI job on the native platform. CROSS_STAGE=2: Build a normal cross compiler bindist CROSS_STAGE=3: Build a stage 3 bindist, one which is a native compiler and library for the target - - - - - 4d4c9cf9 by Matthew Pickering at 2025-12-28T18:04:15+01:00 hadrian: Refactor system-cxx-std-lib rules0 I noticed a few things wrong with the hadrian rules for `system-cxx-std-lib` rules. * For `text` there is an ad-hoc check to depend on `system-cxx-std-lib` outside of `configurePackage`. * The `system-cxx-std-lib` dependency is not read from cabal files. * Recache is not called on the packge database after the `.conf` file is generated, a more natural place for this rule is `registerRules`. Treating this uniformly like other packages is complicated by it not having any source code or a cabal file. However we can do a bit better by reporting the dependency firstly in `PackageData` and then needing the `.conf` file in the same place as every other package in `configurePackage`. Fixes #25303 - - - - - 29388ee2 by Sven Tennie at 2025-12-28T18:05:11+01:00 Increase timeout for emulators Test runs with emulators naturally take longer than on native machines. Generate jobs.yml - - - - - 0ae15ae6 by Sven Tennie at 2025-12-28T18:05:11+01:00 ghc: Distinguish between having an interpreter and having an internal one Otherwise, we fail with warnings when compiling tools. Actually, these are related but different things: - ghc can run an interpreter (either internal or external) - ghc is compiled with an internal interpreter - - - - - 12 changed files: - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - ghc/GHC/Driver/Session/Mode.hs - ghc/GHCi/UI.hs - ghc/Main.hs - ghc/ghc-bin.cabal.in - hadrian/src/Hadrian/Haskell/Cabal/Parse.hs - hadrian/src/Hadrian/Haskell/Cabal/Type.hs - hadrian/src/Rules/Generate.hs - hadrian/src/Rules/Register.hs - hadrian/src/Settings/Packages.hs Changes: ===================================== .gitlab/ci.sh ===================================== @@ -63,6 +63,9 @@ Hadrian build system Environment variables affecting both build systems: 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) VERBOSE Set to non-empty for verbose build output RUNTEST_ARGS Arguments passed to runtest.py MSYSTEM (Windows-only) Which platform to build from (CLANG64). @@ -548,6 +551,12 @@ function build_hadrian() { export XZ_OPT="${XZ_OPT:-} -T$cores" fi + case "${CROSS_STAGE:-2}" in + 2) BINDIST_TARGET="binary-dist";; + 3) BINDIST_TARGET="binary-dist-stage3";; + *) fail "Unknown CROSS_STAGE, must be 2 or 3";; + esac + if [[ -n "${REINSTALL_GHC:-}" ]]; then run_hadrian build-cabal -V else @@ -557,7 +566,7 @@ function build_hadrian() { mv _build/reloc-bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" ;; *) - run_hadrian test:all_deps binary-dist -V + run_hadrian test:all_deps $BINDIST_TARGET mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" ;; esac ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -20,6 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B import qualified Data.Set as S import System.Environment import Data.List +import Data.Char (isSpace) {- Note [Generating the CI pipeline] @@ -155,6 +156,7 @@ data BuildConfig , withNuma :: Bool , withZstd :: Bool , crossTarget :: Maybe String + , crossStage :: Maybe Int , crossEmulator :: CrossEmulator , configureWrapper :: Maybe String , fullyStatic :: Bool @@ -223,6 +225,7 @@ vanilla = BuildConfig , withNuma = False , withZstd = False , crossTarget = Nothing + , crossStage = Nothing , crossEmulator = NoEmulator , configureWrapper = Nothing , fullyStatic = False @@ -273,6 +276,7 @@ crossConfig :: String -- ^ target triple -> BuildConfig crossConfig triple emulator configure_wrapper = vanilla { crossTarget = Just triple + , crossStage = Just 2 , crossEmulator = emulator , configureWrapper = configure_wrapper } @@ -880,6 +884,7 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} } , "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) , case crossEmulator buildConfig of NoEmulator -- we need an emulator but it isn't set. Won't run the testsuite @@ -889,14 +894,24 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} } Emulator s -> "CROSS_EMULATOR" =: s NoEmulatorNeeded -> mempty , if withNuma buildConfig then "ENABLE_NUMA" =: "1" else mempty - , let runtestArgs = + , let testTimeoutArg = + case crossEmulator buildConfig of + -- Emulators are naturally slower than native machines. + -- Triple the default of 300. + Emulator _ -> "-e config.timeout=900" :: String + _ -> mempty + runtestArgs = + testTimeoutArg : [ "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity" | validateNonmovingGc buildConfig ] - in "RUNTEST_ARGS" =: unwords runtestArgs + in "RUNTEST_ARGS" =: (trim . unwords) runtestArgs , if testsuiteUsePerf buildConfig then "RUNTEST_ARGS" =: "--config perf_path=perf" else mempty ] + trim :: String -> String + trim = dropWhileEnd isSpace . dropWhile isSpace + -- Keep in sync with the exclude list in `function clean()` in -- `.gitlab/ci.sh`! jobArtifacts = Artifacts ===================================== .gitlab/jobs.yaml ===================================== @@ -377,6 +377,7 @@ "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", @@ -388,7 +389,7 @@ "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": "", + "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", @@ -458,6 +459,7 @@ "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", @@ -469,7 +471,7 @@ "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": "", + "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", @@ -1046,6 +1048,7 @@ "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", @@ -1057,7 +1060,7 @@ "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": "", + "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", @@ -1128,6 +1131,7 @@ "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", @@ -1139,7 +1143,7 @@ "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": "", + "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", @@ -1723,6 +1727,7 @@ "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", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", @@ -1788,6 +1793,7 @@ "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", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", @@ -1853,6 +1859,7 @@ "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", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", @@ -2045,9 +2052,10 @@ "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": "", + "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate", "XZ_OPT": "-9" } @@ -2111,6 +2119,7 @@ "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONFIGURE_WRAPPER": "emconfigure", "CROSS_EMULATOR": "js-emulator", + "CROSS_STAGE": "2", "CROSS_TARGET": "javascript-unknown-ghcjs", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", @@ -2492,9 +2501,10 @@ "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": "", + "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate", "XZ_OPT": "-9" } @@ -3570,9 +3580,10 @@ "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": "", + "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate", "XZ_OPT": "-9" } @@ -5894,6 +5905,7 @@ "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", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", @@ -5959,6 +5971,7 @@ "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", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", @@ -6024,6 +6037,7 @@ "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", "FIREFOX_LAUNCH_OPTS": "{\"browser\":\"firefox\",\"executablePath\":\"/usr/bin/firefox\"}", "HADRIAN_ARGS": "--docs=no-sphinx-pdfs --docs=no-sphinx-man", @@ -6213,9 +6227,10 @@ "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": "", + "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate" } }, @@ -6278,6 +6293,7 @@ "CONFIGURE_ARGS": "--with-intree-gmp --enable-strict-ghc-toolchain-check", "CONFIGURE_WRAPPER": "emconfigure", "CROSS_EMULATOR": "js-emulator", + "CROSS_STAGE": "2", "CROSS_TARGET": "javascript-unknown-ghcjs", "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check", "RUNTEST_ARGS": "", @@ -6654,9 +6670,10 @@ "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": "", + "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-deb12-riscv-cross_riscv64-linux-gnu-validate" } }, @@ -7716,9 +7733,10 @@ "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": "", + "RUNTEST_ARGS": "-e config.timeout=900", "TEST_ENV": "x86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate" } }, ===================================== ghc/GHC/Driver/Session/Mode.hs ===================================== @@ -132,7 +132,7 @@ isDoEvalMode :: Mode -> Bool isDoEvalMode (Right (Right (DoEval _))) = True isDoEvalMode _ = False -#if defined(HAVE_INTERNAL_INTERPRETER) +#if defined(HAVE_INTERPRETER) isInteractiveMode :: PostLoadMode -> Bool isInteractiveMode DoInteractive = True isInteractiveMode _ = False ===================================== ghc/GHCi/UI.hs ===================================== @@ -1900,7 +1900,9 @@ changeDirectory dir = do fhv <- compileGHCiExpr $ "System.Directory.setCurrentDirectory " ++ show dir' liftIO $ evalIO interp fhv +#if defined(HAVE_INTERNAL_INTERPRETER) _ -> pure () +#endif trySuccess :: GhciMonad m => m SuccessFlag -> m SuccessFlag trySuccess act = ===================================== ghc/Main.hs ===================================== @@ -35,7 +35,7 @@ import GHC.Driver.Config.Diagnostic import GHC.Platform import GHC.Platform.Host -#if defined(HAVE_INTERNAL_INTERPRETER) +#if defined(HAVE_INTERPRETER) import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings ) #endif @@ -287,7 +287,7 @@ doRun units srcs args = do args' = drop 1 $ dropWhile (/= "--") $ map unLoc args ghciUI :: [String] -> [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc () -#if !defined(HAVE_INTERNAL_INTERPRETER) +#if !defined(HAVE_INTERPRETER) ghciUI _ _ _ = throwGhcException (CmdLineError "not built for interactive use") #else @@ -331,7 +331,7 @@ showBanner :: PostLoadMode -> DynFlags -> IO () showBanner _postLoadMode dflags = do let verb = verbosity dflags -#if defined(HAVE_INTERNAL_INTERPRETER) +#if defined(HAVE_INTERPRETER) -- Show the GHCi banner when (isInteractiveMode _postLoadMode && verb >= 1) $ putStrLn ghciWelcomeMsg #endif ===================================== ghc/ghc-bin.cabal.in ===================================== @@ -22,6 +22,11 @@ Flag internal-interpreter Default: False Manual: True +Flag interpreter + Description: Build with interpreter support, both internal and external. + Default: False + Manual: True + Flag threaded Description: Link the ghc executable against the threaded RTS Default: True @@ -56,7 +61,7 @@ Executable ghc -rtsopts=all "-with-rtsopts=-K512M -H -I5 -T" - if flag(internal-interpreter) + if flag(interpreter) -- NB: this is never built by the bootstrapping GHC+libraries Build-depends: deepseq >= 1.4 && < 1.6, @@ -65,7 +70,7 @@ Executable ghc haskeline == 0.8.*, exceptions == 0.10.*, time >= 1.8 && < 1.16 - CPP-Options: -DHAVE_INTERNAL_INTERPRETER + CPP-Options: -DHAVE_INTERPRETER Other-Modules: GHCi.Leak GHCi.UI @@ -82,6 +87,9 @@ Executable ghc UnboxedTuples ViewPatterns + if flag(internal-interpreter) + CPP-Options: -DHAVE_INTERNAL_INTERPRETER + if flag(threaded) ghc-options: -threaded ===================================== hadrian/src/Hadrian/Haskell/Cabal/Parse.hs ===================================== @@ -81,10 +81,11 @@ parsePackageData pkg = do sorted = sort [ C.unPackageName p | C.Dependency p _ _ <- allDeps ] deps = nubOrd sorted \\ [name] depPkgs = mapMaybe findPackageByName deps + cxxStdLib = elem "system-cxx-std-lib" deps return $ PackageData name version (C.fromShortText (C.synopsis pd)) (C.fromShortText (C.description pd)) - depPkgs gpd + depPkgs cxxStdLib gpd where -- Collect an overapproximation of dependencies by ignoring conditionals collectDeps :: Maybe (C.CondTree v [C.Dependency] a) -> [C.Dependency] @@ -138,7 +139,9 @@ configurePackage :: Context -> Action () configurePackage context@Context {..} = do putProgressInfo $ "| Configure package " ++ quote (pkgName package) gpd <- pkgGenericDescription package - depPkgs <- packageDependencies <$> readPackageData package + pd <- readPackageData package + let depPkgs = packageDependencies pd + needSystemCxxStdLib = dependsOnSystemCxxStdLib pd -- Stage packages are those we have in this stage. stagePkgs <- stagePackages stage @@ -157,7 +160,12 @@ configurePackage context@Context {..} = do -- We'll need those packages in our package database. deps <- sequence [ pkgConfFile (context { package = pkg, iplace = forceBaseAfterGhcInternal pkg }) | pkg <- depPkgs, pkg `elem` stagePkgs ] - need $ extraPreConfigureDeps ++ deps + -- system-cxx-std-lib is magic.. it doesn't have a cabal file or source code, so we have + -- to treat it specially as `pkgConfFile` uses `readPackageData` to compute the version. + systemCxxStdLib <- sequence [ systemCxxStdLibConfPath (PackageDbLoc stage iplace) | needSystemCxxStdLib ] + need $ extraPreConfigureDeps + ++ deps + ++ systemCxxStdLib -- Figure out what hooks we need. let configureFile = replaceFileName (pkgCabalFile package) "configure" ===================================== hadrian/src/Hadrian/Haskell/Cabal/Type.hs ===================================== @@ -30,6 +30,7 @@ data PackageData = PackageData , synopsis :: String , description :: String , packageDependencies :: [Package] + , dependsOnSystemCxxStdLib :: Bool , genericPackageDescription :: GenericPackageDescription } deriving (Eq, Generic, Show) ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -246,9 +246,6 @@ copyRules = do prefix -/- "html/**" <~ return "utils/haddock/haddock-api/resources" prefix -/- "latex/**" <~ return "utils/haddock/haddock-api/resources" - forM_ [Inplace, Final] $ \iplace -> - root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- systemCxxStdLibConf %> \file -> do - copyFile ("mk" -/- "system-cxx-std-lib-1.0.conf") file generateRules :: Rules () generateRules = do ===================================== hadrian/src/Rules/Register.hs ===================================== @@ -7,7 +7,6 @@ module Rules.Register ( import Base import Context import Expression ( getContextData ) -import Flavour import Oracles.Setting import Hadrian.BuildPath import Hadrian.Expression @@ -52,14 +51,6 @@ configurePackageRules = do isGmp <- (== "gmp") <$> interpretInContext ctx getBignumBackend when isGmp $ need [buildP -/- "include/ghc-gmp.h"] - when (pkg == text) $ do - simdutf <- textWithSIMDUTF <$> flavour - when simdutf $ do - -- This is required, otherwise you get Error: hadrian: - -- Encountered missing or private dependencies: - -- system-cxx-std-lib ==1.0 - cxxStdLib <- systemCxxStdLibConfPath $ PackageDbLoc stage Inplace - need [cxxStdLib] Cabal.configurePackage ctx root -/- "**/autogen/cabal_macros.h" %> \out -> do @@ -114,6 +105,12 @@ registerPackageRules rs stage iplace = do target (Context stage compiler vanilla iplace) (GhcPkg Recache stage) [] [] writeFileLines stamp [] + -- Special rule for registering system-cxx-std-lib + root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- systemCxxStdLibConf %> \file -> do + copyFile ("mk" -/- "system-cxx-std-lib-1.0.conf") file + buildWithResources rs $ + target (Context stage compiler vanilla iplace) (GhcPkg Recache stage) [] [] + -- Register a package. root -/- relativePackageDbPath (PackageDbLoc stage iplace) -/- "*.conf" %> \conf -> do historyDisable ===================================== hadrian/src/Settings/Packages.hs ===================================== @@ -88,11 +88,10 @@ packageArgs = do -- 1. ghcWithInterpreter must be True ("Use interpreter" = -- "YES") -- 2. For non-cross case it can be enabled - -- 3. For cross case, disable for stage0 since that runs - -- on the host and must rely on external interpreter to - -- load target code, otherwise enable for stage1 since - -- that runs on the target and can use target's own - -- ghci object linker + -- 3. For cross case, disable for stage0 and stage1 since these run + -- on the host and must rely on external interpreter to load + -- target code, otherwise enable for stage2 since that runs on + -- the target and can use target's own ghci object linker [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage2]] `cabalFlag` "internal-interpreter" , orM [ notM cross, haveCurses ] `cabalFlag` "terminfo" , arg "-build-tool-depends" @@ -115,7 +114,8 @@ packageArgs = do , compilerStageOption ghcDebugAssertions ? arg "-DDEBUG" ] , builder (Cabal Flags) ? mconcat - [ (expr (ghcWithInterpreter stage)) `cabalFlag` "internal-interpreter" + [ andM [expr (ghcWithInterpreter stage), orM [expr (notM cross), stage1]] `cabalFlag` "interpreter" + , andM [expr (ghcWithInterpreter stage), notM (expr cross)] `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/620b9aa118e78e729826606cb5537e5... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/620b9aa118e78e729826606cb5537e5... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)