Mac OS X Compile Guide (2.1)

From WarzoneWiki

Jump to: navigation, search

NOTE: These are instructions for building Warzone 2.1 on OS X 10.4 (Tiger) and may not work on Leopard, although the steps may be similar.

Contents

Obtain Xcode

Obtain Xcode (2.4.1 or 2.5 for Tiger) from an OS X installation CD or from the Apple developer website (account required).

Obtain/Build Bison

Download GNU Bison 2.3 or newer as the version shipping with OS X Tiger is old (version 1.28) and does not properly parse the files included in Warzone 2100. Extract the downloaded Bison archive, open Terminal.app, and run the following commands:

cd /bison_src_directory
./configure             # Configure the build environment
make                    # Compile the source
sudo make install       # Install Bison (default directory is /usr/local/bin/).
  • Make sure to replace bison_src_directory with the path to the Bison source

If using Xcode 2.4.1

Next modify your PATH environmental variable, if needed, so that Bison 2.3 is used instead of the default OS X Bison. If you installed Bison to the default directory, type:

export PATH=/usr/local/bin:$PATH

In order to keep this setting across Bash sessions, add this line to the file "~/.profile" (which may not exist). To confirm that Bison 2.3 is in use, type:

bison --version

and look for the string:

bison (GNU Bison) 2.3

If using Xcode 2.5

Xcode 2.5 uses the version of Bison in "/Developer/usr/bin/". To backup the old version of Bison and to create a symlink from Bison 2.3 to the location Xcode will expect Bison, type:

sudo mv /Developer/usr/bin/bison /Developer/usr/bin/bison-1.28 && sudo ln -s /usr/local/bin/bison /Developer/usr/bin/bison

(you may need to substitute "/usr/local/bin/bison" with the path to your Bison 2.3 if the default install directory was not used).

Obtain/Build Warzone 2.1 Source

Obtain Warzone 2.1 source from http://wz2100.net/download or from the Warzone SVN repository at http://svn.gna.org/svn/warzone (use either the trunk or branches/2.1). To build Warzone, run:

cd /warzone_src_directory/macosx
xcodebuild -project Warzone.xcodeproj -target Warzone -configuration Release
  • Make sure to replace warzone_src_directory with the path to the Warzone source
  • Replace "-configuration Release" with "-configuration Debug" for the debug version


A prompt on whether or not to accept the repository's SSL certificate will be displayed. Enter 'p' to accept the certificate permanently, 't' to accept the certificate temporarily, or 'd' to reject the certificate (required build data will not be downloaded).

If there are any errors during the build, try to build the code a second time (this sometimes rectifies the problem). The outputted .app file will be "/warzone_src_directory/macosx/build/Release/Warzone.app" (or "/warzone_src_directory/macosx/build/Debug/Warzone.app" if the debug version was built).

If you get the error:

dyld: Library not loaded: /usr/X11R6/lib/libfontconfig.1.dylib
 Referenced from: Warzone.app/Contents/MacOS/../Frameworks/QuesoGLC.framework/Versions/A/QuesoGLC
 Reason: image not found 

when starting Warzone from the terminal (see bug #11619), run the following commands:

sudo ln -s /usr/X11R6/lib/libfontconfig.1.0.dylib /usr/X11R6/lib/libfontconfig.1.dylib
sudo ln -s /usr/X11R6/lib/libfreetype.6.3.dylib   /usr/X11R6/lib/libfreetype.6.dylib
sudo ln -s /usr/X11R6/lib/libexpat.0.4.dylib      /usr/X11R6/lib/libexpat.0.dylib

Be patient the first time you run Warzone; it may take a minute or two to start up (possibly due to config files, etc. being created?).