All the changes needed to build on OSX.

Not quite ready for a merge (it disables the linux build).