Skip to content

Commit

Permalink
Make GHC-in-GHCi work on Windows
Browse files Browse the repository at this point in the history
By not building anything in the dynamic way on Windows, where we don't
have a working story for DLLs yet.

Also the ghcid command needs to call bash on the hadrian/ghci.sh script
explicitly as the path gets interpreted differently otherwise.
  • Loading branch information
sgraf812 authored and Marge Bot committed Jul 17, 2019
1 parent 0a9b77b commit 8add024
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .ghcid
@@ -1,4 +1,4 @@
--command ./hadrian/ghci.sh
--command sh ./hadrian/ghci.sh
--reload compiler
--reload ghc
--reload includes
Expand Down
4 changes: 2 additions & 2 deletions hadrian/ghci.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

set -e

GHC_FLAGS=$(TERM=dumb CABFLAGS=-v0 . "hadrian/build.cabal.sh" tool-args -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci "$@")
GHC_FLAGS=$(TERM=dumb CABFLAGS=-v0 "hadrian/build.cabal.sh" tool-args -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci "$@")
ghci $GHC_FLAGS -fno-code -fwrite-interface -hidir=.hadrian_ghci/interface -O0 ghc/Main.hs
5 changes: 4 additions & 1 deletion hadrian/src/Rules.hs
Expand Up @@ -38,7 +38,10 @@ import UserSettings
toolArgsTarget :: Rules ()
toolArgsTarget = do
"tool-args" ~> do
let fake_target = target (Context Stage0 compiler dynamic)
-- We can't build DLLs on Windows (yet). Actually we should only
-- include the dynamic way when we have a dynamic host GHC, but just
-- checking for Windows seems simpler for now.
let fake_target = target (Context Stage0 compiler (if windowsHost then vanilla else dynamic))
(Ghc ToolArgs Stage0) [] ["ignored"]

-- need the autogenerated files so that they are precompiled
Expand Down
7 changes: 5 additions & 2 deletions hadrian/src/Settings/Flavours/GhcInGhci.hs
Expand Up @@ -10,8 +10,11 @@ ghcInGhciFlavour :: Flavour
ghcInGhciFlavour = defaultFlavour
{ name = "ghc-in-ghci"
, args = defaultBuilderArgs <> ghciArgs <> defaultPackageArgs
, libraryWays = pure [vanilla, dynamic]
, rtsWays = pure [vanilla, threaded, dynamic]
-- We can't build DLLs on Windows (yet). Actually we should only
-- include the dynamic way when we have a dynamic host GHC, but just
-- checking for Windows seems simpler for now.
, libraryWays = pure [vanilla] <> pure [ dynamic | not windowsHost ]
, rtsWays = pure [vanilla, threaded] <> pure [ dynamic | not windowsHost ]
, dynamicGhcPrograms = return False }

ghciArgs :: Args
Expand Down

0 comments on commit 8add024

Please sign in to comment.