Dependencies

  • Python 2.4

Either use latest official binary from www.python.org (this has the advantage of being a Universal binary and supporting correct launch of applications via the python binary). Or install boost's python2.4 (which is required for boost anyway).

Ensure current python includes are in /usr/include e.g. /usr/include/python2.4

(This is only necessary for the Openlibraries build, which does not allow you to specify the python root)

  • BOOST

Use darwinports "boost +python"

  • Python 2.4 (Darwinports version)

To ensure that libboost_python is linked against the correct Framework ensure that the bjam variable PYTHON_ROOT is set to /opt/local/Library/Frameworks.

Or use the following bjam command:

bjam --prefix=/opt/local --layout=system -sTOOLS=darwin -sPYTHON_ROOT=/opt/local/Library/Frameworks/Python.framework/Versions/2.4 --with-python -sPYTHON_VERSION=2.4 stage

--layout=system is required, or else the file names include the boost version. This is in-compatible with the olib build.

This will stage libboost_python in the boost source tree.

  • Qt v3

ftp://ftp.trolltech.com/qt/source/

./configure -fast -thread -pch -plugin-imgfmt-png -plugin-imgfmt-jpeg -plugin-imgfmt-mng

  • FFMpeg (ffmpeg.sourceforge.net)

Fetch latest from SVN:

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

Run configure:

./configure --prefix=/opt/local --enable-shared --extra-cflags=-DHAVE_LRINTF

Optionally the following flags if you want gpl'd plugins:

--enable-faac --enable-faad --enable-mp3lame --enable-gpl

Then make and make install.

FFmpeg exists as a darwinports port, but this version is stale - don't use with olibs.

Add --extra-cflags="-DHAVE_LOCALTIME_R" to Portfile to avoid duplicate symbol with OS library (see http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2004-April/025312.html)

Edit 'configure' to remove -mdynamic-no-pic flag. This flag leaves relocatable entries in the read-only TEXT section of the static library, which prevent openlibraries from linking. Then run 'ranlib' on libav*.a

  • Openlibraries

Ensure current python includes are in /usr/include e.g. /usr/include/python2.4 (configure script doesn't seem to respect CPPFLAGS so an alternative would be to add -I/opt/local/include to CFLAGS)

Configure using:

./configure --prefix=/opt --with-boostprefix=/opt/local --with-qtinclude=/usr/local/qt/include --with-qtlib=/usr/local/qt/lib --enable-openalframework --with-pythonversion=2.4 --enable-gpl

Currently (7/8/06) openlibraries use incorrect flags when linking the python plugins. They should use -bundle to produce a MH_BUNDLE shared library. However they currently use -dyanmiclib, which produces a dynamic shared libary of type MH_DYLIB. To work around this I have just "hacked" the dylib link by copying the command line, removing -dynamiclib (and associated flags) and replacing with -bundle. This need to be added to the configure/make system.

Jahshaka

Build system is currently very crude. jahwidgets Qt project file relies in pkg-config for openlibraries returning the correct info. So make sure PKG_CONFIG_PATH is set correctly for openlibraries e.g.

export PKG_CONFIG_PATH=/opt/lib/pkgconfig

Also ensure the correct python framework is linked in by setting LDFLAGS appropriately.

And then re-run qmake.

Qt Custom Styles

Symlink the 'themes' plugin to $QTDIR/plugins/styles so that the QStyleFactory can load the plugin. (The alternative is to directly link to the themes dylib and call QApplication::setStyle( new Style )).

Running Jahshaka etc

Using Official Python Distribution:

python jahplayer.py

Or create a Mac application bundle:

The easiest way to do this is to use py2app (download directly from [http://undefined.org/python/#py2app], the darwinport is broken):

py2applet --make-setup /path/to/python/script.py

Create an "alias" bundle for devleopment

python setup.py py2app -A

Additionally for jahshaka the required "PYTHONPATH" entries must be added to dist/jahshaka.app/Contents/Resources/boot.py e.g;

_path_inject(/opt/lib/python2.4/site-packages?) _path_inject(/Users/socrates/projects/Contracts/Jahshaka/jah/jahwidgets/src/qt3/python?) # Do this last to set the pwd _path_inject(/Users/socrates/projects/Contracts/Jahshaka/jah/jahplayer?)

Also make sure the correct DYLD_LIBRARY_PATH is set in the env.

For more information see: [http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html].

Packaging

1. Create the bundle

jah/installer/osx/create_app jahplayer.py 2.4 ~/Projects/Contracts/Jahshaka/jah/jahwidgets/ /opt 0.4.0 /opt/local/ /usr/local/qt

2. Optionally an agent

../installer/osx/create_agent encoder.py dist/jahplayer.app

3. Dmg

../installer/osx/create_dmg dist jahplayer.dmg "Jahplayer v3"

Debugging

This works best if you create a development application bundle (as described above).

gdb ./dist/jahplayer.app/Contents/MacOS/jahplayer

Using gdb via the python binary generally doesn't work.