Generalise build-install script so that cares and curl can both use it.