Unify build script for external dependencies