Mac (archival)

This is a copy of DJ Joofas built approach for archival reasons. Head to the Mac OS X page if you just want to get the latest Mac build.

DJ Joofa built a Mac version and offered an archive for testing. Get it at google code. There are still some problems with it, but it may serve as a starting point. Please test and give feedback. The discussion about this release may be found at flickr.

We would be glad to get your help here.

Compilation

DJ Joofa kindly provided the starting point for a compilation tutorial on Mac. Since Photivo evolved, this probably has to be altered, please report back.

Tools needed

Xcode, which is the gcc framework on Mac platform, is needed for compilation. Xcode is available on the Mac Os X installation CD.

Libs needed

The following frameworks from Qt are needed:

  • QtCore
  • QtGui

Following open source libraries are needed:

  • libGraphicsMagic++
  • libGraphicsMagic
  • libGraphicsMagicWand
  • libexiv2
  • libfftw3
  • libglib-2.0
  • libiconv
  • libintl
  • liblcms2
  • liblensfun
  • libjpeg
  • libtiff
  • libpng

Follow the same instructions for compiling GrapicsMagick as listed in the Linux section on Photivo website at Linux

./configure --prefix=/usr --with-quantum-depth=16 --enable-shared

Building the XCode Projects

photivoProject.pro

Get rid of the ccache as shown below:

unix {
  CONFIG += link_pkgconfig
  PKGCONFIG += GraphicsMagick++ GraphicsMagickWand
  QMAKE_CC = ccache /usr/bin/gcc
  QMAKE_CXX = ccache /usr/bin/g++
}
QMake

If pkg-config can’t locate some of the required packages, then define the PKG_CONFIG_PATH variable to specify additional paths. Run qmake and it shall generate a photivo.xcode.proj file that can be loaded in xcode.

XCode

Add the include files from all the libraries listed in section above on needed libraries to the project. Select the target as Release. I had to comment off a few G_BEGIN_DECLS in some of the glib-2.0 include files.

Now, make the following changes to the files listed below:

gtypes.h

Add the following code:

#ifdef __LITTLE_ENDIAN__
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#elif defined(__BIG_ENDIAN__)
#define G_BYTE_ORDER G_BIG_ENDIAN
#else
#error neither __LITTLE_ENDIAN__ nor __BIG_ENDIAN__ #defined
#endif

Running Photivo

At this stage, after compilation, photivo is ready to be run. Just navigate to the directory containing photivo.app and execute it.

Assembling the photivo.app redistributable package

Mac OS X applications follow a certain directory structure. There is some freedom available in arranging different items. I assembled the photivo.app using the following structure:

photivo.app/Contents/Frameworks
photivo.app/Contents/Info.plist
photivo.app/Contents/MacOS
photivo.app/Contents/PkgInfo
photivo.app/Contents/Resources
photivo.app/Contents/lib

The Frameworks directory contains the following files:

QtCore.framework
QtGui.framework

Note: The default QtCore and QtGui frameworks have include files and debug libraries embedded in them, which are not required for redistribution with photovio. However, they increase the size of these frameworks substantially. I manually stripped them off to reduce the size. The MacOS directory contains the main photivo executable with some handy links:

../Resources/data/ChannelMixers
../Resources/data/Curves
../Resources/data/Icons
../Resources/data/LensfunDatabase
../Resources/data/Presets
../Resources/data/Profiles
photivo
../Resources/data/images/photivo.png
../Resources/data/images/photivoLogo.png
../Resources/data/images/photivoPreview.jpg

The support files needed by photivo during runtime are put in a directory data inside the Resources directory:

data/ChannelMixers
data/Curves
data/Icons
data/LensfunDatabase
data/Presets
data/Profiles
data/images

Runtime linking of Frameworks and Dynamic Libraries

The information regarding the frameworks and dynamic libraries needed by photivo at runtime are stored as pointers in the executable as revealed by the otool command. The following structure was put in the main photivo executable.

otool -L photivo
photivo:
@executable_path/../lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
@executable_path/../lib/liblcms2.2.dylib (compatibility version 3.0.0, current version 3.0.0)
@executable_path/../lib/libexiv2.9.dylib (compatibility version 10.0.0, current version 10.0.0)
@executable_path/../lib/libfftw3.3.dylib (compatibility version 6.0.0, current version 6.4.0)
@executable_path/../lib/libglib-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.0.0)
@executable_path/../lib/liblensfun.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
@executable_path/../lib/libGraphicsMagick++.3.dylib (compatibility version 7.0.0, current version 7.0.0)
@executable_path/../lib/libGraphicsMagickWand.2.dylib (compatibility version 5.0.0, current version 5.0.0)
@executable_path/../lib/libGraphicsMagick.3.dylib (compatibility version 10.0.0, current version 10.0.0)
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.0)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)

Note: A structure similar to the above needs to be put in all files contained in the Frameworks and lib directories in the photivo.app.

TIP: Since, I have already done the effort for putting the pointers in the Qt frameworks and libraries needed for running photivo, you can just grab them from the Mac release section at the Google code project. However, the right pointers would still need to be put in the main photivo executable after each compilation.