Port build.sh from master to 1-1-stable