summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-08-19 11:17:36 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-07 03:40:49 -0400
commitb041fc6e0e79ef0377151178e83248297e3c89fd (patch)
treeec37bd29b1ecbf30c69e783ddc62eee600dd4cfb
parenta466b02492f73a43c6cb9ce69491fc85234b9559 (diff)
downloadhaskell-b041fc6e0e79ef0377151178e83248297e3c89fd.tar.gz
hadrian: Generate ghcii.sh in binary distributions
Technically we should probably generate this in the in-place build tree as well, but I am not bothering to do so here as ghcii.sh will be removed in 9.4 when WinIO becomes the default anyways (see #12720). Fixes #19339.
-rw-r--r--hadrian/src/Rules/BinaryDist.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index 8a03064ffd..743547917c 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -192,6 +192,7 @@ bindistRules = do
copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir
copyDirectory (rtsIncludeDir) bindistFilesDir
+ when windowsHost $ createGhcii (bindistFilesDir -/- "bin")
-- The settings file must be regenerated by the bindist installation
-- logic to account for the environment discovered by the bindist
@@ -467,3 +468,17 @@ but on linux these wrappers are symlinks.
-}
+-- | On Windows ghci must be invoked via this wrapper script due to signal craziness.
+-- When WinIO becomes the default it can be removed. See #19339 and #12720.
+createGhcii :: FilePath -> Action ()
+createGhcii outDir = do
+ version <- setting ProjectVersion
+ create (outDir -/- "ghcii.sh")
+ create (outDir -/- "ghcii"++version++".sh")
+ where
+ create out = writeFileChanged out content >> makeExecutable out
+ content = unlines
+ [ "#!/bin/sh"
+ , "exec \"$(dirname \"$0\")\"/ghc --interactive \"$@\""
+ ]
+