Bug 1054934: Support static linking

This patch adds support for building static libraries. This is requiried
to create self-contained executables.
Merge pull request #1 from tdz/bug-1054934

Bug 1054934: Support static linking