Building EDuke32 on Mac OS X - EDukeWiki

# Building EDuke32 on Mac OS X

From EDukeWiki
Revision as of 22:52, 25 March 2012 by LSDNinja (talk | contribs)
EDuke32 Distribution

Download · Source Code · APT repository · Packages
Building from source on: Linux · Windows · Mac OS X

You can get help here: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/

## Getting source files

- Current version (You need to install the subversion program) :

    svn co https://eduke32.svn.sourceforge.net/svnroot/eduke32/polymer/eduke32

- Source tarballs (Lite subversion snapshots, it does not include metadata, Apple compiled libraries, third-party jaudiolib and Photoshop files).
- Old and Older versions.

## Build Setup

Before you begin, you're going to need a Developer account with Apple. These are free and can be created by heading over to the Mac Dev Center, clicking the 'Register' link toward the top right hand corner and answering a few questions. If you already have an Apple ID, then you can link your developer account to that. Just enter it when it asks and continue through the registration process.

### Compiler

1. Install Xcode.
     Versions of Mac OS X distributed on CD or DVD typically include a version of Xcode, but these are possibly quite old and only the latest versions of Xcode for each supported version of OS X have been tested:
     Leopard (Mac OS X 10.5.x): 3.1.4
     Snow Leopard (Mac OS X 10.6.x): 3.2.6
       Note: The last few versions of Xcode 3.2 for Snow Leopard also include the iOS SDKs which blow the DMG size out to 3GB and beyond. If you want to avoid that then you might be able to substitute version 3.2.2 instead, but bear in mind this hasn't been tested.
     Lion (Mac OS X 10.7.x): 4.3.1 (Although 4.2.1 and 4.3.0 are also known to work under Lion)
       Even though you can download Xcode itself through the App Store without a Developer ID, you still need one later to install the mobile device SDKs when you first run Xcode and to install the command line tools.
     To find the version of Xcode you need go to the Downloads section of the developer center and run a search for that specific version (e.g.: Xcode 3.1.4) using the search box in the top left corner.
2. Download and install the Xcode command line tools (Xcode 4.3.x under Lion only):
     Starting with Xcode 4.3, Apple no longer includes the command line build tools within the standard Xcode distribution. In order to install them you have to open Xcode, go into its preferences dialog (Xcode -> Preferences in the menu bar or Command+,) and, in the 'Downloads' tab, click 'Install' next to 'Command Line Tools'. At this point you'll be prompted for your Developer ID. Just enter it and your password and it should be on its way.

### MacPorts

#### Special notes for 10.5/Leopard users

Users on 10.5 should follow the PowerPC directions (including on how to set up MacPorts), even if they have an Intel Mac since the script assumes PowerPC support when run under Leopard. If you'd rather not build the PowerPC version then follow the Intel directions, remembering to call the osxbuild.sh script with the noppc parameter to prevent the PowerPC version from being built. If your Mac has a 64-bit capable CPU (Core 2 Duo or later), you may also want to enable the 64-bit build as well using the directions that follow.

The 64-bit build is also disabled on Leopard by default. If you wish to enable it and don't care about the PowerPC build then you have to call osxbuild.sh with the `--build64=1 --buildppc=0` command line parameters and follow the Intel directions below. (64-bit here refers to x86_64, there's no equivalent 64-bit build for PowerPC so even if you have a 64-bit capable PowerPC processor, don't enable this unless you're trying to create a three-way universal binary as defined below)

If, on the other hand, you want to compile a three-way universal binary containing the PowerPC, x86 and x86_64 versions, things get a little more complicated. You not only have to manually enable the 64-bit build as outlined above, but you also have to make sure all but one of the dependency ports are compiled three-way universal as well. The procedure here is much the same as the PowerPC directions below, but with a few exceptions: To start with, you need ppc, i386 and x86_64 all in your macports.conf universal_archs line. Use that to install the pkgconfig, libsdl_framework and libsdl_mixer-framework ports, but after you've finished installing those go back into macports.conf and remove ppc from the universal_archs before installing the libvpx port. You can put ppc back afterward if you want, but it's essential to remove it in order to build libvpx.

#### Common Setup

First, install MacPorts. Make sure you have the correct version for your OS X version.

