Add PACKAGES_STAGE0 to build-dirs too; fixes #7700

This is sometimes needed when cross-compiling, as some packages may be
built in stage 0 but not stage 1.

In order to make everything work out, this also removes the requirement
that the build-dirs are in dependency order
Fix build when dph is not in the tree; fixes #7733

Patch from Stephen Blackheath.
Add missing parenthesis
Fix missing backticks and parentheses in error messages; fixes #7734

Patch from monoidal
Remove some unused build system variables
Export dopt_set, dopt_unset

We don't need them, but GHC API users might.