Difference between revisions of "Building EDuke32 on Mac OS X" - EDukeWiki

# Difference between revisions of "Building EDuke32 on Mac OS X"

From EDukeWiki

Revision as of 15:55, 21 March 2012 (view source) Hendricks266 (talk | contribs) ← Older edit | Revision as of 22:09, 25 March 2012 (view source) Hendricks266 (talk | contribs) Newer edit →
Line 66: | Line 66:
| == osxbuild.sh Documentation == |  | == osxbuild.sh Documentation ==
− | echo usage: osxbuild [onlyzip] [--buildppc=<0|1>] [--build86=<0|1>] [--build64=<0|1>] [--tools=<0|1>] [--debug=<0|1>] | + | 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]
− | *'''onlyzip''' will skip building the executable and simply package it into a zip file. Mostly for internal use. |
| *The following options take either '''0''' or '''1''' as a parameter to disable or enable the option in a [[binary switch]] fashion. |  | *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. |  | **'''--buildppc''', '''--build86''', and '''--build64''' set the PowerPC, x86, and x86_64 builds respectively.
− | **'''--tools''' builds and installs the Build tools in addition to the main executables. | + | **'''--debug''' sets additional building of the debugging builds. Currently, it defaults to off.
− | **'''--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 == |  | == Frameworks ==

## Revision as of 22:09, 25 March 2012

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

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 ppc is there if you have a PowerPC (G4, G5) Mac and/or are running a version of OS X earlier than Lion.

Now, here's where things start getting a little complicated. The ports you need to install and how you install them depend on what type of Mac you have and what sort of binary you ultimately want to produce. At the very least, you need pkg-config, so start by installing that:

    sudo port install pkgconfig

If you're on a PowerPC Mac or want to create a universal binary that includes PowerPC support (only applicable for Leopard, since Lion has no PowerPC support at all and PowerPC binaries produced under Snow Leopard don't work under Leopard) then you need to make sure you have a set of support frameworks that have PowerPC support built in. That's covered at the end of the Frameworks section toward the end of this document.

Finally, you need to install the libvpx port. This is currently only necessary for the x86_64 build, so if you're on PowerPC you can skip this step entirely, but if you're on an Intel Mac and trying to create a Universal Binary under Leopard, you have to make sure that ppc is absent from your universal_archs line in macports.conf since libvpx doesn't build on PowerPC then just type:

    sudo port install libvpx

again entering your password if prompted.

### 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.

### PowerPC Support

If you're on a PowerPC Mac, you can install the libsdl-framework and libsdl_mixer-framework ports (`sudo port install libsdl-framework libsdl_mixer-framework`) in order to get PowerPC-compatible versions of the frameworks. However, MacPorts installs them in /opt/local/Library/Frameworks. In order to get them into /Library/Frameworks, type the following at a terminal prompt:

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

## 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=10545"
Category:

- Distribution documentation