Compile for Mac

From UFO:AI

Jump to: navigation, search

Contents

General

If you don't want to build a disc image, and just would like to compile the game for your machine, you should go the None universal binaries way.

None universal binaries

Step 1. Install macports

Instructions are at http://guide.macports.org/#installing This will have you install Apple's X11 (not sure why it is needed), the xcode development environment (needed for the compiler, etc), and the macports program.

Step 2: Install SDL

As of june 2010, SDL in macports is broken on PPC. It always defines the byteorder as x86 (backwards).

To fix this:

sudo port configure libsdl +universal

Edit the SDL_config.h in both the ppc and i386 directory. Delete the lines for BYTEORDER -- this will cause the other headers to check the actual cpu type and set it correctly.

Underneath /opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/libsdl

sudo port install libsdl-framework
sudo port install libsdl_mixer-framework libsdl_ttf-framework libsdl_image-framework

Step 3: Install other libs and tools

sudo port install libtheora XviD git-core p7zip

Now you should be able to fetch UFO-AI and compile it.

Universal binaries

Install the libraries gettext, openssl, libpng and libjpeg from MacPorts using the +universal variant (this is currently broken for libjpeg so you have to follow the manual steps described here):

port install pkgname +universal

Add --enable-universal when running configure:

./configure --enable-universal

Please note that it does not seem possible to build Radiant as a universal package at this time.


Step 1: Install XCode, X11, Mac Ports. Requires downloading .dmg's and other mousing around. (As of Aug 29, 2009 libsdl will not install on Mac OS X 10.6 via macports)

Step 1.5: Gtk2 will not build universal out of macports currently. Glib2 is broken on PPC's, and ncursesw is broken for universal compilation. Until these are fixed, fetch gtk+2 frameworks from http://gtk-osx.org/. NB: This is not production quality code yet. Do not expect radiant to run.

Step 2: Run the following shell script: This will request your password (for a "sudo" command), and the first time it will ask you to verify an SSL certificate fingerprint (for the svn checkout).

#!/bin/sh
set -e # Abort on any error

sudo port -d selfupdate
sudo port -d upgrade outdated

# gtkglext requires gtk2; gtk2 requires glib2. They do not need to be
# explicitly mentioned. 

sudo port install libsdl_image +universal libsdl_ttf +universal libsdl_mixer +universal \
 jpeg +universal libpng +universal XviD +universal libtheora +universal gtkglext +universal gtksourceview2 +universal # openal +universal

# OpenAl is part of Mac os from 10.4 on.
# I don't know how up-to-date it is, but the version in macports is both
# out of date and does not support universal.

./configure --enable-universal
make
make uforadiant
make macinstaller

If you have already non-universal ports installed, you have to uninstall them first by typing e.g.:

sudo port -f uninstall glib2
sudo port clean glib2
sudo port -v install glib2 +universal

If you are having trouble getting things to compile, be aware that most of the issues come from installing autoconfig/automake as universal. This doesn't actually need to be universal unless you are a file server for multiple arch development environments.

To work around this (the problem is in "ncursesw"), use the following command:

sudo port install libiconv +universal expat +universal automake libsdl_ttf +universal \
libsdl_mixer +universal jpeg +universal libpng +universal XviD +universal libtheora +universal

Automake (needed for building X-based stuff) ultimately needs gettext; gettext uses libiconv and expat (both of which build universal), and ncursesw (which does not). Gettext cannot compile universal until this is fixed.

Note that this does not solve the gimp stuff -- gtkglext, gtksourceview, which use gtk2 and glib2 (broken on PPC in macports at this time) -- used by radiant.

First, run the configure script.

./configure

In latest svn version, UFORadiant is enabled by default. This might fail on a mac as it depends on various external libraries like pkg-config, gtk+ etc. To disable UFORadiant, simply

./configure --disable-uforadiant

Compilation

To compile the binaries, just type (after the configure call was successful).

make

after that, you need to create the languages and maps

make lang models maps-sync

To create the application bundle, just type

make macinstaller
Personal tools