=======================================
How to Compile xu4 from SVN in Mac OS X
=======================================

This document explains how to download the latest version of the xu4 source
code from SVN and how to compile it in Mac OS X.

You will need to have the Xcode developer tools installed. Get them from
here:

   http://developer.apple.com/technologies/tools/xcode.html
   
For those with Mac OS X version 10.2 or earlier, building with Project Builder
instead of Xcode should be possible.

-------------------------------
Things you only have to do once
-------------------------------

1. Change to the directory where you want XU4 SVN to be checked out to
   e.g. cd ~/
   Check out the current xu4 cvs source code
   svn co https://xu4.svn.sourceforge.net/svnroot/xu4/trunk/u4 xu4

2. Grab SDL-1.2.14.dmg from 
   http://www.libsdl.org/download-1.2.php and doubleclick it to mount 
   the disk image.
   Copy SDL-framework from SDL-1.2.14.dmg to /Library/Frameworks.

3. Copy the contents of devel-lite from SDL-1.2.14.dmg into src/macosx in 
   the checkout of xu4 SVN

4. Grab SDL_mixer-1.2.11.dmg from
   http://www.libsdl.org/projects/SDL_mixer/
   Unpack contents of SDL_mixer-1.2.11.dmg to /Library/Frameworks


5. Grab libpng (universal).dmg
   http://ethan.tira-thompson.org/Mac_OS_X_Ports.html
   Mount the disk image by doubleclicking and install the libpng framework.
   Unfortunately this package is now only for intel machines. If you want to 
   compile for PPC machines, please grab 
   http://xu4.sourceforge.net/download/libpng(ppcintel).dmg

6. Download the Ultima IV data files and gfx update (if desired) and copy
   them into the directory where you put xu4:
      cp path/to/ultima4.zip .
      cp path/to/u4upgrad.zip .
   
7. Change to the src directory of the XU4 source code
      cd u4/src


8. Compile xu4 
      make -f Makefile.macosx
    If you are running on Mac OS X version 10.2 or earlier, the tlkconv utility
    will fail to build correctly. You can build it by executing this command:
      make -f Makefile.macosx mactlkconv
    Finally, execute this command to build the xu4 application bundle:
      make -f Makefile.macosx bundle
    The bundle xu4.app is made in the src folder of the SVN checkout.
    If you want to place the bundle in the Applications folder of OS X execute:
      make -f Makefile.macosx install

------------------------------------------------------------
Things you have to do every time the xu4 source code changes
------------------------------------------------------------

1. Start the Terminal app

2. Change to the xu4 directory
      cd u4

3. Checkout the latest changes from CVS
      svn up

4. Change to the source directory
      cd src

5. Compile xu4
      make -f Makefile.macosx clean
      make -f Makefile.macosx clean-local
      make -f Makefile.macosx install


----------------
Issues with Lion
-----------------

SDL 1.2.14 is broken on OS X Lion when you switch to fullscreen (it crashes). I compiled a 
framework package from SDL 1.2 mercurial which fixes this behavior.
So if you want to compile for Lion, please download http://xu4.sourceforge.net/download/SDL.dmg 
and replace the SDL 1.2.14 framework with the one on this disk image.
