Upgrade to R 3.1.0

And lots of fixes and improvements to supporting scripts for building the R binaries.