=======================================
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 CVS 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/tools/macosxtools.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. Grab SDL-1.2.14.dmg and SDL-devel-1.2.14-extras.dmg from 
   http://www.libsdl.org/download-1.2.php
   Unpack contents of SDL-1.2.14.dmg to /Library/Frameworks
   Contents of SDL-devel-1.2.14-extras.dmg will be extracted in step 

2. Grab SDL_mixer-devel-1.2.5.pkg.tar.gz from
   http://www.libsdl.org/projects/SDL_mixer/
   Unpack contents of SDL_mixer-1.2.11.dmg to /Library/Frameworks

3. Grab xu4_libxml_osx.dmg.gz from
   http://xu4.sourceforge.net/download/xu4_libxml_osx.dmg.gz
   Unpack and open the .dmg. Copy the libxml frameworks into
   /Library/Frameworks
   If you have older versions of the libxml and libiconv frameworks from
   previous xu4 development, you need to remove them first.

4. Grab libpng-1.2.44.tar.gz (with config) from
   http://www.libpng.org/pub/png/libpng.html
   Unpack it into a temporary directory. Then run the following commands
   using the Terminal app:
      cd libpng-1.2.44
      cp scripts/makefile.std Makefile
   Edit Makefile and change the ZLIBLIB and ZLIBINC lines to:
      ZLIBLIB=/usr/lib
      ZLIBINC=/usr/include
   Execute the following command:
      make

5. Change to the directory where you want XU4 cvs
   e.g. cd ~/

6. Check out the current xu4 cvs source code
	svn co https://xu4.svn.sourceforge.net/svnroot/xu4/trunk/u4 xu4

7. 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 .

8. Copy or move the libpng-1.2.44 directory containing the libpng headers
   and library to the same directory:
      cp -R path/to/libpng-1.2.44 libpng
   Alternatively you can edit u4/src/Makefile.macosx and change the LIBPNGDIR
   line to point to the correct location for the libpng headers and library.
   
9. Change to the src directory of the XU4 source code
      cd u4/src

10. Copy the files SDLMain.h and SDLMain.c into the 'macosx' dir
	You can get them from SDL-devel-1.2.14-extras.dmg/SDLMain/NIBless
	Copy them into src/macosx
	(see step 1, if you haven't downloaded the .dmg file yet)

11. 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 install
    This will place the bundle in the directory from which you checked out xu4.

------------------------------------------------------------
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 install

