Building DOOM with scratchbox2

First, follow the tutorial WebOS Internals PDK to set up the cross compilation environment.

Next, download the sdlDOOM source code:

wget http://www.libsdl.org/projects/doom/src/sdldoom-1.10.tar.gz tar xzf sdldoom-1.10.tar.gz cd sdldoom-1.10

Now run scratchbox2 with the webos / pre mapping file:

$ sb2 -M /srv/preware/cross-compile/staging/mapping-armv7

NOTE: You should use armv6 if your target device is a Pixi.

You will get a different prompt indicating you are in a scratchbox shell, like: [SB2 mapping-armv7 armv7] $

Run:

./configure --with-sdl-prefix=/usr/local make

Build should complete successfully with no problems. Download a DOOM shareware WAD:

NOTE: If you receive an error "configure: error: *** SDL version 1.0.1 not found!", you will need to exit the sb2 command line by typing exit, then mkdir -p /usr/local/include/ cd /srv/preware/cross-compile/packages/dev-sdl make -C libsdl ARCH=armv7 stage

Be patient. The compile can take 10 minutes. You should be able to cd into the doom directory and continue above at "Now run scratchbox2 with the webos / pre mapping file:" wget http://www.libsdl.org/projects/doom/data/doom1.wad.gz gunzip doom1.wad.gz

Copy the DOOM program binary and wad to root's home directory on the pre: scp doom doom1.wad root@pre:

SSH to the device (novaterm would also work to get there, or an on-device terminal) NOTE: You can also use the usb mode on the TouchPad. If you do use USB, you can find the copied files in /media/internal/ ssh root@pre

On the device, run DOOM: ./doom

Yay, it should now run. You may want to customize the code for better controls on the device.

Now let's package it up for all your friends to install. You should be back in your sdldoom-1.1.0 directory. For this, we'll use the Palm SDK, so make sure you have it installed.

First off: Unfortunately palm-package doesn't _quite_ make game packages properly. First, we want type to be "game" and palm-package doesn't understand that (will reject it as an invalid type in the 1.3.5 SDK). Secondly, the executables need to be set with executable permissions. For all this, we need a script to fix up the ipk for you.

palm-game-fix  (I put it in /usr/local/bin and chmod 755 /usr/local/bin/palm-game-fix) TMPDIR="fix-game-ipk-tmp.$$" if [ ! -f "$1" ]; then echo "$1" not found; exit 1; fi mkdir "$TMPDIR"; cd "$TMPDIR" ar x "../$1" tar xvzf data.tar.gz cd usr/palm/applications/* chmod 755 * sed -i 's/"type":.*"web",/"type":    "game",/' appinfo.json cd ../../../.. tar cvzf data.tar.gz usr rm -rf usr; rm "../$1" ar -r "../$1" * cd ..;rm -rf "$TMPDIR"
 * 1) !/bin/bash

Once you have this, you should be ready to go. Obviously this only needs to be done once.

First make an installation directory with just the files we want to package.

mkdir package cp doom doom1.wad package cd package

Next, create a start script that will be launched by the icon for your application. It can do things like changing the working directory (cd) into the right directory and start your program with the right command line arguments, if any.

Create the file start-doom.sh with your favorite text editor like so:

cd /media/cryptofs/apps/usr/palm/applications/com.example.doom ./doom
 * 1) !/bin/sh

Create the file appinfo.json with your favorite text editor like so: {	"title":   "DOOM", "type":    "web", "main":    "start-doom.sh", "id":      "com.example.doom", "vendor":  "example.com", "version": "0.1.0", "icon":    "icon.png" }

Make sure you change id to a reversed domain name like com.example (example.com) but don't use example.com. Get a domain name to use or ask a friend if you can use theirs. This domain should be unique.

Now we need to package it up and fix up the package to be game-compatible. Run:

palm-package. palm-game-fix *ipk

Now you can do a test install and launch. palm-install com.example.doom_0.1.0_all.ipk palm-launch com.example.doom

Hopefully, DOOM should open in all its glory.

Have fun making native apps.