Extract all the shared code into a new library file.