alexwl / haskell-code-explorer

Web application for exploring and understanding Haskell codebases
MIT License
509 stars 20 forks source link

Add instructions on how to index the GHC code base #37

Open jvanbruegge opened 5 years ago

jvanbruegge commented 5 years ago

Hi, I am using the online version of your haskell-code-explorer to quickly jump around the GHC code base. That works great and thank you for creating this. But I was not able to setup the local version with a cloned repo of GHC, could you provide some documentation on how to do that?

alexwl commented 5 years ago

Hi,

Building and indexing release versions of GHC (from Hackage) is simple.

I used cabal with buildable flag to build and index GHC 8.6, 8.4 and 8.2. buildable flag is defined in ghc.cabal (http://hackage.haskell.org/package/ghc-8.6.5/ghc.cabal), it's an experimental feature, but I haven't encountered any problems with it.

Examples:

Building and indexing GHC-8.6.5 using globally installed ghc and cabal:

cabal unpack ghc-8.6.5
cd ghc-8.6.5
cabal new-configure -f buildable
cabal new-build
haskell-code-indexer -p .

Building and indexing GHC-8.6.5 using stack and ghc/cabal from lts-13.20 snapshot:

stack unpack ghc-8.6.5
cd ghc-8.6.5
stack --resolver=lts-13.20 exec --no-ghc-package-path cabal -- new-configure -w $(stack --resolver=lts-13.20 path --compiler-exe) -f buildable
stack --resolver=lts-13.20 exec --no-ghc-package-path cabal -- new-build
haskell-code-indexer -p .

I'm not sure if there is a simple way to index the development version of GHC (8.9.0.20190510).
It seems that the current master branch of GHC depends on Cabal-3.0.0.0 (I'm not familiar with the details of the GHC build system). Cabal-3.0.0.0 is not released yet and it is obviously not supported by cabal-helper (cabal-helper extracts command line options for GHC from setup-config file).

jvanbruegge commented 5 years ago

Ok, thank you, having the local version would at least allow me to work offline better. Still, would be nice to investigate how to index the cloned versions so you can inspect your changes.