Upgrade build script to make it compile on macosx 10.8