Add support for building a universal binary.

If the target ruby is universal, the bundled libraries must be built
with the same architecture specification as the ruby itself.

This should fix #1096.
Organize the script into sections for better maintainability.