Compiling for Mac OS X (UFO2000)

From UFOpaedia
Revision as of 05:27, 22 September 2008 by Lonevvolf (talk | contribs) (→‎UFO2000)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

It is possible to run UFO2000 on an Intel-based Mac, running Mac OS X Leopard (other configurations have not yet been tested). With minimal knowledge of file editing and the Terminal, you can compile your own version of UFO2000, and run it natively, without the need for emulators or virtual machines. Simply follow the steps below. It is fully functional, though I have not been able to add in support for music.

Requirements

In order to complete the process, you will need the following software installed:

  • XCode development environment

This can be obtained directly from http://developer.apple.com/technology/xcode.html

  • A text editor of your choice (XCode itself can also be used)
  • Access to an administrator account on your machine

You will be required to enter the password for a few items

All other requirements will be downloaded in the process of compilation.

HawkNL

UFO2000 requires a networking library called HawkNL. As there is no Mac binary available, you will have to compile this first.

  • Download the source for version 1.68 from http://www.hawksoft.com/download/. Version 1.7 beta 1 will NOT work!
  • Navigate to the extracted data in the Finder, and open src/sock.c. Change line 93:
   typedef int socklen_t;

to read

   //typedef int socklen_t;

Save the file.

  • Open a Terminal window, and navigate to the folder where you extracted the zip file. Type the following:
   cd src
   make -f makefile.osx
   sudo make -f makefile.osx install

(type the admin password when prompted)

This will install the HawkNL libraries, for use in the next steps.

Allegro

UFO2000 also requires the Allegro libraries. Like HawkNL, there is no Mac binary available. You must compile this as well.

    chmod +x fix.sh
    ./fix.sh macosx
    make depend
    make
    sudo make install

(type the admin password if prompted)

UFO2000

So now we're ready to compile UFO2000 itself. First, you will have to get the source code for the program. The best thing to do, is get the latest code directly from Subversion. This also has folders for specific releases, if you would like to compile the past releases.

  • Open a Terminal, and navigate to where you would like to download the code. Type the following:
svn co https://ufo2000.svn.sourceforge.net/svnroot/ufo2000 ufo2000

The subversion client will connect to the Sourceforge server, and download the entire code base. It can take a few minutes to complete.

  • After it has completed, open the newly created ufo2000 folder in the Finder, and navigate to ufo2000/trunk. This is the latest version of the software, and is what I tested with.
  • Open "makefile" in your text editor, and change line 47:
CX = g++

to read

CX = g++ -nostartfiles
  • Navigate to the source folder in the Terminal, and type the following:
export no_dumbogg=1
make

This will compile the entire application. Once it's finished, simply type:

./ufo2000

to run the game.

Finally, if you have XCOM or TFTD, and want to use the graphics from them, be sure to copy the entire game into the correct folder (ufo2000/XCOM or ufo2000/TFTD).

Enjoy!