Bug 784841 - Part 20: Fixes to support building external projects; r=glandium

This is extremely hacky. It will likely need many refinements as we
figure out how we want external projects to be handled.