Build for MacOSX

From X-Moto
Revision as of 21:45, 18 January 2007 by Christoph (talk | contribs) (Added some paragraphs on how to compile the cvs version using fink)
Jump to: navigation, search

Català - Español

Using MacPorts (old DarwinPorts)

Install dependencies

Libpng

sudo port install -c libpng 

Libjpeg

sudo port install -c jpeg

LibSDL

sudo port install -c libsdl

LibSDL_mixer

sudo port install -c libsdl_mixer

Lua

sudo port install -c lua

Ode

sudo port install -c ode

Get the sources

The unix tarball can be downloaded on http://xmoto.sourceforge.net/

Uncompress

tar zxf xmoto-x.y.z-src.tar.gz
cd xmoto-x.y.z

Compilation

FLAGS

export CPPFLAGS="-I/opt/local/include -I/usr/X11R6/include"
export LDFLAGS="-framework OpenGL -framework Cocoa -L/opt/local/lib -lstdc++ -lSDLmain -lSDL -lSDL_mixer"

Compile

./configure [--prefix=/path_to_install for example: --prefix=/usr/local/xmoto
make

Install

make install

Test

cd /usr/local/xmoto/bin
./xmoto


Compiling the cvs version using fink

This section applies to Mac OS X 10.4.8 on an iBook G4. You should know the basic commands of the shell (Terminal.app).

Prerequisites

The dependencies are the same as for MacPorts, so see above what packages you need to install first. To find all the packages, you will probably need to enable the unstable tree in fink; see the Fink FAQ on how to do this (or give FinkCommander a try, where it is only a mouse click). You should install the packages named "libgettext3-dev", "libgettext3-shlibs" and "gettext" as well (maybe some combination of these solves the src/Makefile-problem mentioned below, I'll have to check that).

Getting the cvs version

Next, get the cvs version of X-Moto. If that's your first access to that version, you need to do a full checkout:

cvs -d:pserver:anonymous@xmoto.cvs.sourceforge.net:/cvsroot/xmoto login
cvs -z3 -d:pserver:anonymous@xmoto.cvs.sourceforge.net:/cvsroot/xmoto co -P xmoto

If you're asked for a password, simply hit return.

If you already have got an older cvs version of X-Moto lying on your hard disc, you can simply go into the directory and type

cvs update

Configure

cd into the directory "xmoto" and configure it:

sh ./bootstrap
./configure --prefix=/Users/foo/bar --with-apple-opengl-framework --with-enable-www=1 --with-enable-zoom=1 CPPFLAGS="-I/sw/include" LDFLAGS="-L/sw/lib"

where --prefix= is optional and can be omitted if you are sure you want to install xmoto into the root directory. I would suggest using a prefix such as /Users/your_username/xmoto/ in order to be able to remove the whole xmoto tree with one command and to not interfere with Mac OS X files and directories.

The next step is needed on my iBook G4 running Mac OS X 10.4, but maybe it works for you without it. If it does, please append the output of "fink list -i gettext" and "uname -p" to this section.

Hack a Makefile to work around a gettext-related bug

Apparently there is a problem that the configure-script doesn't quite recognize how to link correctly with libgettext, although it claims it does. So, what you have to do is: Open src/Makefile in your favorite text editor, find the line that says

LIBS = -lcurl -lode -llualib -llua -lSDL_mixer -lbz2 -lpng -ljpeg -lz

and append ${LIBINTL} so the updated line looks like

LIBS = -lcurl -lode -llualib -llua -lSDL_mixer -lbz2 -lpng -ljpeg -lz ${LIBINTL}

Save the file.

Make and install

This step is the same as in the MacPorts/Compilation part:

make && make install

This should work flawlessly now. If you get a linker error ("ld error") saying something about "intl" oder "gettext", you probably skipped the src/Makefile editing step.

After this command has finished (it may take some time), you should have a working cvs-version of X-Moto installed and should be able to start it from the shell with <prefix>/bin/xmoto.