[mythtv] Linux to MacOSX cross compilation

Lawrence Rust lvr at softsystem.co.uk
Mon Feb 28 18:50:27 UTC 2011


You may be aware of the Linux to Windows cross compilation script that I
developed.  Well, I've added a few more features to it, the most notable
being Linux to MacOSX cross compilation.

Don't get worried, this isn't a replacement for the current osx-packager
but a tool to improve cross platform compatibility.  That is, ensuring
that sources committed to git can be built on all supported platforms.
The build-bot runs on Linux and would ideally verify that the currently
checked-in sources compile correctly for all supported platforms.

The revised script uses the Open Darwin cctools and Apple's gcc which
provide a gcc 4.0.1 compatible toolchain that supports MacOSX 10.4u and
10.5.  This is a pretty minimal setup and should mean that any Mac can
build and run MythTV.

The cross compiler is very straightforward to build using this script:
http://www.softsystem.co.uk/download/mythtv/mkodcctools

  # Select an installation folder
  export PREFIX=/opt/mac
  sudo mkdir -p $PREFIX
  sudo chown $USER:$USER $PREFIX
  # Create a build folder
  mkdir -p ~/xtools && cd ~/xtools
  # This build script automates the rest
  wget http://www.softsystem.co.uk/download/mythtv/mkodcctools
  chmod +x mkodcctools
  ./mkodcctools
  # Add the cross tools to your path:
  PATH=$PATH:$PREFIX/bin

NB due to Apple licensing conditions, you will be prompted to open an
Apple developer account and download the XCode Tools manually.

The defaults are XCode 2.4.1 and the 10.4 SDK although it's possible to
use a different releases of XCode & SDK as follows:

SDKVER="MacOSX10.5" XCODEVER="3.2.2" ./mkodcctools

Once you have built the cross compiler, get the new MythTV build script
from here:
http://www.softsystem.co.uk/download/mythtv/mythbuild.sh

or here:
git clone http://www.softsystem.co.uk/git/mythbuilder.git

cd to a build folder and cross compile MythTV for MacOSX:

./mythbuild.sh -M

This will build all dependent libraries, including Qt and mysql, from
the same sources used to build the Windows (or Linux) version and
largely with the same configure options where practical.

The product is a set of un-bundled programs and dylibs.  I haven't
verified if they run - it's a bonus if they do.  What is important is
that the source compiles cleanly.

I did find that the current git master needed a few minor patches, which
are include in the latest mythpatches downloaded by the script.  I'll
submit these to Trac.  You can view those changes here:

http://www.softsystem.co.uk/cgi-bin/gitweb.cgi?p=mythbuilder.git;a=blob;f=mythpatches-0.24/mythtv-master/51-macosx.diff;h=1165c87b91c60e4e34c404bdaa25834028a87fc0;hb=HEAD

Comments, criticisms & suggestions please...

-- Lawrence




More information about the mythtv-dev mailing list