[3.0] contrib: update zlib, png, freetype2
And bring the commits to get to a similar state as in 4.0, including building with them with CMake.
This fixed building with a recent XCode for me.
The generic backported commits will also help backport more contribs.