Revert "Clean up and reorganize all the build optimizations"

This reverts commit 86d7c9b177e4cd997e11a8cd6fc0d93a7c8c6209.