Import changes from ruby-build v20141028

Import recent changes from ruby-build v20141028.

The changes are somewhat bigger. It should be tested carefully than usual.