build script improved for libraries