Difference between revisions of "Compiling ScummVM/iPhone"

From ScummVM :: Wiki
Jump to navigation Jump to search
Line 7: Line 7:
First, you'll need to set up the [http://www.saurik.com/id/4 toolchain]. Earlier versions than the one linked will NOT work.
First, you'll need to set up the [http://www.saurik.com/id/4 toolchain]. Earlier versions than the one linked will NOT work.


=== External libs ===
=== Environment variables ===
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 [http://scummvm.org/downloads.php ScummVM's download page].
You'll need to set some environment variables for both the external libraries, and ScummVM itself. This is so the right compiler and libraries will be used.


Note that you only need to add these if you need support for those filetypes. ScummVM itself will run fine without them.
The below script should usually do the trick for these:
  export SDKROOT=<your toolkit directory>
  export SDKROOT=<your toolkit directory>
  export SYSROOT="$SDKROOT/sys"
  export SYSROOT="$SDKROOT/sys"
  export BUILDENV="$SDKROOT/pre"
  export BUILDENV="$SDKROOT/pre"
  export FDIR="$SYSROOT"
  export FDIR="$SYSROOT"
  export CC="$BUILDENV/bin/arm-apple-darwin9-gcc -v"
  export CC="$BUILDENV/bin/arm-apple-darwin9-gcc -v"
  export CXX="$BUILDENV/bin/arm-apple-darwin9-g++"
  export CXX="$BUILDENV/bin/arm-apple-darwin9-g++"
  export LD=$CC
  export LD=$CC
  export SHAREDOPTS="-isysroot $SYSROOT -fobjc-abi-version=2 -I$SDKROOT/include"
  export SHAREDOPTS="-isysroot $SYSROOT -fobjc-abi-version=2 -I$SDKROOT/include"
  export FRAMEWORKS="-F$FDIR/System/Library/PrivateFrameworks/ -F$FDIR/System/Library/Frameworks/"
  export FRAMEWORKS="-F$FDIR/System/Library/PrivateFrameworks/ -F$FDIR/System/Library/Frameworks/"
  export LDFLAGS="-L$BUILDENV/arm-apple-darwin9/lib/ $FRAMEWORKS $SHAREDOPTS -bind_at_load -lobjc"
  export LDFLAGS="-L$BUILDENV/arm-apple-darwin9/lib/ $FRAMEWORKS $SHAREDOPTS -bind_at_load -lobjc"
  export CXXFLAGS="-I$SYSROOT/usr/include $SHAREDOPTS"
  export CXXFLAGS="-I$SYSROOT/usr/include $SHAREDOPTS"
  export OBJCFLAGS="-I$SYSROOT/usr/include/ $SHAREDOPTS --std=c99"
  export OBJCFLAGS="-I$SYSROOT/usr/include/ $SHAREDOPTS --std=c99"
export CFLAGS="$CXXFLAGS"
export AS=$SDKROOT/pre/bin/arm-apple-darwin9-as


export CFLAGS="$CXXFLAGS"


export AS=$SDKROOT/pre/bin/arm-apple-darwin9-as
=== 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 [http://scummvm.org/downloads.php ScummVM's download page].
 
Note that you only need to add these if you need support for those filetypes. ScummVM itself will run fine without them.


The below should usually do the trick for these:
  ./configure --host=arm-darwin --prefix=$SDKROOT/sys/
  ./configure --host=arm-darwin --prefix=$SDKROOT/sys/
  make && make install
  make && make install
Line 41: Line 39:
Then, we need to configure ScummVM itself.
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.
./configure --host=iphone \
--disable-mt32emu --disable-scalers  --enable-release \
--with-flac-prefix=/$SYSROOT/usr/local \
--with-mad-prefix=/$SYSROOT/usr/local \
--with-mpeg2-prefix=/$SYSROOT/usr/local \
--with-tremor-prefix=/$SYSROOT/usr/local


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).
Note that the --with-flac-prefix (and the rest) is only necessary if you want to include support for that specific library.


== Compiling ==
If you've installed the external libs in any other place than $SYSROOT/usr/local, you need to use that location instead.


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
== Compiling ==


Then, we can start the compile:
Now, we can start the compile:


  make iphone
  make iphone

Revision as of 07:29, 13 September 2008

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. Earlier versions than the one linked will NOT work.

Environment variables

You'll need to set some environment variables for both the external libraries, and ScummVM itself. This is so the right compiler and libraries will be used.

export SDKROOT=<your toolkit directory>
export SYSROOT="$SDKROOT/sys"
export BUILDENV="$SDKROOT/pre"
export FDIR="$SYSROOT"
export CC="$BUILDENV/bin/arm-apple-darwin9-gcc -v"
export CXX="$BUILDENV/bin/arm-apple-darwin9-g++"
export LD=$CC
export SHAREDOPTS="-isysroot $SYSROOT -fobjc-abi-version=2 -I$SDKROOT/include"
export FRAMEWORKS="-F$FDIR/System/Library/PrivateFrameworks/ -F$FDIR/System/Library/Frameworks/"
export LDFLAGS="-L$BUILDENV/arm-apple-darwin9/lib/ $FRAMEWORKS $SHAREDOPTS -bind_at_load -lobjc"
export CXXFLAGS="-I$SYSROOT/usr/include $SHAREDOPTS"
export OBJCFLAGS="-I$SYSROOT/usr/include/ $SHAREDOPTS --std=c99"
export CFLAGS="$CXXFLAGS"
export AS=$SDKROOT/pre/bin/arm-apple-darwin9-as


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 itself will run fine without them.

The below should usually do the trick for these:

./configure --host=arm-darwin --prefix=$SDKROOT/sys/
make && make install

ScummVM

Then, we need to configure ScummVM itself.


./configure --host=iphone \ --disable-mt32emu --disable-scalers --enable-release \ --with-flac-prefix=/$SYSROOT/usr/local \ --with-mad-prefix=/$SYSROOT/usr/local \ --with-mpeg2-prefix=/$SYSROOT/usr/local \ --with-tremor-prefix=/$SYSROOT/usr/local

Note that the --with-flac-prefix (and the rest) is only necessary if you want to include support for that specific library.

If you've installed the external libs in any other place than $SYSROOT/usr/local, you need to use that location instead.


Compiling

Now, 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!