The basic concept of app bundles seems to be: to avoid "DLL hell", let's waste lots of disk space by providing each app's dependencies along with the file, so an app consists of one "file" (really a directory, also known as a "bundle") you can kerchunk into place and it will run, without necessarily needing an installer. (One has to admit, not needing installers, and having freedom to move your apps around rather than just linking to them, has always been an elegant feature on MacOS. It's just that on the classic versions, prior to OS X, the implementation was completely different.) The alternative (apparently), if you want shared libs to really be shared, is to write an installer which installs "Frameworks", which are just dynamic libraries that are shared between apps. If you have installed Qt, that's a framework. In case you haven't, taborca.app includes its own copies of QtCore?, QtGui? and QtXml? for now. Likewise for all the other dependencies: expat, fontconfig, freetype, iconv, jpeg, openjpeg, poppler, poppler-qt4, libz, and libgif. (One thing I don't know yet is if installers are typically smart enough to upgrade a "framework" only if the installer happens to include a newer version than what's already installed. Suspect it must be like that... And I'm guessing xcode can build an installer, but I haven't tried yet.)
- qmake -spec macx-g++ because the qmake that comes with the Qt Creator/library package (binary installation) generates xcode projects by default.
- after that, plain old make will generate taborca.app... but without any dependencies included, just the app itself.
- macdeployqt taborca.app will find and add most of the dependencies... but it misses a couple of things
- copy libpoppler-qt4.1.dylib by hand (for some reason macdeployqt expects it will be at /usr/lib, but I (of course) installed it to /usr/local/lib instead. Not sure how to fix that yet...)
- copy libgif and its dependencies by hand
- if you already installed the libqtgif.dylib imageformat plugin globally, e.g. cp /path/to/it /Developer/Applications/Qt/plugins/imageformats/, then macdeployqt includes it along with all the other plugins. Otherwise you have to copy that by hand too, and fix its depdendencies.
- in that case, it's also a good idea to delete /Developer/Applications/Qt/plugins/imageformats/libqgif.dylib (the original one included with Qt), because if that's also copied into the taborca bundle, then taborca will load it first, see that the gif support is satisfied, and you still won't be able to write gif files.
- use otool -L instead of ldd to actually trace dependencies
- it's necessary to do string replacements on any absolute paths which the dylibs are trying to use to load their dependencies, because we want it to use the versions included in the app "bundle" rather than assuming it will find them on the user's system in the same place as they are on my system. macdeployqt already did some of that, but then we copied libpoppler-qt and libgif and their dependencies into place by hand, so then we have to manually run install_name_tool -change old-path new-path taborca.app/path/to/file.dylib for each of those paths which are wrong.
macbuild.sh tries to do most of this. The build isn't quite fully automatic yet though, because those dependencies have to be gotten from somewhere... this is how I did it:
- I use MacPorts? rather than fink because it seems more complete
- but MacPorts? version of libgif depends on X11... yuck! so I had to build libgif myself: ./configure --disable-x11 and then make
- poppler was a PITA.
- LDFLAGS=-L/opt/local/lib CFLAGS=-I/opt/local/include ./configure --disable-libpng --disable-poppler-glib --disable-gdk --disable-cairo-output --disable-cms --disable-abiword-output
- that will get you just poppler*.dylib without the qt4 binding (because configure can't find Qt). libpng support was also a problem with the MacPorts? version (not sure why), which is why it's disabled.
- then I used QtCreator? (plus some hand editing) to generate a .pro file for the poppler-qt4 binding. It's checked in now as taborca/deps/poppler-qt4.pro. (Why on earth people insist on using autoconf or cmake instead of qmake for Qt stuff doesn't make sense to me. If you have a development installation of Qt, you have qmake. It's simpler, faster and usually works better, too.) The really screwball thing is that a couple of the files necessary aren't even in the qt4 directory... they're mixed in with the rest of poppler itself. (ArthurOutputDev?.cc and .h)
Finally, you can also
- macdeployqt taborca.app -dmg to build the DMG (disk image) file, which is the one that's available for download on SourceForge?.