# Compilation of Ultimate Stunts

In a perfect world, compilation would be the same on all OS platforms. However, there are some differences that make compilation a bit harder on some systems. Ultimate Stunts is developed under Linux, and will typically compile best on Linux or similar UNIX-style systems. It can also be compiled on some other systems:

- On windows, Cygwin can be used as a UNIX environment. You can download Cygwin with all the required packages (see below) and follow the instructions in the rest of this document. UltimateStunts will be kept portable with Cygwin during it's development.
- While Mac OS X is based on a UNIX-kernel, Apple has added a lot of "features" that make it less compatible with typical UNIX systems. A separate compilation manual for Mac OS X is available.

### Requirements

To compile UltimateStunts, you'll need a UNIX-compatible system with a c/c++ compiler. You'll also need the programs 'make' and 'pkg-config', and a shell-program able to execute the configure-script.

Of course you should also have the right library's and development-packages installed. The programs that use graphics need the openGL, SDL and SDL_image libraries (and things needed by openGL and SDL). The non-graphical programs (such as the server) can also use SDL, but it may be possible to compile them without SDL. Sound support using the FMOD or the OpenAL library is optional: if you don't have FMOD or openAL, Ultimate Stunts will compile without sound support. if you have both, Ultimate Stunts will use OpenAL by default. Additionally, if OpenAL is used for sound, Ultimate Stunts can use libvorbisfile for loading Ogg Vorbis sounds and music. Without libvorbisfile, Ultimate Stunts depends on an extension of the ALUT library for loading Ogg files, and this extension is often not present.

You can find the necessary libraries here:

- FMOD
- OpenAL
- Vorbisfile
- SDL
- SDL_image

If you want to use OpenAL, don't forget to install the ALUT library too.

Most Linux distributions provide the necessary libraries as packages. Usually, FMOD is not included (as it is non-free software), but you can always use OpenAL instead. If you install these libraries through a package-management system, don't forget to install the development packages: they are necessary for compiling Ultimate Stunts (for running it, you only need the runtime packages). To give you an idea of what kind of packages to install, these are the package names in Ubuntu 10.04:

- libsdl1.2debian
- libsdl1.2-dev
- libsdl-image1.2
- libsdl-image1.2-dev
- libopenal1
- libopenal-dev
- libalut0
- libalut-dev
- libvorbisfile3
- libvorbis-dev

### Libraries for Cygwin

Because getting the libraries for Cygwin can be difficult, I decided to help you by providing Cygwin packages for SDL and SDL_image, and for OpenAL. They should be extracted in the Cygwin root directory, and then they will be ready to be used by Ultimate Stunts. In order to use vorbisfile in Cygwin, you should not only install the libvorbis-devel package, but also pkg-config.

### FMOD header files

(Only relevant if you want to use FMOD instead of OpenAL)
Ultimate Stunts assumes that the FMOD header files can be found in a subdirectory "fmod" somewhere in the default include search path. A good place to put fmod.h etc. would be /usr/include/fmod. The FMOD shared object file can be placed e.g. in /usr/lib. Ultimate Stunts expects libfmod.so to be present, so maybe you need to create a symlink (like "ln -s libfmod-371.so libfmod.so").

### Compiling

Problems during compilation can be very difficult to solve if you are not a developer, but as long as it doesn't give any problems, compiling is simple.

First of all you should have downloaded the source package, and have it extracted in a directory. Then, Ultimate Stunts should be configured for compiling on your system. So, run the configure- script:

    ./configure

If everything has worked well, the configure-script has made some files with the name "Makefile". This enables "make" to do the compiling automatically for you. Start make with the following command:

    make

Make will first compile all code that is shared between the different programs. Then it will compile program-specific code and link it all together to form the program binaries. The resulting binaries are located in the program-specific directories.

    make install

The "make install" stage is not necessary for testing the game: you can already run Ultimate Stunts from the source directory with ./execselect.sh or ./ultimatestunts/ustunts. "make install" installs the binaries and data files. It assumes a UNIX-style directory layout, so on other operating systems a manual installation may be more useful. You must run this command as super-user (root). The default locations for the files are /usr/local/bin for the binaries and /usr/local/share/ultimatestunts. After "make install", users can start Ultimate Stunts with the command ustunts (if the location of the binaries is in the user's PATH variable, of course).

### DLL files

Windows users who want to start their binary's from the explorer, from the start menu or any other usual way, should know that all cygwin programs need cygwin1.dll. The ultimatestunts binary also needs additional DLLs, like SDL.dll. Find those files, and place them e.g. in the same directory as the binaries. For starting a networked multiplaying game, some tweaking of the PATH variable may be necessary. See the windows binary package for how I solved it.