You then need to edit a couple of MacPorts' config files to make sure it builds what's needed correctly. At a terminal prompt, type:

    sudo nano /opt/local/etc/macports/variants.conf

When prompted, enter your password and hit enter then add the following to the end of the file:

    +universal
    +no_x11

Then hold down Ctrl and press X to exit nano. You'll be asked if you want to save the file. Press 'Y'.

Now you have to make sure the architecturally relevant versions of things are being built by typing:

    sudo nano /opt/local/etc/macports/macports.conf

Enter your password again if prompted and then scroll down until you get to the "universal_archs" line and make sure both i386 and x86_64 are in there if you have an Intel Mac (Core Duo, Core 2 Duo, Core i* or Xeon) and that i386 and ppc are there if you have a PowerPC (G4, G5) Mac.

All builds have the pkg-config port in common, so start by installing that:

    sudo port install pkgconfig

Again, entering your password if prompted.

#### PowerPC Macs

Since there are no PowerPC compatible versions of the latest SDL frameworks you need to use MacPorts to compile and install appropriate versions. To do that, type:

    sudo port install libsdl-framework libsdl_mixer-framework

at your terminal and hit enter. A slight hiccup here is that MacPorts installs them into /opt/local/Library/Frameworks and eDuke32 expects to find them in /Library/Frameworks. Fixing that is a simple matter of typing the following at your terminal:

    sudo ln -s /opt/local/Library/Frameworks/SDL.framework /Library/Frameworks/
    sudo ln -s /opt/local/Library/Frameworks/SDL_mixer.framework /Library/Frameworks/

Once that's done you can skip to Final Steps below.

#### Intel Macs

Intel users can download the SDL frameworks from the links below and drag them from the DMG files into /Library/Frameworks (you may be prompted for your password as part of this process).

Intel builds also need the libvpx port. To install that, type:

    sudo port install libvpx

followed by enter.

Finally, continue to running osxbuild.sh as outlined in the next section

### Final Steps

1. The necessary Frameworks should be installed globally.
2. Run `./osxbuild.sh` and hope for the best!

## osxbuild.sh Documentation

    usage: ./osxbuild.sh [options]
    options:
        [--buildppc=<0|1>] [--build86=<0|1>] [--build64=<0|1>]
        [--debug=<0|1>]
        [--main=<0|1>] [--tools=<0|1>]
        [--pack=<0|1>]
    presets:
        [onlyzip] [dist] [disttools] [full]

- The following options take either 0 or 1 as a parameter to disable or enable the option in a binary switch fashion.
  - --buildppc, --build86, and --build64 set the PowerPC, x86, and x86_64 builds respectively.
  - --debug sets additional building of the debugging builds. Currently, it defaults to off.
  - --main controls building of the main executables.
  - --tools controls building and installation of the Build tools.
  - --pack controls creation of a zip file with the results at the conclusion of the process.
- The following options are mutually exclusive and control preset values for the above switches.
  - onlyzip will skip building any executables and simply package the zip file. Mostly for internal use.
  - dist will build all architectures and both release and debug builds of just the main executables, then pack them.
  - disttools will build all architectures and both release and debug builds of just the Build tools.
  - full builds everything.

## Frameworks

EDuke32 requires the following frameworks to function:

- SDL.framework
  - (old versions)
- SDL_mixer.framework
  - (old versions)

The error message at the right will be displayed if these frameworks are not properly installed. You may install these at any or all of the following locations:

- Global: `/Library/Frameworks`
- Per-User: `~/Library/Frameworks`
- Per-App (Portable): `<app bundle>/Contents/Frameworks`

For more information see the relevant article on the Mac OS X Developer Library.

## Game Data

To play the game, the files you need are DUKE3D.GRP and DUKE.RTS. They, as well as any other data you have, such as the HRP, music packs, and mods, can be placed in the following locations, depending on the circumstances in which you want them to be used:

- `/Library/Application Support/EDuke32/`
- `~/Library/Application Support/EDuke32/`
- in the same directory as the .app bundle
- in the same directory as the binary

## External Links

- Deprecated guide: http://www.spam-filter.de/osx/eduke32_on_os_x

Retrieved from "http://wiki.eduke32.com/w/index.php?title=Building_EDuke32_on_Mac_OS_X&oldid=10548"
Category:

- Distribution documentation