How to compile and install USokoban on Fedora.
This is a guide at beginner level.
Important: You should always check what commands do (using man pages) and what the content of scripts are before running them. This is just a guide for other people who encounter similar problems as I had when getting this working.
Download the sources
and extract it into a folder such as ~/Downloads/usokoban, then download the media
and extract it into a folder such as ~/Downloads/usokoban-bin.
You can also check the files are the same as the ones I got:
$ md5sum usokoban-0.0.13-src.tar.gz
$ md5sum usokoban-0.0.13-i386.tar.gz
You will need to install gcc (the C compiler) as well as the development packages for gtk+-2.0, libpcre and sqlite3. To do this:
sudo yum install gcc
sudo yum install gtk2-devel.x86_64 pcre-devel.x86_64 sqlite-devel.x86_64
(you can use yum search pcre-devel to see other versions, in case you are not using x86_64)
For the compiler to be able to find these libraries you need to use
if you used a different version of the libraries than x86_64 you might need to add a different path to pkg-config. You can find out where pkg-config needs to look by opening Administration -> Add/Remove Software and search for the package you have installed, select it then open Selection -> get file list and look for things like pkgconfig/libpcre.pc in the files list. You can check you pkg-config is finding things using: pkg-config --exists libpcre && echo found
Now if you run the command from README.source:
gcc base.c settings.c sokoban.c sokoban2.c solver.c savitch.c solution.c -o usokoban `pkg-config --cflags --libs gtk+-2.0 libpcre sqlite3`
it will error like this:
/usr/bin/ld: /tmp/ccMkYGad.o: undefined reference to symbol 'g_thread_init'
/usr/bin/ld: note: 'g_thread_init' is defined in DSO /lib64/libgthread-2.0.so.0 so try adding it to the linker command line
/lib64/libgthread-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
to resolve the errors use this:
gcc base.c settings.c sokoban.c sokoban2.c solver.c savitch.c solution.c -o usokoban `pkg-config --cflags --libs gtk+-2.0 libpcre sqlite3` -lgthread-2.0 -lz
you should now have your own compiled binary of usokoban! Don't run it yet.
Now copy the binary over the one stuff in ~/Downloads/usokoban-bin:
cp ~/Downloads/usokoban/usokoban ~/Downloads/usokoban-bin
and cd into the usokoban-bin directory before running (remember to check the script to see what exactly it does - just copying files into the right places - before running it)
sudo sh install_usokoban.sh
Now usokoban will show up in the games list (at least it does in xfce) and you can play it now! It will save the solutions you find and level you are on too.
You can now save borgar
to /usr/share/games/usokoban and then put skin.default=/usr/share/games/usokoban/borgar.png in ~/.usokoban You can also save some of the great classic levels at David W. Skinner's Sokoban page
into that folder and open them next time you play usokoban.