Compiling ScummVM/WebOS

From ScummVM :: Wiki
< Compiling ScummVM
Revision as of 13:44, 12 April 2011 by Kayahr (talk | contribs) (Removed notes about unmerged patches.)
Jump to navigation Jump to search

Setting up the Toolchain

Install the WebOS SDK

Download the latest WebOS SDK from the Palm Developer Center and install it. This is an Ubuntu package for x86 but it also works on Debian and even on x86_64 as described on the download page. When successful you will end up with a /opt/PalmSDK/Current directory and you are able to call programs like palm-package from the command-line. The SDK needs a Java 6 Runtime Environment so you have to install that, too.

sudo apt-get install openjdk-6-jre
wget https://cdn.downloads.palm.com/sdkdownloads/2.1.0.519/sdkBinaries/palm-sdk_2.1.0-svn409992-pho519_i386.deb
sudo dpkg -i --force-architecture palm-sdk_2.1.0-svn409992-pho519_i386.deb

Install the WebOS PDK

The PDK is needed for compiling native applications for WebOS. Unfortunately Palm doesn't provide an official PDK for Linux. But the PDK is a pretty simple piece of software which can be hacked together by using the PDK for MacOS X and replacing the Mac binaries of the toolchain with the corresponding linux binaries. The linux-webos-pdk project can be used for creating a WebOS PDK for Linux:

sudo apt-get install wget p7zip-full pax patch git
git clone git://github.com/kayahr/linux-webos-pdk.git
cd linux-webos-pdk
./linux-webos-pdk
sudo mv opt/PalmPDK /opt/PalmPDK

After this the PDK is installed in /opt/PalmPDK.

Environment variables

Build instructions in this article and the ScummVM build system requires that the environment variables WEBOS_SDK and WEBOS_PDK are pointing to the SDK and PDK directories and that the PATH includes the bin directory of the toolchain:

export WEBOS_SDK=/opt/PalmSDK/Current
export WEBOS_PDK=/opt/PalmPDK
export PATH=$PATH:$WEBOS_PDK/arm-gcc/bin

Compiling required libraries

This section describes how to cross-compile all the libraries needed by the WebOS ScummVM port and how to install them into the toolchain. Only static libraries are compiled even when WebOS devices already have some matching shared libraries installed. That's because the App Catalog guidelines currently only allows dynamic linking against the global Standard C/C++, SDL and OpenGL libraries. So we simply statically link everything else.

zlib

zlib is needed to support compressed savefiles.

wget http://palm.cdnetworks.net/opensource/2.1.0/zlib-1.2.3.tar.bz2
tar xvfj zlib-1.2.3.tar.bz2
wget http://palm.cdnetworks.net/opensource/2.1.0/zlib-1.2.3-patches.tgz
tar xvfz zlib-1.2.3-patches.tgz  -O | patch -d zlib-1.2.3
cd zlib-1.2.3
touch NEWS AUTHORS
autoreconf -i
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared
make install

FLAC

FLAC is used for playing sounds in FLAC format.

wget http://downloads.xiph.org/releases/flac/flac-1.2.1.tar.gz
tar xvfz flac-1.2.1.tar.gz
cd flac-1.2.1
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      --disable-largefile --disable-thorough-tests --disable-doxygen-docs \
      --disable-xmms-plugin --disable-cpplibs --disable-rpath \
      --disable-ogg --disable-oggtest
make install

MAD

MAD is used for playing sounds in MP3 format.

wget ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz
tar xvfz libmad-0.15.1b.tar.gz
cd libmad-0.15.1b/
sed -i s/-fforce-mem// configure
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      --enable-speed --enable-fpm=arm --disable-aso
make install

Tremor

Tremor is used for playing sounds in Ogg Vorbis format.

svn co -r 16259 http://svn.xiph.org/trunk/Tremor
cd Tremor
./autogen.sh --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared
make install

Compiling optional libraries

This section describes how to compile third-party libraries which can be used by ScummVM but which are not used for the ScummVM WebOS release.

Ogg

Ogg together with Ogg Vorbis is an optional replacement for Tremor. Currently not used by the ScummVM WebOS release.

wget http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz
tar xvfz libogg-1.2.2.tar.gz
cd libogg-1.2.2
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared
make install

Ogg Vorbis

Ogg Vorbis is an optional replacement for Tremor. Currently not used by the ScummVM WebOS release.

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
tar xvfj libvorbis-1.3.2.tar.bz2
cd libvorbis-1.3.2
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      --with-ogg-libraries=$WEBOS_PDK/device/usr/lib --with-ogg-includes=$WEBOS_PDK/device/usr/include
make install

libpng

libpng is needed for the Broken Sword 2.5 engine. But this engine is not supported in the ScummVM WebOS release and therefore libpng is not needed.

wget http://palm.cdnetworks.net/opensource/2.1.0/libpng-1.2.44.tar.gz
tar xvfz libpng-1.2.44.tar.gz 
cd libpng-1.2.44
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      CPPFLAGS=-I$WEBOS_PDK/device/usr/include LDFLAGS=-L$WEBOS_PDK/device/usr/lib
make install

libmpeg2

libmpeg2 is no longer used by ScummVM.

wget http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz
tar xvfz libmpeg2-0.5.1.tar.gz
cd libmpeg2-0.5.1
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      CPPFLAGS=-I$WEBOS_PDK/include LDFLAGS="-L$WEBOS_PDK/device/lib -Wl,--allow-shlib-undefined"
sed -i s%-L/usr/lib%% src/Makefile
make install

Compiling ScummVM

./configure \
      --host=webos \
      --prefix=/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm \
      --enable-plugins \
      --enable-zlib \
      --enable-tremor \
      --enable-mad \
      --enable-flac
make

Building the WebOS package

make webosrelease

After this the IPK file can be found in the root directory of ScummVM.