Tweak build script a bit.

Adds support for building shared libraries, though these don't actually
build successfully yet (linker errors related to symbols for template
functions being stripped, I think).