Rewrite build script