Use ruby for the build process

This is a major work in progress moving our building tools from make+scripting to using ruby and rake.