Sometimes a horrible hack is the best solution (and building gtk on Tiger) (Shallow Thoughts)

Akkana's Musings on Open Source, Science, and Nature.

Sun, 14 Dec 2008

Sometimes a horrible hack is the best solution (and building gtk on Tiger)

Dave has been fighting for I don't know how many weeks trying to get a buildable set of gtk libraries installed on his Mac.

He doesn't need them to build GIMP -- the GIMP on OS X project (split off from Wilber Loves Apple) provides binaries complete with all the libraries needed. Alas, it's just a binary package with no development headers, so if you want to build any other gtk packages, like pho, or maybe some GIMP plug-ins, you're in for a much longer adventure.

Mac Ports used to make that easy, but the Ports version of gtk2 doesn't build on OS X "Tiger". It's a long story and I don't (want to) know all the hairy details, but this weekend he finally gave up on it and began downloading all the gtk2 packages and dependencies (cairo, pango, bonobo, atk etc.) from their various project sites.

Oddly enough, building them went much more smoothly than Ports had, and after a little twiddling of --disable flags in configure and a lot of waiting, he had most of the libraries built. Even gtk2 itself! Except ... gtk2's make install failed.

Seems that although gtk is configured to disable building docs by default (configure --help shows a --enable-gtk-doc option), nevertheless make install calls something called gtkdoc-rebase from a lot of the subdirectories. And gtkdoc-rebase doesn't exist, since it wasn't ever built. So the whole make install process fails at that point -- after installing the libraries but before telling pkg-config that gtk-2.0 is indeed present.

After twiddling configure dependencies all day, Dave was getting frustrated. "How do I configure it to really disable docs, so it won't try to run this gtkdoc-rebase thing I don't have?"

I was in the middle of a timed quiz for a class I'm taking. "I have no idea. You'd think they'd check for that. Um ... all you need is for gtkdoc-rebase to return success, right? What if you make a script somewhere in your path that contains nothing but a shebang line, #! /bin/sh? It's a horrible hack, but ..."

"Horrible hacks R us!" he exclaimed, and created the script. 10 minutes later, he had gtk-2.0 installed, pkg-config notified and pho built.

Sometimes horrible hacks are the best.

The gtk2 package list

Incidentally, for anyone trying to accomplish the same thing, the packages he needed to download were:

pgk-config gettext glib pango atk jpeg jasper libpng tiff pixman freetype libxml fontconfig cairo gtk2

and he had to configure gtk2 with --disable-cups (because it introduced other errors, not because of CUPS itself). The trickiest dependency was atk, because it wasn't in the place that gtk.org points to and it wasn't on its own project site either; he eventually found it by poking around on the gnome ftp site.

Tags: , ,
[ 20:44 Dec 14, 2008    More programming | permalink to this entry ]