Skip to content

hadrian: create wrapper scripts with version suffixes when installing binary distributions

Motivation

When installing a bindist produced by the make build system (e.g as found in the GHCs supplied by nixpkgs), we end up with:

$ ls /nix/store/vysnbfiax8xyanbimqw6ag70z41nk5dd-ghc-8.8.2/bin/
ghc        ghci        ghc-pkg        haddock            hp2ps  hsc2hs  runghc-8.8.2
ghc-8.8.2  ghci-8.8.2  ghc-pkg-8.8.2  haddock-ghc-8.8.2  hpc    runghc  runhaskell
$ file /nix/store/vysnbfiax8xyanbimqw6ag70z41nk5dd-ghc-8.8.2/bin/ghc
/nix/store/vysnbfiax8xyanbimqw6ag70z41nk5dd-ghc-8.8.2/bin/ghc: symbolic link to ghc-8.8.2

# and of course, ghc-8.8.2 is just a wrapper script for the binary under `lib/ghc-8.8.2/bin`, where a few more executables are to be found
$ ls /nix/store/vysnbfiax8xyanbimqw6ag70z41nk5dd-ghc-8.8.2/lib/ghc-8.8.2/bin/
ghc  ghc-iserv  ghc-iserv-dyn  ghc-iserv-prof  ghc-pkg  ghc-split  haddock  hp2ps  hpc  hsc2hs  runghc  unlit

Those -8.8.2-suffixed executables are pretty useful for GHC users who have several GHC versions living in their PATH.

Proposal

Hadrian's bindist installation script (https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/bindist/Makefile) should mimic this. It already has the wrapper script generation logic. We just need to make the wrapper script names be version-suffixed and to create version-suffix-less symlinks to them in the same directory under $bindir.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information