Skip to content

Bootstrap of ghc 9.4.1 Does Not Include Shebang or Env Variables in Helper Scripts ghc, ghc-pkg, …

Summary

I'm bootstrapping ghc 9.4.1 using hadrian for deployment on MacPorts.

Everything builds and works except that the helper scripts bin/ghc, bin/ghc-pkg, and so forth include a shebang or the necessary environment variables. For example, bin/ghc is the text file:

exec "$executablename" -B"$libdir" ${1+"$@"}

It should be:

#!/bin/sh
exedir="/opt/local/lib/ghc-9.4.1/bin"
exeprog="ghc-9.4.1"
executablename="/opt/local/lib/ghc-9.4.1/bin/ghc-9.4.1"
bindir="/opt/local/bin"
libdir="/opt/local/lib/ghc-9.4.1/lib"
docdir="/opt/local/share/doc/ghc-9.4.1"
includedir="/opt/local/include"
exec "$executablename" -B"$libdir" ${1+"$@"}

I've include a hack to add these into the install, but this is an issue. The affected scripts are: ghc, ghc-pkg, ghci, haddock, hp2ps, hpc, hsc2hs, runghc, runhaskell.

Steps to reproduce

I'm bootstrapping per the documentation here and for hadrian, essentially:

./boot
autoconf
hadrian -j24 stage1:lib:base
hadrian -j24 docs
hadrian install

See https://github.com/macports/macports-ports/pull/15770/files#diff-c7968cfa7dd4491c4f36b05d17922247eee14b20e9a0abd8e2a05879af62c173R436

Expected behavior

Working helper scripts.

Environment

  • GHC version used: 9.4.1

macOS 12.5 21G72 x86_64 Xcode 13.4.1 13F100

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