Building:Mac:SCons

From FIFE development wiki
(Redirected from Building:Mac:Scons)
Jump to: navigation, search

Apple-strawberry-32x32.png Platform-dependent information: Mac.

The following passage contains information that is specific to PPC and Intel-x86-based Macintosh systems.

Introduction

BIG NOTE!!! FIFE now compiles on Snow Leopard(10.6). See this post for more information!

This guide explains how to compile FIFE on your PPC and Intel x86 Macintosh system with SCons.

What you need

Getting started

In order to build FIFE you will have to install everything required to actually build the project.

  • Download and install Xcode for your version of macOS:
    • Go to Apple Developer Connection website. Downloads -> Developer Tools : browse for latest Xcode for you version (eg.10.x). - You need to be logged in (free account)
  • Download and install MacPorts for your version (eg. 10.x).
  • Install Scons (included in MacPorts). Type the following in a terminal window:
Command.png
sudo port install scons
 


NOTE:If you already have SCons - you might have to run the (internal) update function on it, otherewise your packages will be out of date. It did not appear to be automatic.

NOTE: You don't need to use MacPorts if you are comfortable with compiling the required libraries from source on your own. Also, if you want more compatibility for older versions of Mac OSX you will have to switch the version of gcc you are using to 3.3 and install all the required libraries from source. Please see the NOTE at the bottom of this page for more info. As of writing this document MacPorts v1.5.0 is the newest and it can be downloaded from here. Installing it is as simple as double clicking on it and going through the install steps.


Build/Install the prerequisties

  • SDL and frameworks
Command.png
sudo port install libsdl libsdl_ttf libsdl_image
 
  • Install boost and boost-jam:
Command.png
sudo port install boost
 
Command.png
sudo port install boost-jam
 
  • Install libogg and libvorbis:
Command.png
sudo port install libogg libvorbis
 
  • Install SWIG:
Command.png
sudo port install swig swig-python
 
  • Install Guichan
  • To install guichan X11 you will need to grab your Mac OS install disc and launch the Optional Installs installer package and check the box to install X11 (Alternatively you can install the X11SDK from Xcode\Packages\Packages\x11SDK.pkg) After this step has been completed you can continue the install by running:
    Command.png
    sudo port install libguichan
     

Obtain and build the engine

  • If you do not already have subversion installed, install it using MacPorts
    Command.png
    sudo port install subversion
     
  • Download the latest source from the svn repository
    Command.png
    svn co svn co http://fife.svn.cvsdude.com/engine/trunk
     
  • If you need to change any of the include or library paths, edit the File.png build/darwin-config-dist.py file
  • Build the engine by executing SCons. In the Folder.png trunk directory in the fife project directory type:
    Command.png
    scons
     
  • If all goes well, you should have the following built binary:
    • File.png engine/python/fife/_fife.so


NOTE:Due to the ever-changing C++ ABI, the resulting binaries will only run on OS X versions compatible with the version of gcc you used during the build. For instance, if you build using gcc 4.0, then the resulting binaries will not run on OS X < 10.3.9. Depending on the version of MacPorts you used the binary you create will only be compatible with the version of Mac OS you are using. For better compatibility you will have to install all the required libraries from source and use gcc_select to change to gcc 3.3. Also remember, that the compiled binaries are specific to the architecture they were compiled on. I am working on build instructions for a Universal Binary which will run on both Intel and PPC Macs on OS X >= 10.2. For more information on ABI incompatibilities across OS X versions and Universal Binaries, please see the Apple Developer Connection site.

UnitTest++ (optional)

You can optionally install UnitTest++ using macports if you want to build FIFE's unit test programs. To install it type:
Command.png
sudo port install unittest-cpp
 

Troubleshooting

  • If you are getting a "wrong version" error from python (I got one importing fife or _fife) then you probably have python24 (or another olderversion) installed somewhere and the library is getting linked or otherwise incorporated. I removed python24 (I had both Fink and MacPorts versions!) and it worked fine. This error occurred at run time, after successful compile, but you have to rebuild with
    Command.png
    scons -c
     
    and then
    Command.png
    scons
     
    .
Personal tools