Add build script into the repo, and clean it up

I personally need this for development even if we don't use it on ci.