improving the build/installation process #1002
Description
Hi everybody!
I spent some time trying to figure out how HIE is built and I found a bunch of problems that might be pretty easy to fix.
This is me getting started on that and soliciting feedback.
My end-goal is to create a PR that makes the installation more pleasant for first time users, including some readme polish. Please note that I'm neither extremely experienced with makefiles, nor with other build tools or tricky dependency handling, so I'm not promising that I'll be extremely fast. I will track progress here.
The problems. Numbered so you can comment on them:
- building everything seems robust-ish, but is very time intensive and uses up loads of harddisk.
- building a targeted ghc version is broken in my opinion:
The submodules will use different resolvers. The redundancy in downloads and compilations is pretty nuts.Incorrect, they will use the resolver from thestack build
command.- The selection of ghc version doesn't propagate to the other build commands.
- The command to check the ghc version (
GHC := $(shell stack path --compiler-exe)
) will use the mainstack.yaml
instead of the targeted one. This will also attempt to download an entire resolver set, just to tell you its ghc version.
- The resolvers in
stack.yaml
andstack-8.6.3.yaml
are two different nightly ones, which I think could be aligned to use the same one, improvingbuild-all
. - It's unclear what I have to have on my system and what can get reused. If I have the latest cabal, no need to compile the whole thing.
happy
gets compiled and installed with each version, effectively overwriting itself 7 times.
I really think installing one, maybe two specific versions is the right use-case for most intermediate users, especially those installing hie for the first time.
As an example, I managed to get an amazing fast install experience (for ghc 8.4.4) by doing the following:
remove the dependencies on cabal and submodules fromhie-%:
in the Makefile
- not fully necessary, but nice in case we already have the right cabal version.
- copy
stack-8.4.4.yaml
overstack.yaml
change the resolvers ofsubmodules/HaRe
andsubmodules/brittany
to use the same one as HIE (and create astack-8.4.4.yaml
for the latter)
- not necessary
- make sure that cabal is installed. I happened to have it via
ghcup
so I have no idea if it even neededcabal update
, I only didcabal new-update
. It seems it's also not mandatory to install via stack.make build-doc-8.4.4
at the end.- everything works in projects with 8.4.4. Amazing!
- space cost: 200Mb. Would be 100Mb, but there is both hie-8.4 and hie-8.4.4. Does it need both? Who knows.
md5
says they're the same thing. Would a symlink do?
Now the challenge is to make it equally nice without having to tweak any files.
I gotta run now, but I will update this post with goals and a todo list.
Chime in if you have comments!