Fix build.sh for R build