Building DOOM with scratchbox2

From WebOS Internals
Revision as of 03:39, 6 January 2010 by Destinal (talk | contribs) (added make install directory (post early, post often?) :))
Jump to navigation Jump to search

First, follow the tutorial ScratchBox2_cross_compiling_with_SDL 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

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:

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)

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

#!/bin/sh
cd /media/cryptofs/apps/usr/palm/applications/com.example.doom
./doom

Make it executable:

chmod 755 start-doom.sh


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

{
	"title":    "DOOM",
	"type":     "game",
	"main":     "start-doom.sh",
	"id":       "com.example.doom",
        "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.

palm-package