glib: apply upstream patches for various compilation issues