Compiling ScummVM/iPhone

From ScummVM :: Wiki
Jump to navigation Jump to search

This page explains how to compile your own version of ScummVM using the iPhone backend.


Setup

Toolchain

First, you'll need to set up the toolchain. We recommend 0.3 (which is the newest version at time of writing), any other and you might have to do some manual modifications to the build process.

Important: If you want to compile the ARM ASM optimizations for SMUSH and sound (and otherwise you'll have to manually change the configure script to remove them), you'll have to apply a patch to the toolchain before compiling/installing it (so it can handle our asm files).

Download the patch here.

Apply it in the iphone-dev directory like so:

patch -p0 < iphone-toolkit-scummvm-1.patch

External libs

Then, set up any of the external libs you might want. Meaning libMAD for MP3 playback, libFLAC for FLAC support and/or Tremor for Ogg support. You can add mpeg2dec as well, but it's only used for MPEG2 BS1/2 cutscene support and you really should be using the DXA versions instead (can be downloaded from ScummVM's download page.

Note that you only need to add these if you need support for those filetypes, ScummVM will run fine without them.

The below script is what I use to configure these libraries:

#!/bin/bash
export CC='/usr/local/bin/arm-apple-darwin-gcc -v'
export CXX='/usr/local/bin/arm-apple-darwin-g++'
export LD=$CC
export LDFLAGS="-L/usr/local/arm-apple-darwin/lib/ -Wl,-lstdc++,-lgcc_s.1"
./configure --host=arm-darwin --prefix=/usr/local/arm-apple-darwin/

After that, 'make' and 'make install' should do the trick.

ScummVM

Then, we need to configure ScummVM itself.

Below is the script I use for this:

#!/bin/bash
export CC='/usr/local/bin/arm-apple-darwin-gcc -v'
export CXX='/usr/local/bin/arm-apple-darwin-g++'
export LD=$CC
export LDFLAGS="-L/usr/local/arm-apple-darwin/lib/ -Wl,-lstdc++,-lgcc_s.1"
export CXXFLAGS="-Wl,-lstdc++,-lgcc_s.1 -I/usr/local/arm-apple-darwin/include/"
export OBJCFLAGS="-I/usr/local/arm-apple-darwin/include/"
./configure --host=iphone --disable-mt32emu --disable-scalers  --enable-release --with-flac-prefix=/usr/local/arm-apple-darwin/

Note that the --with-flac-prefix is only necessary if you want to include FLAC support.

If you've installed the external libs in any other place than /usr/local/arm-apple/darwin, you need to tell ScummVM where to find them at this point as well (additional flags to ./configure).

Compiling

First, you need to specify which assembler to use, since ScummVM's configure system currently doesn't do this automatically for us.

export AS=/usr/local/bin/arm-apple-darwin-as

Then, we can start the compile:

make iphone

Lastly, we want to make a ScummVM.app bundle:

make iphonebundle

Then simply upload the whole ScummVM.app directory to your device under the /Applications folder, and you're done!