Make ghc-in-ghci support Hadrian
ClosedPublic

Authored by RyanGlScott on Wed, Nov 28, 1:08 PM.

Details

Summary

Currently, ghc-in-ghci is hard-coded to only support
the installation path of the make-based build system. There isn't
a fundamental reason why this must be the case, however—it's just a
matter of communicating which directories to look into.

For the time being, I've hacked utils/ghc-in-ghci/run.sh to just
check the default Hadrian installation path in addition to the make
one. Disclaimer: I'm not well-versed in bash-fu, so it's possible
that there is a better way to accomplish what I'm setting out to do.
Suggestions welcome.

Test Plan

./utils/ghc-in-ghci/run.sh

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott created this revision.Wed, Nov 28, 1:08 PM
alpmestan accepted this revision.Thu, Nov 29, 1:45 AM

I'm marking this as accepted as this is a definite improvement.

... However, couldn't we just take hadrian's build root as an (optional?) argument to run.sh? This way it'd be trivial for people using hadrian's --build-root option to use ghc-in-ghci. If you agree but don't feel like implementing it, we can merge this and I'll refine it as suggested in another patch.

This revision is now accepted and ready to land.Thu, Nov 29, 1:45 AM

... However, couldn't we just take hadrian's build root as an (optional?) argument to run.sh? This way it'd be trivial for people using hadrian's --build-root option to use ghc-in-ghci.

I thought about doing this, but I backed away from the idea since it ended up being more complicated than I originally expected, for a number of reasons:

  1. In addition to changing run.sh to accomplish this, you'd also need to change settings.ghci, which hard-codes Hadrian's default build root in a number of places. We'd likely have to augment settings.ghci with some System.Environment functionality to make it recognize the options added in run.sh.
  2. make and Hadrian appear to have slightly different naming conventions for the same things (ghc-stage2 vs. ghc, compiler/stage2 vs. _build/stage1, etc.). It wasn't clear to me if there was a clean way to parameterize the script by a single build root flag, given that there appear to be more differences than just where the built GHC is installed.

OK, it's indeed not that straightforward, we'll see what we can do about this in due time then. Thanks for the explanation, Ryan.

OK, it's indeed not that straightforward, we'll see what we can do about this in due time then. Thanks for the explanation, Ryan.

Ultimately all of this would likely be much less fragile in general if Hadrian generated a script to run GHC in GHCi.

This revision was automatically updated to reflect the committed changes.