Open main menu

Compiling ScummVM/PlayStation Portable

< Compiling ScummVM
Revision as of 13:01, 11 March 2023 by CrystalBen (talk | contribs) (Updated Link from Hard Way to a newer Site because the old Site is down)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

There are 2 ways to get the necessary components to build for the PSP -- the easy way and the hard way.

Hard Way

The hard way is obtaining and building everything from source manually:

The website for this is here, but they host all their code on Github.

Required:

Optional:

  • libTremor
  • libmpeg2 - As this is not in pspdev/psp-ports, you'll need to build it manually. Adding a psp target/host to config.sub and using a configure line similar to the SDL port worked.


The following guidance notes on doing this were written by Nitrus on 2014-03-14:

Built on Xubuntu 13.04 (Raring Ringtail).

I did this by building the toolchain myself, since I ran into various problems with PSPMinW (I think it might have been the x64 against x32 architecture, not sure).
The SVN for the toolchain failed more times than I can count, it's experiencing server downtime or something.
The jim was a bit old I think, so I went with Git.

First, download ScummVM source code:
 git clone https://github.com/scummvm/scummvm.git ~/scummsource

Next before building, download the following build dependency libraries and install:
autoconf, automake, bison, flex, gcc, g++/gcc-c++, libusb-dev, make, ncurses, patch, readline, subversion, texinfo, wget, mpc, gmp, libelf, mpfr, git

This did the trick for me (different linux distros may vary):
 sudo apt-get install autoconf build-essential automake bison flex gcc libusb-dev make libncurses5-dev patch libreadline-dev subversion texinfo wget libmpc-dev libgmp3-dev libgmp-dev libelf-dev libmpfr-dev git

Note: most of these are probably installed already.

Next, some environment variables:
 export PSPDEV=/usr/local/pspdev && export PSPSDK=$PSPDEV/psp/sdk && PATH=$PATH:$PSPDEV/bin:$PSPSDK/bin

For good measure, I added these to ~/.bashrc at the end of the file, in case I miss something.
Then:
 source ~/.bashrc

Next, I downloaded the toolchain into a psptoolchain folder:
 git clone https://github.com/pspdev/psptoolchain.git ~/psptoolchain

Now, we let it download/compile/build, and it takes a long time (around half an hour, to an hour and a half). Change directory then execute:
 cd psptoolchain
 sudo ./toolchain-sudo.sh

It will check if all the needed dependencies are there.
Some of the scripts in psptoolchain/scripts do tend to fail (Git fetching is not always ideal, or FTP anon login gets rejected sometimes, in this case the ./toolchain-sudo.sh needs to be run again, until it's done).
This can be due to DNS resolve errors, or sometimes a connection cannot be established. Sometimes it ends before it even begins.

Next comes zlib.
I got this one, newest at time of writing: 
version 1.2.8, tar.gz format (558K, MD5 checksum 44d667c142d7cda120332623eab69f40)

Went into home by typing cd, and then downloaded and unpacked by:
 wget http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz && tar -xzf zlib-1.2.8.tar.gz && rm zlib-1.2.8.tar.gz
 cd zlib-1.2.8

Then, I downloaded the configure, Makefile and Makefile.in from https://github.com/pspdev/psp-ports/tree/master/zlib sincce they were good for this version too.

 wget -O ./configure https://raw.github.com/pspdev/psp-ports/master/zlib/configure
 wget -O ./Makefile https://raw.github.com/pspdev/psp-ports/master/zlib/Makefile
 wget -O ./Makefile.in  https://raw.github.com/pspdev/psp-ports/master/zlib/Makefile.in

Next I typed make, but for the install (unless I wanted to chown the whole /usr/local/pspdev folder), I needed to go in sudo.
So: 
 sudo su
Next we need the environment variables again:
 export PSPDEV=/usr/local/pspdev && export PSPSDK=$PSPDEV/psp/sdk && export PATH=$PATH:$PSPDEV/bin:$PSPSDK/bin
And finally:
 make install

Then, we exit sudo with:
 exit

You can check whether it has correctly cross compiled by doing 'objdump -f /usr/local/pspdev/psp/lib/libz.a', and it should find an unknown architecture, while 'psp-objdump -f /usr/local/pspdev/psp/lib/libz.a' should correctly point out the mipsallegrex arch.

Next, we download libPNG. I used version 1.2.50. I tried the newest one, but libpng has undergone some significant API changes, which would require extensive of ScummVM.
fedd8c66d106c28f8d527f9397c265a2  libpng-1.2.50.tar.gz

Go to home, and type:
 wget http://sourceforge.net/projects/libpng/files/libpng12/1.2.50/libpng-1.2.50.tar.gz && tar -xzf libpng-1.2.50.tar.gz && rm libpng-1.2.50.tar.gz

We will modify the config.sub a bit, so we wouldn't fiddle around with makefiles, to make them include build.mak.
After line 273 add:
	| mipsallegrex | mipsallegrexel \
After line 358 (now 359 because of previous addition) add:
	| mipsallegrex-* | mipsallegrexel-* \
After line 928 (now 930 because of previous addition) add:
	psp)
		basic_machine=mipsallegrexel-psp
		;;

Save and quit the editor.

Now run following config script from the lib-1.2.50 folder:

 ./configure --prefix=/usr/local/pspdev/psp --host=psp CC=psp-gcc LDFLAGS="-L/usr/local/pspdev/psp/sdk/lib -lc -lpspuser" CFLAGS="-isystem /usr/local/pspdev/psp/sdk/include"

Then once again:
 make
 sudo su
 export PSPDEV=/usr/local/pspdev && export PSPSDK=$PSPDEV/psp/sdk && export PATH=$PATH:$PSPDEV/bin:$PSPSDK/bin
 make install
 exit

Now, for compiling ScummVM:

Create a builds/psp/folder in scummsource:
 cd ~/scummsource && mkdir builds && cd builds && mkdir psp && cd psp

Then, I compiled ScummVM with this:
 ../../configure --host=psp --enable-plugins --default-dynamic --enable-debug && make clean && make

This does not include instructions on any of the optional plugins.

Easy Way

The easy way is to install MinPSPW, which is available for Windows and Linux. Everything is taken care of for you this way. This way is highly recommended.

To build, from msys, go to the scummvm directory. Create a subdirectory called something like 'builds/psp' and change to it (cd builds/psp). Now call configure by typing '../../configure --host=psp --enable-plugins --default-dynamic' This will build for the PSP with plugins enabled, which is recommended or you may not have enough memory. The PSP-2000 and above can handle not using plugins. In that case you'll only type '../../configure --host=psp'.

Now type 'make' and wait for compilation and linking to complete. You'll end up with an 'EBOOT.PBP' file, as well as plugins (if you asked for them) in the /plugins directory.

Don't forget the kbd.zip file from /backends/platform/psp if you want the visual keyboard to work.