mxcl/homebrew — pull request #11279 by camillol (2012-03-29 09:43:32+00:00)
Title: glib 2.32.0

From the discussion in #11212, I ended up reviewing all the old patches from MacPorts, finding a couple unfixed bugs, reporting them upstream and writing new patches. Therefore I'm submitting this pull request with my work.

This is the verdict on the old MacPorts patches:
- `config.h.ed` is useless: most of the definitions it tries to change don't even exist any more in config.h, the rest are set correctly by configure.
- `patch-configure.diff` attempts to make configure work for 64 bit systems, but it looks like this was fixed upstream long ago. The values generated by configure in `glib/glibconfig.h` etc. are correct.
- `patch-glib_gi18n.h` was added five years ago with the following rationale: "Add patch for gi18n.h/popt.h conflict. This patch is critical as the conflict is wrecking havoc on GNOME installations and upgrades." I have a hard time believing that there is still a conflict between glib and gnome builds after five years. I'd just skip this, and revisit it in the unlikely event that someone tries to build Gnome and fails because of this.
- `patch-gio_gdbusprivate.c.diff` is as relevant as it ever was, since the path is still hardcoded in the source. However, it does not apply cleanly in the new version of glib.
- `patch-gio_xdgmime_xdgmime.c.diff` ditto, but this one does apply.
- `patch-glib-2.0.pc.in` is explained [here](http://trac.macports.org/ticket/9937). It does not work with the new glib. What's worse, with the value of includedir in the `pc` files, this patch would end up adding a directory that contains no headers at all, so it doesn't seem to do anything useful.
- `patch-glib_gunicollate.c.diff` is based on an entirely wrong rationale: although the HIToolbox part of Carbon is not available on 64-bit, CoreServices certainly it. The functions used by glib (e.g. `UCCompareTextDefault`) are available and not deprecated. There must have been some other bug in glib's use of them; I'll compile without the patch and see if the bug still exists; if so, we should track down the real cause.

After this, I investigated the collate problem and figured out how to fix it on 10.7. I'd like someone to test if this also works on 10.6 (you'll want to run the tests with verbose output and see if the gunicollate tests pass).
While checking the tests, I also discovered that glib did not support the timezone info format used on OS X, so I added support for that. Both of these patches have been submitted upsteam.

Essentially, what's left to do is to figure out what to do with the hardcoded paths in `gio/gdbusprivate.c` and `gio/xdgmime/xdgmime.c`. I think we should make a patch that uses some variable from config.h to determine the path, so that the path can be controlled via configure. That should be acceptable for merging upstream.