Difference between revisions of "Compiling ScummVM/WebOS"

From ScummVM :: Wiki
Jump to navigation Jump to search
m (Removed notes about unmerged patches.)
m (Add notice about no longer existing Palm App Catalog)
 
(16 intermediate revisions by the same user not shown)
Line 3: Line 3:
=== Install the WebOS SDK ===
=== Install the WebOS SDK ===


Download the latest [https://developer.palm.com/content/resources/develop/sdk_pdk_download.html WebOS SDK] from the [https://developer.palm.com/ 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.
Download the latest [https://developer.palm.com/content/resources/develop/sdk_pdk_download.html WebOS SDK] from the [https://developer.palm.com/ Palm Developer Center] and install it. The Ubuntu package is for x86 but it also works on Debian and even on x86_64 as described on the download page. When successfully installed you will end up with a ''/opt/PalmSDK/Current'' and a ''/opt/PalmPDK'' 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.


<syntaxhighlight type="bash">
'''Palm has removed the download pages for the WebOS PDK. The old download page is [https://web.archive.org/web/20130527051214/https://developer.palm.com/content/resources/develop/sdk_pdk_download.html archived here]. The files are also [http://www.ailis.de/~k/permdata/20140715/palm/ archived here]'''.
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
</syntaxhighlight>


=== Install the WebOS PDK ===
=== Fixing 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
Since [https://github.com/scummvm/scummvm/commit/4d13d44f8a2db8f887e285dbcbd3bb75ccc0ae2e Commit #4d13d44] ScummVM includes some SDL headers which are incorrectly configured in the WebOS PDK. This causes X11 related error messages (WebOS has no X11). To fix this simply edit the file ''/opt/PalmPDK/include/SDL/SDL_config.h'' and remove or comment-out the following line:
using the PDK for MacOS X and replacing the Mac binaries of the toolchain with the corresponding linux binaries. The [https://github.com/kayahr/linux-webos-pdk linux-webos-pdk project] can be used for creating a WebOS PDK for Linux:


<syntaxhighlight type="bash">
<syntaxhighlight type="c">
sudo apt-get install wget p7zip-full pax patch git
#define SDL_VIDEO_DRIVER_X11 1
git clone git://github.com/kayahr/linux-webos-pdk.git
cd linux-webos-pdk
./linux-webos-pdk
sudo mv opt/PalmPDK /opt/PalmPDK
</syntaxhighlight>
</syntaxhighlight>
After this the PDK is installed in ''/opt/PalmPDK''.


=== Environment variables ===
=== Environment variables ===
Line 45: Line 34:


<syntaxhighlight type="bash">
<syntaxhighlight type="bash">
wget http://palm.cdnetworks.net/opensource/2.1.0/zlib-1.2.3.tar.bz2
wget http://downloads.help.palm.com/opensource/3.0.5/zlib-1.2.3.tar.bz2
tar xvfj 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
wget http://downloads.help.palm.com/opensource/3.0.5/zlib-1.2.3-patches.tgz
tar xvfz zlib-1.2.3-patches.tgz  -O | patch -d zlib-1.2.3
tar xvfz zlib-1.2.3-patches.tgz  -O | patch -d zlib-1.2.3
cd zlib-1.2.3
cd zlib-1.2.3
touch NEWS AUTHORS
touch NEWS AUTHORS
autoreconf -i
autoreconf -i
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 65: Line 55:
cd flac-1.2.1
cd flac-1.2.1
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      --disable-largefile --disable-thorough-tests --disable-doxygen-docs \
    --disable-largefile --disable-thorough-tests --disable-doxygen-docs \
      --disable-xmms-plugin --disable-cpplibs --disable-rpath \
    --disable-xmms-plugin --disable-cpplibs --disable-rpath \
      --disable-ogg --disable-oggtest
    --disable-ogg --disable-oggtest \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O1"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 81: Line 72:
sed -i s/-fforce-mem// configure
sed -i s/-fforce-mem// configure
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
      --enable-speed --enable-fpm=arm --disable-aso
    --enable-speed --enable-fpm=arm --disable-aso \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 92: Line 84:
svn co -r 16259 http://svn.xiph.org/trunk/Tremor
svn co -r 16259 http://svn.xiph.org/trunk/Tremor
cd Tremor
cd Tremor
./autogen.sh --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared
./autogen.sh --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 108: Line 101:
tar xvfz libogg-1.2.2.tar.gz
tar xvfz libogg-1.2.2.tar.gz
cd libogg-1.2.2
cd libogg-1.2.2
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 121: Line 115:
cd libvorbis-1.3.2
cd libvorbis-1.3.2
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
./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
    --with-ogg-libraries=$WEBOS_PDK/device/usr/lib --with-ogg-includes=$WEBOS_PDK/device/usr/include \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 134: Line 129:
cd libpng-1.2.44
cd libpng-1.2.44
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
./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
    CPPFLAGS=-I$WEBOS_PDK/device/usr/include LDFLAGS=-L$WEBOS_PDK/device/usr/lib \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
make install
make install
</syntaxhighlight>
</syntaxhighlight>
Line 147: Line 143:
cd libmpeg2-0.5.1
cd libmpeg2-0.5.1
./configure --host=arm-none-linux-gnueabi --prefix=$WEBOS_PDK/device/usr --disable-shared \
./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"
    CPPFLAGS=-I$WEBOS_PDK/include LDFLAGS="-L$WEBOS_PDK/device/lib -Wl,--allow-shlib-undefined" \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
sed -i s%-L/usr/lib%% src/Makefile
sed -i s%-L/usr/lib%% src/Makefile
make install
make install
Line 157: Line 154:
./configure \
./configure \
       --host=webos \
       --host=webos \
      --prefix=/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm \
       --enable-plugins \
       --enable-plugins \
      --default-dynamic \
      --enable-release \
      --disable-debug\
       --enable-zlib \
       --enable-zlib \
       --enable-tremor \
       --enable-tremor \
Line 167: Line 166:


== Building the WebOS package ==
== Building the WebOS package ==
In the simplest case just type this:


<syntaxhighlight type="bash">
<syntaxhighlight type="bash">
make webosrelease
make package
</syntaxhighlight>
</syntaxhighlight>


After this the IPK file can be found in the root directory of ScummVM.
This creates a release package in the ''portdist'' directory under the current working directory.
 
You can specify a custom destination dir if needed:
 
<syntaxhighlight type="bash">
make package PORTDISTDIR=/tmp/webos
</syntaxhighlight>
 
== Distributing on App Catalog ==
 
'''NOTICE: The Palm App Catalog does not exist anymore. So the information in this section has only historical value.'''
 
=== Increasing the package version ===
 
''VER_PACKAGE'' in ''backends/platform/webos/webos.mk'' must be set to a number which is higher than the currently used package version in the app catalog.  So when creating an updated package for ScummVM 1.3.9 and the current ScummVM package in the app catalog is version 1.3.0902 then you must set VER_PACKAGE to 3 to create the ScummVM package with version 1.3.0903.  Yeah, I know that's ugly but WebOS package version numbers are restricted to three numeric components.
 
=== App ID and name ===
 
As long as Palm doesn't support Team-maintained apps the uploaded packages '''must not''' be packaged with the default ''org.scummvm'' base id.  Instead apps must be uploaded with a user-specific base id.  A good practice is using the github user as base id: ''com.github.<username>''.  It is also necessary to use a user-specific app name when submitting the created package to the Palm app catalog because the app name must be unique.  Use ''ScummVM (<username>)'' instead of ''ScummVM'' and ''ScummVM Beta (<username>)'' instead of ''ScummVM Beta''.
 
The app id is automatically parsed from the installation prefix. So add a configure parameter like this to prepare a build of a package for the Palm App Catalog:
 
<syntaxhighlight type="bash">
--prefix=/media/cryptofs/apps/usr/palm/applications/com.github.kayahr.scummvm
</syntaxhighlight>
 
To build a package for the Palm Beta App Catalog add "-beta" to the prefix:
 
<syntaxhighlight type="bash">
--prefix=/media/cryptofs/apps/usr/palm/applications/com.github.kayahr.scummvm-beta
</syntaxhighlight>

Latest revision as of 17:23, 2 February 2016

Setting up the Toolchain

Install the WebOS SDK

Download the latest WebOS SDK from the Palm Developer Center and install it. The Ubuntu package is for x86 but it also works on Debian and even on x86_64 as described on the download page. When successfully installed you will end up with a /opt/PalmSDK/Current and a /opt/PalmPDK 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.

Palm has removed the download pages for the WebOS PDK. The old download page is archived here. The files are also archived here.

Fixing the WebOS PDK

Since Commit #4d13d44 ScummVM includes some SDL headers which are incorrectly configured in the WebOS PDK. This causes X11 related error messages (WebOS has no X11). To fix this simply edit the file /opt/PalmPDK/include/SDL/SDL_config.h and remove or comment-out the following line:

#define SDL_VIDEO_DRIVER_X11 1

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://downloads.help.palm.com/opensource/3.0.5/zlib-1.2.3.tar.bz2
tar xvfj zlib-1.2.3.tar.bz2
wget http://downloads.help.palm.com/opensource/3.0.5/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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O1"
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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
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 \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
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" \
    CFLAGS="-mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp"
sed -i s%-L/usr/lib%% src/Makefile
make install

Compiling ScummVM

./configure \
      --host=webos \
      --enable-plugins \
      --default-dynamic \
      --enable-release \
      --disable-debug\
      --enable-zlib \
      --enable-tremor \
      --enable-mad \
      --enable-flac
make

Building the WebOS package

In the simplest case just type this:

make package

This creates a release package in the portdist directory under the current working directory.

You can specify a custom destination dir if needed:

make package PORTDISTDIR=/tmp/webos

Distributing on App Catalog

NOTICE: The Palm App Catalog does not exist anymore. So the information in this section has only historical value.

Increasing the package version

VER_PACKAGE in backends/platform/webos/webos.mk must be set to a number which is higher than the currently used package version in the app catalog. So when creating an updated package for ScummVM 1.3.9 and the current ScummVM package in the app catalog is version 1.3.0902 then you must set VER_PACKAGE to 3 to create the ScummVM package with version 1.3.0903. Yeah, I know that's ugly but WebOS package version numbers are restricted to three numeric components.

App ID and name

As long as Palm doesn't support Team-maintained apps the uploaded packages must not be packaged with the default org.scummvm base id. Instead apps must be uploaded with a user-specific base id. A good practice is using the github user as base id: com.github.<username>. It is also necessary to use a user-specific app name when submitting the created package to the Palm app catalog because the app name must be unique. Use ScummVM (<username>) instead of ScummVM and ScummVM Beta (<username>) instead of ScummVM Beta.

The app id is automatically parsed from the installation prefix. So add a configure parameter like this to prepare a build of a package for the Palm App Catalog:

--prefix=/media/cryptofs/apps/usr/palm/applications/com.github.kayahr.scummvm

To build a package for the Palm Beta App Catalog add "-beta" to the prefix:

--prefix=/media/cryptofs/apps/usr/palm/applications/com.github.kayahr.scummvm-beta