Compiling Zandronum on Linux
Prerequisites
Zandronum requires some development files in order to compile:
- gcc - C and C++ compilers >= 3.4.6
- make
- cmake >= 2.4
- SDL >= 1.2.8
- libGL and libGLU (SDL or libSDL pull in libGLU); or any other GL implementation provider.
- fmodex = 4.24.16
- nasm >= 0.98.39 (optional)
- GTK2 (optional)
- zlib (optional - possibly static)
- libbzip2 (optional - possibly static)
- libjpeg (optional - possibly static)
- gxmessage (needed to show the crash log in a window)
- mercurial (needed in order to clone repository)
- fluidsynth (optional)
- libopenssl
- SQLite
Install the following dependencies and tools as superuser:
Debian/Ubuntu
sudo apt-get install build-essential zlib1g-dev libsdl1.2-dev libjpeg-dev \ nasm tar libbz2-dev libgtk2.0-dev cmake mercurial libfluidsynth-dev libgl1-mesa-dev \ libssl-dev libglew-dev
Fedora
yum install gcc-c++ make zlib-devel SDL-devel libjpeg-turbo-devel \ nasm tar bzip2-devel gtk2-devel cmake mercurial fluidsynth-devel mesa-libGL-devel \ openssl-devel
openSUSE
zypper install gcc-c++ make zlib-devel libSDL-devel libjpeg-devel \ nasm tar libbz2-devel gtk2-devel cmake mercurial fluidsynth-devel Mesa-libGL-devel \ libopenssl-devel
Mageia
if [ "$(uname -m)" = "x86_64" ]; then a="64" else a="" fi && \ urpmi gcc-c++ make lib"$a"zlib-devel lib"$a"SDL-devel \ lib"$a"jpeg-devel nasm tar lib"$a"bzip2-devel \ lib"$a"gtk+2.0-devel cmake mercurial lib"$a"fluidsynth-devel \ lib"$a"mesagl1-devel lib"$a"cairo-devel lib"$a"openssl-devel
Arch Linux
pacman -S --needed gcc make zlib sdl libjpeg-turbo nasm tar bzip2 gtk2 cmake mercurial \ fluidsynth mesa glu openssl
Gentoo
emerge -avn sys-devel/gcc sys-devel/make sys-libs/zlib media-libs/libsdl media-libs/libjpeg-turbo \ dev-lang/nasm app-arch/tar app-arch/bzip2 x11-libs/gtk+ dev-util/cmake dev-vcs/mercurial media-sound/fluidsynth \ media-libs/mesa media-libs/glu dev-libs/openssl
PCLinuxOS
if [ "$(uname -m)" = "x86_64" ]; then a="64" else a="" fi && \ apt-get install gcc-c++ make zlib1-devel lib"$a"SDL-devel \ lib"$a"jpeg62-devel nasm tar lib"$a"bzip2-devel \ lib"$a"gtk+2.0_0-devel cmake mercurial lib"$a"fluidsynth1-devel \ lib"$a"mesagl1-devel lib"$a"openssl-devel
Do the following steps as normal user.
Make zandronum_build directory
mkdir -pv $HOME/zandronum_build
Download the Source
Download the Zandronum source and make buildclient and buildserver directories:
cd $HOME/zandronum_build && \ hg clone https://bitbucket.org/Torr_Samaho/zandronum && \ mkdir -pv zandronum/{buildclient,buildserver}
Download FMOD
Download FMOD 4.24.16 32-bit or 64-bit and extract files to zandronum directory:
cd $HOME/zandronum_build && \ if [ "$(uname -m)" = "x86_64" ]; then FMODFOLDER="fmodapi42416linux64" else FMODFOLDER="fmodapi42416linux" fi && \ wget -nc http://zandronum.com/essentials/fmod/$FMODFOLDER.tar.gz && \ tar -xvzf $FMODFOLDER.tar.gz -C zandronum
FMOD Links
FMOD 4.24.16 32-bit:
http://zandronum.com/essentials/fmod/fmodapi42416linux.tar.gz
FMOD 4.24.16 64-bit:
http://zandronum.com/essentials/fmod/fmodapi42416linux64.tar.gz
Compiling
To compile the development version:
Zandronum client:
cd $HOME/zandronum_build/zandronum/buildclient && \ if [ "$(uname -m)" = "x86_64" ]; then FMODFOLDER="fmodapi42416linux64" FMODFILE="libfmodex64-4.24.16" else FMODFOLDER="fmodapi42416linux" FMODFILE="libfmodex-4.24.16" fi && \ make clean ; \ cmake -DCMAKE_BUILD_TYPE=Release \ -DFMOD_LIBRARY=$HOME/zandronum_build/zandronum/$FMODFOLDER/api/lib/$FMODFILE.so \ -DFMOD_INCLUDE_DIR=$HOME/zandronum_build/zandronum/$FMODFOLDER/api/inc .. && \ make
Zandronum server:
cd $HOME/zandronum_build/zandronum/buildserver && \ make clean ; \ cmake -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=ON .. && \ make
Current stable version
Show the current stable version:
cd $HOME/zandronum_build/zandronum && \ hg identify -r "max(tagged())"
If you want to compile the current stable version, run the following:
cd $HOME/zandronum_build/zandronum && \ hg update -cr "max(tagged())"
and compile.
After compiling and backing up the current stable version, run the following:
cd $HOME/zandronum_build/zandronum && \ hg update
Backup
Follow this step if you want or manually copy (backup) zandronum, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so and zandronum-server.
Make and name a directory with the corresponding Zandronum version/revision and copy zandronum, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so and zandronum-server to it:
cd $HOME/zandronum_build && \ BACKUPZANDRONUM="$(sed -n 's/.*#define GAMEVER_STRING "\(.*\)".*/\1/p' \ zandronum/src/version.h)\ $(sed -n 's/.*#define DOTVERSIONSTR.*GAMEVER_STRING "\(.*\)".*/\1/p' \ zandronum/src/version.h)\ $(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\-r\1/p' \ zandronum/src/svnrevision.h)" && \ mkdir -pv "$BACKUPZANDRONUM" && \ cp -v zandronum/{buildclient/{zandronum,zandronum.pk3,\ skulltag_actors.pk3,output_sdl/liboutput_sdl.so},\ buildserver/zandronum-server} "$BACKUPZANDRONUM"
If the above fails, try this:
cd $HOME/zandronum_build && \ BACKUPZANDRONUM="$(sed -n 's/.*#define GAMEVER_STRING "\(.*\)".*/\1/p' \ zandronum/src/version.h)\ $(sed -n 's/.*#define DOTVERSIONSTR.*GAMEVER_STRING "\(.*\)".*/\1/p' \ zandronum/src/version.h)\ $(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\-r\1/p' \ zandronum/src/gitinfo.h)\ $(sed -n 's/.*#define HG_TIME "\(.*\)".*/\-r\1/p' \ zandronum/src/gitinfo.h)\ $(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\-\1/p' \ zandronum/src/gitinfo.h)" && \ mkdir -pv "$BACKUPZANDRONUM" && \ cp -v zandronum/{buildclient/{zandronum,zandronum.pk3,\ skulltag_actors.pk3,output_sdl/liboutput_sdl.so},\ buildserver/zandronum-server} "$BACKUPZANDRONUM"
Backup (Optional)
Make and name a directory with the current year, month, day, hour and minute and copy zandronum, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so and zandronum-server to it:
cd $HOME/zandronum_build && \ COPYANDPASTEZAN="$(date +%Y%m%d%H%M)" && \ mkdir -pv "$COPYANDPASTEZAN" && \ cp -v zandronum/{buildclient/{zandronum,zandronum.pk3,\ skulltag_actors.pk3,output_sdl/liboutput_sdl.so},\ buildserver/zandronum-server} "$COPYANDPASTEZAN"
If you did "Backup Zandronum" or "Backup (Optional)", the previous files should be located at:
- /home/<your username>/zandronum_build/
Updating
When you wish to update Zandronum, copy and paste the following:
cd $HOME/zandronum_build/zandronum && \ hg pull ; hg update
When the update finish, go to Compiling.
Installation
The following steps contain commands that require to be run as superuser with the sudo command.
If you want to install Zandronum, do the following:
Make /usr/games/zandronum directory:
sudo mkdir -pv /usr/games/zandronum
Copy zandronum, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so, zandronum-server and libfmodex64-4.24.16.so or libfmodex-4.24.16.so to /usr/games/zandronum:
if [ "$(uname -m)" = "x86_64" ]; then FMODFOLDER="fmodapi42416linux64" FMODFILE="libfmodex64-4.24.16" else FMODFOLDER="fmodapi42416linux" FMODFILE="libfmodex-4.24.16" fi && \ sudo cp -v /home/$USER/zandronum_build/zandronum/{buildclient/{zandronum,\ zandronum.pk3,skulltag_actors.pk3,output_sdl/liboutput_sdl.so},\ buildserver/zandronum-server,$FMODFOLDER/api/lib/$FMODFILE.so} \ /usr/games/zandronum
Make zandronum script, add executable permission and copy it to /usr/bin:
cd /tmp && \ echo '#!/bin/sh' > zandronum && \ echo >> zandronum && \ echo 'export LD_LIBRARY_PATH=/usr/games/zandronum' >> zandronum && \ echo 'exec /usr/games/zandronum/zandronum "$@"' >> zandronum && \ chmod 755 zandronum && \ sudo cp -v zandronum /usr/bin && \ rm -fv zandronum
Make zandronum-server script, add executable permission and copy it to /usr/bin:
cd /tmp && \ echo '#!/bin/sh' > zandronum-server && \ echo >> zandronum-server && \ echo 'exec /usr/games/zandronum/zandronum-server "$@"' >> zandronum-server && \ chmod 755 zandronum-server && \ sudo cp -v zandronum-server /usr/bin && \ rm -fv zandronum-server
Now from a terminal you should be able to execute zandronum or zandronum-server from any user account.
Uninstallation
To remove the previous installation steps:
Remove /usr/games/zandronum directory and all its files:
cd /usr/games && \ sudo rm -rfv zandronum
Remove zandronum script:
cd /usr/bin && \ sudo rm -fv zandronum
Remove zandronum-server script:
cd /usr/bin && \ sudo rm -fv zandronum-server
Debugging
Prerequisite:
In most cases it is good idea to generate a back trace when Zandronum crashes.
Debugging Zandronum client
Make debugclient directory.
mkdir -pv $HOME/zandronum_build/zandronum/debugclient
Make a debug build of zandronum client.
cd $HOME/zandronum_build/zandronum/debugclient && \ if [ "$(uname -m)" = "x86_64" ]; then FMODFOLDER="fmodapi42416linux64" FMODFILE="libfmodex64-4.24.16" else FMODFOLDER="fmodapi42416linux" FMODFILE="libfmodex-4.24.16" fi && \ make clean ; \ cmake -DCMAKE_BUILD_TYPE=Debug \ -DFMOD_LIBRARY=$HOME/zandronum_build/zandronum/$FMODFOLDER/api/lib/$FMODFILE.so \ -DFMOD_INCLUDE_DIR=$HOME/zandronum_build/zandronum/$FMODFOLDER/api/inc .. && \ make
You should now be able to use gdb to generate a back trace.
gdb zandronum
You probably want to log the output, so lets output to a file zandronumclientdebug.log.
set logging on zandronumclientdebug.log
GDB has it's own command prompt. Use "run" to start zandronum.
(gdb) run
To start and pass command line parameters to zandronum.
(gdb) run <command line parameters>
Use "bt" to get the back trace after a crash.
(gdb) bt
To exit GDB's command prompt, use "quit", "q" or Ctrl-D.
(gdb) quit
Debugging Zandronum-server
Make debugserver directory.
mkdir -pv $HOME/zandronum_build/zandronum/debugserver
Make a debug build of zandronum-server.
cd $HOME/zandronum_build/zandronum/debugserver && \ make clean ; \ cmake -DCMAKE_BUILD_TYPE=Debug -DSERVERONLY=ON .. && \ make
You should now be able to use gdb to generate a back trace.
gdb zandronum-server
You probably want to log the output, so lets output to a file zandronumserverdebug.log.
set logging on zandronumserverdebug.log
GDB has it's own command prompt. Use "run" to start zandronum-server.
(gdb) run
To start and pass command line parameters to zandronum-server.
(gdb) run <command line parameters>
Use "bt" to get the back trace after a crash.
(gdb) bt
To exit GDB's command prompt, use "quit", "q" or Ctrl-D.
(gdb) quit
Build Options
Options | Description | Example |
---|---|---|
SERVERONLY=ON | Build a server only binary. | cmake -DSERVERONLY=ON .. |
NO_GTK=ON | Disable GTK+ dialogs. | cmake -DNO_GTK=ON .. |
NO_SOUND=ON | Disable sound support. | cmake -DNO_SOUND=ON .. |
NO_GL=ON | Disable OpenGL support. | cmake -DNO_GL=ON .. |
NO_ASM=ON | Disable assembly code. | cmake -DNO_ASM=ON .. |
FMOD_LIBRARY | Set path for FMOD library. | cmake -DFMOD_LIBRARY=/path/to/libfmodex(64)-X.Y.Z.so .. |
FMOD_INCLUDE_DIR | Set path for FMOD include directory. | cmake -DFMOD_INCLUDE_DIR=/path/to/include/dir .. |
Types | Description | Example |
---|---|---|
Debug | Debug information, -O1 optimization. | cmake -DCMAKE_BUILD_TYPE=Debug .. |
Release | No debug information, -O3 optimization. | cmake -DCMAKE_BUILD_TYPE=Release .. |
RelWithDebInfo | Debug information, -O3 optimization. Useful for finding optimization bugs that only show up in Release. | cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. |
MinSizeRel | Similar to Release but with less optimizations in order to save space. | cmake -DCMAKE_BUILD_TYPE=MinSizeRel .. |
How to increase Zandronum/GZDoom OpenGL FPS on Intel Graphics
Prerequisite:
Debian/Ubuntu
- xserver-xorg-video-intel >= 2.19
Fedora
- xorg-x11-drv-intel >= 2.19
openSUSE
- xf86-video-intel >= 2.19
Mageia
- x11-driver-video-intel >= 2.19
Arch Linux
- xf86-video-intel >= 2.19
Gentoo
- x11-drivers/xf86-video-intel >= 2.19
PCLinuxOS
- x11-driver-video-intel >= 2.19
Run Zandronum/GZDoom, start a new game, open console and type vid_fps 1, see how many FPS are displayed and exit Zandronum/GZDoom.
Enable SandyBridge's New Acceleration
If your Intel driver version is 2.21.14-1 / 2.21.15-2 or greater, go to the next part.
Intel SNA is useful on all Intel Graphics, not just SandyBridge.
Make 99-intel.conf:
touch 99-intel.conf
Copy and paste the following to 99-intel.conf:
Section "Device" Identifier "Intel Graphics" Driver "intel" Option "AccelMethod" "sna" EndSection
and save.
Verify if the xorg.conf.d directory already exist:
ls /etc/X11
If it doesn't exist, as root/superuser, make it:
mkdir -pv /etc/X11/xorg.conf.d
As root/superuser, copy 99-intel.conf to /etc/X11/xorg.conf.d:
cp -v 99-intel.conf /etc/X11/xorg.conf.d
and logout and login.
Disable Vertical Synchronization for Zandronum/GZDoom
Open a terminal, go to your user home directory and verify if the .drirc file already exist:
cd $HOME ls -la
If it doesn't exist; make it:
touch drirc
otherwise add the configurations of the next step to the already existing .drirc file.
Copy and paste the following to drirc:
<driconf> <device screen="0" driver="dri2"> <application name="zandronum" executable="zandronum"> <option name="vblank_mode" value="0"/> </application> <application name="gzdoom" executable="gzdoom"> <option name="vblank_mode" value="0"/> </application> </device> </driconf>
and save.
Rename drirc to .drirc:
mv drirc .drirc
Run Zandronum/GZDoom, start a new game, open console and type vid_fps 1, see how many FPS are displayed, you should get more FPS than before.
Revert All Changes
Remove .drirc:
cd $HOME rm -fv .drirc
As root/superuser, remove 99-intel.conf:
cd /etc/X11/xorg.conf.d rm -fv 99-intel.conf
and logout and login.