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