Building STK 06 on OSX

This page will explain how I built and packaged SuperTuxKart on mac OS X. This page is also available in German

You could also use OS X frameworks instead of Unix-style libs, this would of course require heavier patching of the STK build system.

Contents

edit

Getting Started

    % sudo ln -s /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/ /usr/local/include/GL

(you might need to create /usr/local/include/ first if you never built and installed anything from source! sudo mkdir -p /usr/local/include/)

From there you can install dependencies either from source or from macports. Using macports might be easier for newcomers, however be warned that macports has a quite high failure rate, and on failure you will need to contact the macports team, the STK team won't be able to provide support for macports. If you don't mind spending some time on it, building from source is more reliable.

edit

Building dependencies from source

edit
Environment
    % cd /path/to/pkg-config-0.22
    % ./configure
    % make
    % sudo make install
edit
Autotools

This step is probably only necessary for OS X 10.4 users who use SVN version of STK (I think) - OS X 10.5 users can skip it. On OS X 10.4, you will want to install more recent autotools (the ones that came with your computer are too old). Before doing this, make sure /usr/local/bin is in your PATH as described above otherwise it won't work (will pick old versions and just ignore the new ones).

It is probably possible to install these with macports to make it quicker.

All the following programs can be built and installed with the following commands on the terminal :

    % cd /path/to/source_file
    % ./configure
    % make
    % sudo make install
        % sudo ln -s /usr/local/bin/m4 /usr/local/bin/gm4
edit
Gettext

Build and install gnu gettext using regular ./configure && make && sudo make install

edit
ogg/vorbis
    % ./configure
    % make
    % sudo make install
    % ./configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
    % make
    % sudo make install
edit
SDL
    % cd /path/to/SDL-1.2.13
    % ./configure --without-x --disable-x11-video
    % make
    % sudo make install
edit
PLib
    % ./configure
    % make
    % sudo make install


edit

Alternate path : macports

These commands install a bit more stuff than needed, because their author jpenguin needed to build other games too.

sudo port -v install pkgconfig
sudo port -v install plib
sudo port -v install libsdl +quartz
sudo port -v install libogg
sudo port -v install libvorbis
sudo port -v install gettext

OpenAL still causes trouble here, so it's best to use the instructions posted just under.

edit

OpenAL

OpenAL on OS X is a bit of a pain in the a...

    % svn checkout svn://connect.creativelabs.com/OpenAL/trunk openal
    % cd openal
        % sudo cp ./OpenAL-MacOSX/build/Deployment/openal.dylib /usr/local/lib/libopenal.dylib
        % sudo install_name_tool -id /usr/local/lib/libopenal.dylib /usr/local/lib/libopenal.dylib
    % sudo cp -r ./include/AL/  /usr/local/include/AL
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: OpenAL
Description: OpenAL blah blah blah not an official .pc file
Requires:
Version: 1.1.0
Libs: -L${libdir} -lopenal
Cflags: -I${includedir}
edit

Building STK

    % ./autogen.sh (for SVN version only?)
    % ./configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig --enable-debug=no --prefix=/opt/supertuxkart
    % make
    % sudo make install
    % /opt/supertuxkart/games/supertuxkart
edit

Making an app bundle

edit
makeapp.sh
INSTALL_PREFIX="/opt/supertuxkart"

echo "* Removing any existing installation"
rm -rf ./SuperTuxKart.app

echo "* Creating skeleton"
mkdir -p ./SuperTuxKart.app/Contents/Resources
mkdir ./SuperTuxKart.app/Contents/MacOS
cp info.plist ./SuperTuxKart.app/Contents/info.plist
cp stk.icns ./SuperTuxKart.app/Contents/Resources/stk.icns

echo "* Copying executable"
cp $INSTALL_PREFIX/games/supertuxkart ./SuperTuxKart.app/Contents/MacOS/supertuxkart

echo "* Copying data files"
cp -r $INSTALL_PREFIX/share/games/supertuxkart ./SuperTuxKart.app/Contents/Resources/data/

edit
alternative makeapp.sh
INSTALL_PREFIX="/users/jpenguin/supertuxkartirr"

echo "* Removing any existing installation"
rm -rf ./SuperTuxKart.app

echo "* Creating skeleton"
mkdir -p ./SuperTuxKart.app/Contents/Resources
mkdir ./SuperTuxKart.app/Contents/MacOS
cp info.plist ./SuperTuxKart.app/Contents/info.plist
cp stk.icns ./SuperTuxKart.app/Contents/Resources/stk.icns

echo "* Copying executable"
cp $INSTALL_PREFIX/src/supertuxkart ./SuperTuxKart.app/Contents/MacOS/supertuxkart

echo "* Copying data files"
mkdir  ./SuperTuxKart.app/Contents/Resources/data
cp -r $INSTALL_PREFIX/data ./SuperTuxKart.app/Contents/Resources/data/data

echo "* Cleaning up SVN files (IGNORE any error that may appear in this section)"
find ./SuperTuxKart.app/Contents/ -name ".svn" -exec rm -rf '{}' \;
edit
For either makeapp.sh
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>  <string>English</string>
	<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
	<key>CFBundlePackageType</key>  <string>APPL</string>
	<key>CSResourcesFileMapped</key> <true/>
	
	<key>CFBundleName</key>                <string>SuperTuxKart</string>
	<key>CFBundleIconFile</key>            <string>stk.icns</string>
	<key>CFBundleExecutable</key>          <string>supertuxkart</string>
	<key>CFBundleVersion</key>             <string>0.6</string>
	<key>CFBundleShortVersionString</key>  <string>0.6</string>
		
</dict>
</plist>

And run it as :

    % chmod +x makeapp.sh
    % ./makeapp.sh

You should now be able to open it by double-clicking, however you can't send it to another computer.

edit
Getting ready for distribution

Get its sources from http://macdylibbundler.sourceforge.net (version 0.3 or better required), build it and install it.


Issue one of these two depending on your architecture

% dylibbundler -b -x ./SuperTuxKart.app/Contents/MacOS/supertuxkart -d ./SuperTuxKart.app/Contents/libs-ppc/ -od -p @executable_path/../libs-ppc/

% dylibbundler -b -x ./SuperTuxKart.app/Contents/MacOS/supertuxkart -d ./SuperTuxKart.app/Contents/libs-intel/ -od -p @executable_path/../libs-intel/

% lipo -create [ppc-file] [intel-file] -output [filename]

edit
Making a DMG

To make a DMG place your executables in a folder, along with the changelog, data/CREDITS, COPYING, ChangeLog & README, and optionnally a background image. Then open disk utility and create a new disk image from folder; once you select the folder you put your files in, select read/write from the format menu in 2nd dialog.

Using a background image : Once that disk image has been created, open it up. Once the disk image is open, change it to icon view; then select Show View Options from the Veiw menu, select "this window only" and then select "picture", choose your image in your disk image, and close the "view options, then resize the window and position the icon how you want example; next open terminal and type

/developer/tools/setfile -a V ''PATHTOIMAGE''

Then open disk utility back up, click on convert, select the supertuxkart disk image you just made, select "compressed (bzip2)"(Panther does not support bz2 compressed dmgs, `soo unless you want to exclude panther users; use another compressed format) from the format drop-down menu, and click save. Your disk image is complete!

Retrieved from "http://supertuxkart.sourceforge.net/Building_STK_06_on_OSX"

User Tools