Refactor into standalone build scripts.