Backported build script and OAuth from 1.6.4 to 1.5.2