Building DOOM with scratchbox2

From WebOS Internals

Revision as of 03:47, 26 August 2011 by Cyclic (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

Next, download the sdlDOOM source code:

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] $


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

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:"

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:


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)

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"

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 with your favorite text editor like so:

cd /media/cryptofs/apps/usr/palm/applications/com.example.doom

Create the file appinfo.json with your favorite text editor like so:

	"title":    "DOOM",
	"type":     "web",
	"main":     "",
	"id":       "com.example.doom",
	"vendor":   "",
        "version":  "0.1.0",
        "icon":     "icon.png"

Make sure you change id to a reversed domain name like com.example ( but don't use 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.

Personal tools
Google AdSense