Introducing libcsg

Compile as a static library.

/cc @sshirokov