Cross-compiling ScummVM on for Raspberry Pi
Installing the official Raspberry Pi cross-compiler on PC
We will clone the Raspberry Pi tools repository which includes the cross-compiler we need:
git clone https://github.com/raspberrypi/tools.git
It will get cloned to a directory called tools at your current location.
Add it to the PATH environment variable so that we have the cross-compiler binaries available from our scummvm building directory. For example, if my Raspberry Pi tools repository ended cloned in tools under my home directory, I would do:
After adding the cross-compiler executables directory to PATH, we should be able to run arm-linux-gnueabihf-gcc, arm-linux-gnueabihf-g++, etc... just try. They should yield an error because you pass them no input files, but that's expected. It's just a test so we know we have the cross-compiler installed and accessible.
Installing the needed Raspberry Pi headers and libraries on PC
We need to copy over the /usr, /lib and /opt directories from your Raspbian SD to your PC (the computer were you will do the cross-compilation), for the needed headers and libs to be available. Of course, you'll have to install any additonal libs from Raspbian running of the Pi before expecting them to be available, so if you compile scummvm with FLAC support, you should have installed the libflac development libs on the Pi first.
First we export the path where we will copy these into, and then we will manually copy them. I choose /opt/rpi_root, but any other path with the right permissions for your user and common sense is going to be ok:
mkdir -p /opt/rpi_root
cp -R usr lib opt $RPI_ROOT
Now we configure scummvm buildsystem so it knows what backend we want and where is our raspberry pi local sysroot living, containing the Raspberry Pi headers and libs the cross-compiler and linker will need. In this example configuration, we disable additional libs, and debug symbols since it's intended for final users.
./configure --host=raspberrypi --with-sdl-prefix=$RPI_ROOT/usr --disable-debug --enable-release --enable-optimizations --disable-mt32emu --disable-flac --disable-mad --disable-vorbis --disable-tremor --disable-fluidsynth --disable-taskbar --disable-timidity --disable-alsa
Remember you should have exported the RPI_ROOT enviroment variable previously. On the raspberrypi host, SDL2 will be always used since it provides graphics acceleration.
Note: If you are building ScummVM on your RPi itself, you might run out of memory during linking. If you use GNU ld for compiling you can try exporting LDFLAGS="-Wl,--no-keep-memory" before running configure. This tells GNU ld to optimize for memory usage.
run "make clean" and then "make -j<n>", where n is the number of cores available on your compilation machine x2.
Installing ScummVM on the Raspberry Pi
Simply copy over the resulting scummvm executable to your Raspberry Pi (Raspbian OS) SD Card. A good idea is to create a scummvm folder in your /home/pi directory on Raspbian, and put the executable there along with any games you want to use with it.