summaryrefslogtreecommitdiff
path: root/hadrian/ghci-multi-cabal.in
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-07-04 15:30:26 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-18 08:04:47 -0400
commiteb031a5b913ccd645c596abe3d8630602e7c47bc (patch)
tree4c715dafbbcc75265afd7f105284e267660fe5dc /hadrian/ghci-multi-cabal.in
parentb27c5947ed9537f8cde153be4e53d4095ecbe247 (diff)
downloadhaskell-eb031a5b913ccd645c596abe3d8630602e7c47bc.tar.gz
hadrian: Add multi:<pkg> and multi targets for starting a multi-repl
This patch adds support to hadrian for starting a multi-repl containing all the packages which stage0 can build. In particular, there is the new user-facing command: ``` ./hadrian/ghci-multi ``` which when executed will start a multi-repl containing the `ghc` package and all it's dependencies. This is implemented by two new hadrian targets: ``` ./hadrian/build multi:<pkg> ``` Construct the arguments for a multi-repl session where the top-level package is <pkg>. For example, `./hadrian/ghci-multi` is implemented using `multi:ghc` target. There is also the `multi` command which constructs a repl for everything in stage0 which we can build.
Diffstat (limited to 'hadrian/ghci-multi-cabal.in')
-rwxr-xr-xhadrian/ghci-multi-cabal.in13
1 files changed, 13 insertions, 0 deletions
diff --git a/hadrian/ghci-multi-cabal.in b/hadrian/ghci-multi-cabal.in
new file mode 100755
index 0000000000..525f5987a4
--- /dev/null
+++ b/hadrian/ghci-multi-cabal.in
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+GHC=@WithGhc@
+if [[ $(printf "9.4.0\n%s\n" $($GHC --numeric-version) | sort -uV | head -n 1) != "9.4.0" ]]; then echo "Multi-repl needs at least GHC-9.4.1"; exit 1; fi
+
+# This file is generated by configure from ghci-multi.in
+
+set -e
+export TOOL_OUTPUT=.hadrian_ghci_multi/ghci_args
+# Replace newlines with spaces, as these otherwise break the ghci invocation on windows.
+CABFLAGS=-v0 "hadrian/build-cabal" multi:ghc --build-root=.hadrian_ghci_multi --flavour=ghc-in-ghci $HADRIAN_ARGS
+GHC_FLAGS="$GHC_FLAGS $(cat $TOOL_OUTPUT | tr '\n\r' ' ')"
+$GHC --interactive $GHC_FLAGS $@ -fno-code -fwrite-interface -hidir=.hadrian_ghci_multi/interface -O0 +RTS -A128m