hadrian: Fix running stage0/bin/ghc with wrong package DB. Fixes #17468.
This is a rebased version of !2160 (closed) mostly here to get CI results. In a discussion around static linking I agreed to take @nh2's work over while he is busy. Copy-in of the original MR description:
Fixes #17468 (closed) (Hadrian not telling Cabal that the ghc
in stage0
must not use the global package db in stage0
, but the one from stage1
).
A fix for !780 (comment 237580) (lack of -no-global-package-db
in the ghc-stage1
wrapper added in !780 (merged)) is also included.
Please see the commit message for full details.