Refactor to use build_clib and link statically