summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-08-19 11:17:36 -0400
committerBen Gamari <ben@smart-cactus.org>2021-10-05 20:19:36 -0400
commit8c277d28867963c748d6305dea6a8e1c3d080f3a (patch)
tree2ca2a5abf831442e8a3bd31a66ea3192d000be16
parent29ee04f330514651537b0e851a948373a38fa231 (diff)
downloadhaskell-8c277d28867963c748d6305dea6a8e1c3d080f3a.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 \"$@\""
+ ]
+