[commit: ghc] master: Make ghc-in-ghci support Hadrian (30a363a)

git at git.haskell.org git at git.haskell.org
Fri Nov 30 00:45:46 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/30a363ae4cbb22127959e98971a188de2b40f788/ghc

>---------------------------------------------------------------

commit 30a363ae4cbb22127959e98971a188de2b40f788
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Nov 29 18:46:39 2018 -0500

    Make ghc-in-ghci support Hadrian
    
    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
    
    Reviewers: alpmestan, bgamari
    
    Reviewed By: alpmestan
    
    Subscribers: rwbarton, carter
    
    Differential Revision: https://phabricator.haskell.org/D5390


>---------------------------------------------------------------

30a363ae4cbb22127959e98971a188de2b40f788
 utils/ghc-in-ghci/run.sh | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/utils/ghc-in-ghci/run.sh b/utils/ghc-in-ghci/run.sh
index 521458f..cb0ab07 100755
--- a/utils/ghc-in-ghci/run.sh
+++ b/utils/ghc-in-ghci/run.sh
@@ -23,10 +23,20 @@
 # If you don't want to wait for `:load Main`, since you want to load some other
 # module, then you can use `Ctrl+C` to cancel the initial load.
 
-
-export _GHC_TOP_DIR=./inplace/lib
-
-exec ./inplace/bin/ghc-stage2 \
+# Look in two common locations for a GHC installation (the results of using
+# the make- and Hadrian-based build systems, respectively).
+if [ -d ./inplace/lib ]; then
+  GHC_BIN=./inplace/bin/ghc-stage2
+  _GHC_TOP_DIR=./inplace/lib
+elif [ -d ./_build/stage1/lib ]; then
+  GHC_BIN=./_build/stage1/bin/ghc
+  _GHC_TOP_DIR=./_build/stage1/lib
+else
+  echo "Could not find GHC installation"
+  exit 1
+fi
+
+exec ${GHC_BIN} \
     --interactive \
     -ghci-script ./utils/ghc-in-ghci/settings.ghci \
     -ghci-script ./utils/ghc-in-ghci/load-main.ghci \



More information about the ghc-commits mailing list