Compiling Zandronum on Linux: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
'''Open a terminal and copy and paste the whole code box for each step.''' | '''Open a terminal and copy and paste the whole code box for each step.''' | ||
== | == Install dependencies == | ||
[http://zandronum.com/ Zandronum] needs certain tools and development files in order to compile: | |||
* '''Required''' | |||
** gcc 4.6 or later | |||
** make | |||
** cmake 2.8.7 or later | |||
** SDL 1.2.8 or later 1.2.x versions | |||
** libGL and libGLU ''(SDL or libSDL pull in libGLU)'' or any other GL implementation provider. | |||
** [http://zandronum.com/essentials/fmod/ FMOD Ex] 4.24.16 | |||
** libopenssl ''(for Zandronum 1.3 or later)'' | |||
** SQLite ''(for Zandronum 1.3 or later)'' | |||
* '''Recommended''' | |||
** GTK2 | |||
** mercurial ''(needed in order to [https://bitbucket.org/Torr_Samaho/zandronum download the source] and compile in commit meta data)'' | |||
** nasm 0.98.39 or later ''(x86-32 only)'' | |||
* '''Optional''' | |||
* gcc | ** zlib ''(Zandronum has a copy of it and will be statically compiled in if not found)'' | ||
* make | ** libbzip2 ''(possibly static)'' | ||
* cmake | ** libjpeg ''(possibly static)'' | ||
* SDL | * '''Runtime''' | ||
* libGL and libGLU ''(SDL or libSDL pull in libGLU)'' | ** gxmessage ''(optional - needed to show the crash log in a window)'' | ||
* | ** kdialog ''(optional - for KDE users)'' | ||
* nasm | ** fluidsynth or timidity ''(optional - for [http://zdoom.org/wiki/MIDI MIDI] playback)'' | ||
* | |||
* zlib ''( | |||
* libbzip2 ''( | |||
* libjpeg ''( | |||
* | |||
* | |||
* | |||
* | |||
Install the following as root/superuser: | Install the following as root/superuser: | ||
Line 37: | Line 29: | ||
=== Debian/Ubuntu === | === Debian/Ubuntu === | ||
<pre> | <pre> | ||
sudo apt-get install | sudo apt-get install g++ make cmake libsdl1.2-dev mercurial zlib1g-dev \ | ||
libbz2-dev libjpeg-dev libfluidsynth-dev libgtk2.0-dev timidity nasm \ | |||
libssl-dev | libgl1-mesa-dev libssl-dev tar | ||
</pre> | </pre> | ||
=== Fedora === | === Fedora === | ||
<pre> | <pre> | ||
dnf install gcc-c++ make cmake SDL-devel mercurial zlib-devel \ | |||
bzip2-devel libjpeg-turbo-devel fluidsynth-devel gtk2-devel timidity++ nasm \ | |||
openssl-devel | mesa-libGL-devel openssl-devel tar | ||
</pre> | </pre> | ||
=== openSUSE === | === openSUSE === | ||
<pre> | <pre> | ||
zypper install gcc-c++ make | zypper install gcc-c++ make cmake libSDL-devel mercurial zlib-devel \ | ||
libbz2-devel libjpeg-devel fluidsynth-devel gtk2-devel timidity nasm \ | |||
libopenssl-devel | Mesa-libGL-devel libopenssl-devel tar | ||
</pre> | </pre> | ||
Line 59: | Line 51: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | a='' && [ "$(uname -m)" = x86_64 ] && a=64 | ||
urpmi gcc-c++ make lib | urpmi gcc-c++ make cmake lib${a}SDL-devel mercurial lib${a}zlib-devel \ | ||
lib | lib${a}bzip2-devel lib${a}jpeg-devel lib${a}fluidsynth-devel \ | ||
lib | lib${a}gtk+2.0-devel lib${a}cairo-devel TiMidity++ nasm \ | ||
lib | lib${a}mesagl1-devel lib${a}openssl-devel tar | ||
</pre> | </pre> | ||
=== Arch Linux === | === Arch Linux === | ||
<pre> | <pre> | ||
pacman -S --needed gcc make zlib | pacman -S --needed gcc make cmake sdl mercurial zlib bzip2 libjpeg-turbo \ | ||
fluidsynth mesa glu openssl | fluidsynth gtk2 timidity++ nasm mesa glu openssl tar | ||
</pre> | </pre> | ||
=== Gentoo === | === Gentoo === | ||
<pre> | <pre> | ||
emerge -avn sys-devel/gcc sys-devel/make | emerge -avn sys-devel/gcc sys-devel/make dev-util/cmake media-libs/libsdl \ | ||
dev- | dev-vcs/mercurial sys-libs/zlib app-arch/bzip2 media-libs/libjpeg-turbo media-sound/fluidsynth \ | ||
media-libs/mesa media-libs/glu dev-libs/openssl | x11-libs/gtk+ media-sound/timidity++ dev-lang/nasm media-libs/mesa media-libs/glu \ | ||
dev-libs/openssl app-arch/tar | |||
</pre> | </pre> | ||
Line 81: | Line 74: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | a='' && [ "$(uname -m)" = x86_64 ] && a=64 | ||
apt-get install gcc-c++ make zlib1-devel lib | apt-get install gcc-c++ make cmake lib${a}SDL-devel mercurial zlib1-devel \ | ||
lib | lib${a}bzip2-devel lib${a}jpeg62-devel lib${a}fluidsynth1-devel \ | ||
lib | lib${a}gtk+2.0_0-devel TiMidity++ nasm lib${a}mesagl1-devel \ | ||
lib | lib${a}openssl-devel tar | ||
</pre> | |||
=== Solus === | |||
<pre> | |||
sudo eopkg install g++ make cmake binutils glibc-devel pkg-config \ | |||
sdl1-devel mercurial zlib-devel bzip2-devel libjpeg-turbo-devel \ | |||
fluidsynth-devel libgtk-2-devel nasm mesalib-devel libglu-devel \ | |||
openssl-devel tar | |||
</pre> | </pre> | ||
'''Do the following | '''Do the following sections as normal user.''' | ||
== | == Create zandronum_build directory == | ||
<pre> | <pre> | ||
mkdir -pv | mkdir -pv ~/zandronum_build | ||
</pre> | </pre> | ||
== Download the | == Download and prepare the source == | ||
Download the Zandronum source and | Download the Zandronum source and create buildclient and buildserver directories: | ||
<pre> | <pre> | ||
cd | cd ~/zandronum_build && | ||
hg clone https://bitbucket.org/Torr_Samaho/zandronum && | hg clone https://bitbucket.org/Torr_Samaho/zandronum && | ||
mkdir -pv zandronum/ | mkdir -pv zandronum/buildclient zandronum/buildserver | ||
</pre> | </pre> | ||
Line 105: | Line 106: | ||
Download FMOD 4.24.16 32-bit or 64-bit and extract files to zandronum directory: | Download FMOD 4.24.16 32-bit or 64-bit and extract files to zandronum directory: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | |||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | cd ~/zandronum_build && | ||
wget -nc http://zandronum.com/essentials/fmod/fmodapi42416linux | wget -nc http://zandronum.com/essentials/fmod/fmodapi42416linux${a}.tar.gz && | ||
tar -xvzf fmodapi42416linux | tar -xvzf fmodapi42416linux${a}.tar.gz -C zandronum | ||
</pre> | </pre> | ||
== Compiling == | == Compiling == | ||
To compile | To compile Zandronum client: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | |||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1 | ||
cd ~/zandronum_build/zandronum/buildclient && | |||
rm -f output_sdl/liboutput_sdl.so && | |||
- | if [ -d "../fmodapi42416linux${a}" ]; then | ||
-DFMOD_INCLUDE_DIR= | f="-DFMOD_LIBRARY=../fmodapi42416linux${a}/api/lib/libfmodex${a}-4.24.16.so \ | ||
make | -DFMOD_INCLUDE_DIR=../fmodapi42416linux${a}/api/inc"; else | ||
f='-UFMOD_LIBRARY -UFMOD_INCLUDE_DIR'; fi && | |||
cmake .. -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=OFF -DRELEASE_WITH_DEBUG_FILE=OFF $f && | |||
make -j$c | |||
</pre> | </pre> | ||
A development version of Zandronum client will be compiled if you do not do [[#Latest stable version]]. | |||
Assuming all goes well, a zandronum binary should be produced. To start Zandronum client, the following command should work: | Assuming all goes well, a zandronum binary should be produced. To start Zandronum client, the following command should work: | ||
<pre> | <pre> | ||
Line 136: | Line 133: | ||
</pre> | </pre> | ||
To compile Zandronum server: | |||
<pre> | <pre> | ||
c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1 | |||
cd ~/zandronum_build/zandronum/buildserver && | |||
cmake -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=ON | cmake .. -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=ON -DRELEASE_WITH_DEBUG_FILE=OFF && | ||
make | make -j$c | ||
</pre> | </pre> | ||
A development version of Zandronum server will be compiled if you do not do [[#Latest stable version]]. | |||
Assuming all goes well, a zandronum-server binary should be produced. To start Zandronum server, the following command should work: | Assuming all goes well, a zandronum-server binary should be produced. To start Zandronum server, the following command should work: | ||
<pre> | <pre> | ||
./zandronum-server | ./zandronum-server | ||
</pre> | </pre> | ||
If Zandronum complains you do not have any IWADs set up, make sure that you have your [[IWAD]] files placed in the same directory as Zandronum, in ~/.config/zandronum, $DOOMWADDIR, or /usr/local/share. Alternatively, you can edit ~/.config/zandronum/zandronum.ini or ~/.zandronum/zandronum.ini to set the path for your IWADs. | If Zandronum complains you do not have any IWADs set up, make sure that you have your [[IWAD]] files placed in the same directory as Zandronum, in ~/.config/zandronum/, ~/.zandronum/, $DOOMWADDIR, or /usr/local/share/. Alternatively, you can edit ~/.config/zandronum/zandronum.ini or ~/.zandronum/zandronum.ini to set the path for your IWADs. | ||
=== | === Latest stable version === | ||
Show the | Show the latest stable version: | ||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg identify -r 'max(tagged())' | if [ "$(hg log -r 'max(tagged())' --template '{rev}\n')" -ge \ | ||
"$(hg log -l1 -k 'BUILD_ID_STR to release' --template '{rev}\n')" ]; then | |||
hg identify -r 'max(tagged())'; else u="$(hg log -l1 -k 'BUILD_ID_STR to release' \ | |||
--template '{node|short}\n')"; echo "$u $(hg log -r $u --template '{desc}\n' | | |||
sed -n 's/.*changed the version string to \(.*\)/\1/p')"; fi | |||
</pre> | </pre> | ||
If you want to compile the | If you want to compile the latest stable version, run: | ||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg update -cr 'max(tagged())' | if [ "$(hg log -r 'max(tagged())' --template '{rev}\n')" -ge \ | ||
"$(hg log -l1 -k 'BUILD_ID_STR to release' --template '{rev}\n')" ]; then | |||
hg update -cr 'max(tagged())'; else hg update -c $(hg log -l1 -k \ | |||
'BUILD_ID_STR to release' --template '{node}\n'); fi | |||
</pre> | </pre> | ||
and [[#Compiling|compile]]. | and [[#Compiling|compile]]. | ||
After compiling, [[#Backup|backing up]] and optionally [[#Installation|installing]] the | After compiling, [[#Backup|backing up]] and optionally [[#Installation|installing]] the latest stable version, run: | ||
<pre> | |||
cd ~/zandronum_build/zandronum && | |||
hg update | |||
</pre> | |||
=== A specific Zandronum version by UTC commit date === | |||
To compile a specific Zandronum version, for example 3.0-alpha-170806-2040; first, checkout the commit that matches 170806-2040. From left to right, 17 (2017) is the year, 08 is the month, 06 is the day, 20 is the hour, 40 is the minute and the time zone is +0000: | |||
<pre> | |||
cd ~/zandronum_build/zandronum && | |||
hg update -cd '2017-08-06 20:40 +0000' | |||
</pre> | |||
Now go to [[#Compiling]]. | |||
After compiling, [[#Backup|backing up]] and optionally [[#Installation|installing]] Zandronum, run: | |||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg update | hg update | ||
</pre> | </pre> | ||
== | === Older versions === | ||
First, show the Zandronum version you are currently on: | |||
<pre> | |||
w='r ' && [ "$(uname -s)" = Linux ] && w='d @' | |||
cd ~/zandronum_build/zandronum && | |||
v="$(sed -n 's/.*#define GAMEVER_STRING "\(.*\)".*/\1/p' src/version.h)\ | |||
$(sed -n 's/.*#define DOTVERSIONSTR GAMEVER_STRING "\(.*\)".*/\1/p' src/version.h)\ | |||
$(date -u$w$(hg log -r . --template '{date}\n' | cut -d'.' -f1) +'-%y%m%d-%H%M')\ | |||
$(hg id -i | sed '/+$/!s/.*//;s/.*+$/M/')" && | |||
echo $v | |||
</pre> | |||
If the Zandronum version you are currently on is 2.x or lower, do the following: | |||
To compile Zandronum 2.x or older versions, you need to install gcc 4.9 or lower: | |||
<pre> | |||
sudo apt-get install gcc-4.9 g++-4.9 | |||
</pre> | |||
Inside the buildclient and buildserver directories, run cmake with these arguments -DCMAKE_C_COMPILER=/path/to/compiler/gcc -DCMAKE_CXX_COMPILER=/path/to/compiler/g++, for example: | |||
<pre> | |||
cd ~/zandronum_build/zandronum/buildclient && | |||
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 \ | |||
-DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9 | |||
</pre> | |||
<pre> | |||
cd ~/zandronum_build/zandronum/buildserver && | |||
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 \ | |||
-DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9 | |||
</pre> | |||
and [[#Compiling|compile]]. | |||
If you are going to compile Zandronum 1.0 (120819-2011) and your Mesa version is 9.x or higher: | |||
<pre> | <pre> | ||
glxinfo | grep 'OpenGL version' | |||
</pre> | </pre> | ||
apply the fix from commit [https://bitbucket.org/Torr_Samaho/zandronum/commits/a69d59da0f518d52b41e28e19f72611c009c8fac a69d59da0f51], otherwise the Zandronum client will not compile. | |||
== Backup == | |||
If you want to backup Zandronum, do the following: | |||
Create and name a directory with the corresponding Zandronum version/revision, build type and copy zandronum, zandronum-server, zandronum.pk3, skulltag_actors.pk3 and liboutput_sdl.so to it: | |||
<pre> | <pre> | ||
cd "$ | cd ~/zandronum_build/zandronum && | ||
e=buildclient && i=buildserver && if [ -f "$e/CMakeCache.txt" ]; then | |||
mkdir -pv "$ | j="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' $e/CMakeCache.txt)"; else j=''; fi && | ||
if [ -f "$i/CMakeCache.txt" ]; then | |||
k="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' $i/CMakeCache.txt)"; else k=''; fi && | |||
if [ -n "$j" ]; then b="-BuildType$j"; elif [ -n "$k" ]; then b="-BuildType$k"; else b=''; fi && | |||
r=src/svnrevision.h && if [ -f "$r" ] && [ "$(hg status $r)" != "? $r" ]; then r=$r; else | |||
r=src/gitinfo.h; fi && h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" && | |||
BACKUPZANDRONUM="../$(hg cat -r $h src/version.h | sed -n 's/.*#define GAMEVER_STRING "\(.*\)".*/\1/p')\ | |||
$(hg cat -r $h src/version.h | sed -n 's/.*#define DOTVERSIONSTR GAMEVER_STRING "\(.*\)".*/\1/p')\ | |||
$(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\-\1/p' $r)\ | |||
$(sed -n 's/.*#define HG_TIME "\(.*\)".*/\-\1/p' $r)-$h$b" && | |||
mkdir -pv "$BACKUPZANDRONUM" && | |||
x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" && | |||
if [ -f "$y" ] && [ -f "$z" ] && [ "$z" -nt "$y" ]; then | |||
x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi && | |||
o="$e/output_sdl/liboutput_sdl.so" && if [ -f "$o" ]; then l="$o"; else l=''; fi && | |||
cp -v $e/zandronum $i/zandronum-server $x/zandronum.pk3 $x/skulltag_actors.pk3 $l \ | |||
"$BACKUPZANDRONUM"/ | |||
</pre> | </pre> | ||
Files are located at: | |||
/home/<your username>/zandronum_build/<your newly created directory> | |||
== Updating == | == Updating == | ||
When you wish to update Zandronum, copy and paste the following: | When you wish to update Zandronum, copy and paste the following: | ||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg pull ; hg update | hg pull ; hg update | ||
</pre> | </pre> | ||
Line 210: | Line 267: | ||
== Installation == | == Installation == | ||
''' | * '''zandronum''' / '''zandronum-server''' = Stable version | ||
* '''zandronum-alpha''' / '''zandronum-server-alpha''' = Development version | |||
Commands beginning with "sudo" will require temporary superuser privileges. | |||
If you want to install Zandronum, do the following: | If you want to install Zandronum, do the following: | ||
Create /usr/games/zandronum and /usr/games/zandronum-alpha directories: | |||
<pre> | <pre> | ||
sudo mkdir -pv /usr/games/ | sudo mkdir -pv /usr/games/zandronum /usr/games/zandronum-alpha | ||
</pre> | </pre> | ||
Copy zandronum, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so | Copy zandronum, zandronum-server, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so and the FMOD library file to /usr/games/zandronum/ or /usr/games/zandronum-alpha/: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | |||
cd ~/zandronum_build/zandronum && | |||
e=buildclient && i=buildserver && | |||
if [ -f src/svnrevision.h ] && | |||
[ "$(hg status src/svnrevision.h)" != "? src/svnrevision.h" ]; then | |||
r=src/svnrevision.h; else r=src/gitinfo.h; fi && | |||
h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" && | |||
t="$(hg id -tr $h)" && | |||
d='' && if [ -z "$(hg log -r $h -k 'BUILD_ID_STR to release')" ]; then | |||
if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi && | |||
x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" && | |||
if [ -f "$y" ] && [ -f "$z" ] && [ "$z" -nt "$y" ]; then | |||
x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi && | |||
t="$(hg id - | o="$e/output_sdl/liboutput_sdl.so" && if [ -f "$o" ]; then l="$o \ | ||
d='' && [ "$t" = tip ] || [ -z "$t" ] | fmodapi42416linux${a}/api/lib/libfmodex${a}-4.24.16.so"; else l=''; fi && | ||
sudo cp -v $e/zandronum $i/zandronum-server $x/zandronum.pk3 $x/skulltag_actors.pk3 $l \ | |||
/usr/games/zandronum$d/ | |||
sudo | |||
</pre> | </pre> | ||
Create launch scripts: | |||
<pre> | <pre> | ||
cd "$ | cd ~/zandronum_build/zandronum && | ||
t="$(hg id - | if [ -f src/svnrevision.h ] && | ||
d='' && [ "$t" = tip ] || [ -z "$t" ] | [ "$(hg status src/svnrevision.h)" != "? src/svnrevision.h" ]; then | ||
r=src/svnrevision.h; else r=src/gitinfo.h; fi && | |||
h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" && | |||
t="$(hg id -tr $h)" && | |||
d='' && if [ -z "$(hg log -r $h -k 'BUILD_ID_STR to release')" ]; then | |||
chmod 755 zandronum-server | if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi && | ||
sudo mv -v zandronum-server | printf %s "\ | ||
#!/bin/sh | |||
export LD_LIBRARY_PATH=/usr/games/zandronum$d | |||
exec /usr/games/zandronum$d/zandronum \"\$@\" | |||
" > zandronum$d.sh && | |||
printf %s "\ | |||
#!/bin/sh | |||
exec /usr/games/zandronum$d/zandronum-server \"\$@\" | |||
" > zandronum-server$d.sh && | |||
chmod 755 zandronum$d.sh zandronum-server$d.sh && | |||
sudo mv -v zandronum$d.sh /usr/bin/zandronum$d && | |||
sudo mv -v zandronum-server$d.sh /usr/bin/zandronum-server$d | |||
</pre> | </pre> | ||
Now from a terminal you should be able to | Now from a terminal you should be able to run '''zandronum''' / '''zandronum-alpha''' or '''zandronum-server''' / '''zandronum-server-alpha''' from any user account. | ||
=== Uninstallation === | === Uninstallation === | ||
Remove /usr/games/zandronum directory and all its files: | Remove /usr/games/zandronum directory and all its files: | ||
<pre> | <pre> | ||
Line 293: | Line 357: | ||
</pre> | </pre> | ||
== Debugging == | == Developing == | ||
This page has helped you compile Zandronum, but perhaps you are interested in debugging the code or submitting code changes or fixes for inclusion. This section is intended for more advanced users who may be unfamiliar to CMake or debugging on Linux systems. | |||
=== Debugging Zandronum client === | |||
'''Prerequisite:''' | '''Prerequisite:''' | ||
* [http://www.gnu.org/software/gdb/ gdb] | * [http://www.gnu.org/software/gdb/ gdb] | ||
Maybe you have found a way to make Zandronum client crash, and are interested in debugging it. First, you need to compile a debug build of Zandronum client. Inside the buildclient directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug: | |||
<pre> | <pre> | ||
cd ~/zandronum_build/zandronum/buildclient | |||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DSERVERONLY=OFF | |||
</pre> | </pre> | ||
Optionally, you may want to use some of the [[#Build options]]. | |||
After CMake is done, run <code>make</code> or to speed up compilation, run <code>make -j<number></code>, a recommended value for the <code>-j</code> option is the number of physical cores: | |||
<pre> | <pre> | ||
make | make | ||
</pre> | </pre> | ||
To run Zandronum client under a debugger such as gdb, use the following command: | |||
<pre> | <pre> | ||
gdb zandronum | gdb zandronum | ||
</pre> | </pre> | ||
Now gdb should have you in its own command prompt | Now gdb should have you in its own command prompt: | ||
<pre> | |||
(gdb) | |||
</pre> | |||
You probably want to log the output, so lets output to a file zandronumclientdebug.log: | |||
<pre> | <pre> | ||
(gdb) set logging on zandronumclientdebug.log | (gdb) set logging on zandronumclientdebug.log | ||
</pre> | </pre> | ||
Now start Zandronum client by typing in run, and pressing enter: | |||
<pre> | <pre> | ||
(gdb) run | (gdb) run | ||
</pre> | </pre> | ||
Or put any [[Command Line Parameters|command line]] [http://zdoom.org/wiki/Command_line_parameters parameters] to zandronum after run: | |||
<pre> | <pre> | ||
(gdb) run <command line parameters> | (gdb) run <command line parameters> | ||
</pre> | </pre> | ||
If Zandronum client crashes, gdb may be able to tell you the source file and line number it crashed in. Typing in the command backtrace or bt will produce information telling the last function calls, showing how execution got to the point where it crashed: | |||
<pre> | <pre> | ||
(gdb) | (gdb) backtrace | ||
</pre> | </pre> | ||
All output will be copied into the zandronumclientdebug.log, which can then be scrutinized later, or perhaps posted to the [http://zandronum.com/tracker/ Bug Tracker] for other developers to look at. | All output will be copied into the zandronumclientdebug.log, which can then be scrutinized later, or perhaps posted to the [http://zandronum.com/tracker/ Bug Tracker] for other developers to look at. | ||
To exit gdb's command prompt, | To exit gdb's command prompt, type quit, q or press Ctrl-D: | ||
<pre> | <pre> | ||
(gdb) quit | (gdb) quit | ||
</pre> | </pre> | ||
If you want to free up space, run <code>make clean</code> to remove the files generated by the compilation. | |||
=== Debugging Zandronum server === | === Debugging Zandronum server === | ||
'''Prerequisite:''' | |||
* [http://www.gnu.org/software/gdb/ gdb] | |||
Maybe you have found a way to make Zandronum server crash, and are interested in debugging it. First, you need to compile a debug build of Zandronum server. Inside the buildserver directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug: | |||
<pre> | <pre> | ||
cd ~/zandronum_build/zandronum/buildserver | |||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DSERVERONLY=ON | |||
</pre> | </pre> | ||
Optionally, you may want to use some of the [[#Build options]]. | |||
After CMake is done, run <code>make</code> or to speed up compilation, run <code>make -j<number></code>, a recommended value for the <code>-j</code> option is the number of physical cores: | |||
<pre> | <pre> | ||
make | make | ||
</pre> | </pre> | ||
To run Zandronum server under a debugger such as gdb, use the following command: | |||
<pre> | <pre> | ||
gdb zandronum-server | gdb zandronum-server | ||
</pre> | </pre> | ||
Now gdb should have you in its own command prompt | Now gdb should have you in its own command prompt: | ||
<pre> | |||
(gdb) | |||
</pre> | |||
You probably want to log the output, so lets output to a file zandronumserverdebug.log: | |||
<pre> | <pre> | ||
(gdb) set logging on zandronumserverdebug.log | (gdb) set logging on zandronumserverdebug.log | ||
</pre> | </pre> | ||
Now start Zandronum server by typing in run, and pressing enter: | |||
<pre> | <pre> | ||
(gdb) run | (gdb) run | ||
</pre> | </pre> | ||
Or put any [[Command Line Parameters|command line parameters]] to zandronum-server after run: | |||
<pre> | <pre> | ||
(gdb) run <command line parameters> | (gdb) run <command line parameters> | ||
</pre> | </pre> | ||
If Zandronum server crashes, gdb may be able to tell you the source file and line number it crashed in. Typing in the command backtrace or bt will produce information telling the last function calls, showing how execution got to the point where it crashed: | |||
<pre> | <pre> | ||
(gdb) | (gdb) backtrace | ||
</pre> | </pre> | ||
All output will be copied into the zandronumserverdebug.log, which can then be scrutinized later, or perhaps posted to the [http://zandronum.com/tracker/ Bug Tracker] for other developers to look at. | All output will be copied into the zandronumserverdebug.log, which can then be scrutinized later, or perhaps posted to the [http://zandronum.com/tracker/ Bug Tracker] for other developers to look at. | ||
To exit gdb's command prompt, | To exit gdb's command prompt, type quit, q or press Ctrl-D: | ||
<pre> | <pre> | ||
(gdb) quit | (gdb) quit | ||
</pre> | </pre> | ||
If you want to free up space, run <code>make clean</code> to remove the files generated by the compilation. | |||
== Build | === Build options === | ||
{|class="wikitable" width="72%" | {|class="wikitable" width="72%" | ||
|+ <span style="text-decoration: underline">CMake | |+ <span style="text-decoration: underline">CMake options</span> | ||
|- | |- | ||
!width="10%"|Options!!width="35%"|Description!!width="55%"|Example | !width="10%"|Options!!width="35%"|Description!!width="55%"|Example | ||
|- | |- | ||
|SERVERONLY=ON||Build a server only binary.||cmake -DSERVERONLY=ON .. | |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 | ||
|- | |- | ||
| | |RELEASE_WITH_DEBUG_FILE=ON||Create the debug symbols file for the release build.||cmake .. -DRELEASE_WITH_DEBUG_FILE=ON | ||
|- | |- | ||
| | |FMOD_LIBRARY||Set path for FMOD library file.||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 | ||
|- | |- | ||
| | |CMAKE_C_COMPILER||Set path for C compiler.||cmake .. -DCMAKE_C_COMPILER=/path/to/compiler/gcc | ||
|- | |- | ||
| | |CMAKE_CXX_COMPILER||Set path for C++ compiler.||cmake .. -DCMAKE_CXX_COMPILER=/path/to/compiler/g++ | ||
|} | |} | ||
{|class="wikitable" width="72%" | {|class="wikitable" width="72%" | ||
|+ <span style="text-decoration: underline">CMake | |+ <span style="text-decoration: underline">CMake build types</span> | ||
|- | |- | ||
!width="10%"|Types!!width="45%"|Description!!width="45%"|Example | !width="10%"|Types!!width="45%"|Description!!width="45%"|Example | ||
|- | |- | ||
|Debug||Debug information, -O1 optimization.||cmake -DCMAKE_BUILD_TYPE=Debug | |Debug||Debug information, -O1 optimization.||cmake .. -DCMAKE_BUILD_TYPE=Debug | ||
|- | |- | ||
|Release||No debug information, -O3 optimization.||cmake -DCMAKE_BUILD_TYPE=Release | |Release||No debug information, -O3 optimization.||cmake .. -DCMAKE_BUILD_TYPE=Release | ||
|- | |- | ||
|RelWithDebInfo||Debug information, - | |RelWithDebInfo||Debug information, -O2 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 | |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 | == How to increase Zandronum/GZDoom OpenGL FPS == | ||
Commands beginning with "sudo" will require temporary superuser privileges. | |||
Run Zandronum/[http://zdoom.org/wiki/GZDoom GZDoom], start a new game, open [[Console Commands|console]] and type [http://zdoom.org/wiki/CVARs:Debug#vid_fps vid_fps 1], see how many FPS are displayed and exit Zandronum/GZDoom. | |||
If you do not use Intel graphics, go to [[#Disable Vertical Synchronization for Zandronum/GZDoom]]. | |||
=== Enable SandyBridge's New Acceleration === | |||
'''Prerequisite:''' | '''Prerequisite:''' | ||
Line 452: | Line 540: | ||
* x11-driver-video-intel >= 2.19 | * x11-driver-video-intel >= 2.19 | ||
'''Solus''' | |||
* xorg-driver-video-intel >= 2.19 | |||
If your Intel driver version is 2.21.14-1 / 2.21.15-2 or higher: | |||
If your Intel driver version is 2.21.14-1 / 2.21.15-2 or | <pre> | ||
grep 'SNA compiled:' /var/log/Xorg.0.log | |||
</pre> | |||
go to [[#Disable Vertical Synchronization for Zandronum/GZDoom]]. | |||
Intel SNA is useful on all Intel | Intel SNA is useful on all Intel graphics, not just SandyBridge. | ||
Create /etc/X11/xorg.conf.d directory: | |||
<pre> | <pre> | ||
sudo mkdir -pv /etc/X11/xorg.conf.d | |||
</pre> | </pre> | ||
Create 99-intel.conf file: | |||
<pre> | <pre> | ||
cat <<'EOF' > 99-intel.conf | |||
Section "Device" | Section "Device" | ||
Identifier "Intel Graphics" | |||
Driver "intel" | |||
Option "AccelMethod" "sna" | |||
EndSection | EndSection | ||
EOF | |||
</pre> | </pre> | ||
Move 99-intel.conf to /etc/X11/xorg.conf.d/: | |||
<pre> | <pre> | ||
sudo mv -v 99-intel.conf /etc/X11/xorg.conf.d/ | |||
</pre> | </pre> | ||
and logout and login. | and logout and login. | ||
=== Disable Vertical Synchronization for Zandronum/GZDoom === | === Disable Vertical Synchronization for Zandronum/GZDoom === | ||
Do the following step if you are using a GZDoom version prior to commit [https://github.com/coelckers/gzdoom/commit/4eb32a50e3151968e1b2285688ce98da98fedd9f 4eb32a50e]. The following step works for the open-source graphics drivers. | |||
Create ~/.drirc file: | |||
<pre> | <pre> | ||
cat <<'EOF' > ~/.drirc | |||
<driconf> | <driconf> | ||
<device screen="0" driver="dri2"> | <device screen="0" driver="dri2"> | ||
<application name="zandronum" executable="zandronum"> | <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> | </device> | ||
</driconf> | </driconf> | ||
EOF | |||
</pre> | </pre> | ||
Run Zandronum/GZDoom, start a new game, open console and type | Run Zandronum/GZDoom, start a new game, open [[Console Commands|console]] and type [http://zdoom.org/wiki/CVARs:Debug#vid_fps vid_fps 1], see how many FPS are displayed, you should get more FPS than before. | ||
=== | === Reverting changes === | ||
Remove .drirc: | Remove ~/.drirc file: | ||
<pre> | <pre> | ||
rm -fv ~/.drirc | |||
rm -fv .drirc | |||
</pre> | </pre> | ||
Remove 99-intel.conf file: | |||
<pre> | <pre> | ||
sudo rm -fv /etc/X11/xorg.conf.d/99-intel.conf | |||
</pre> | </pre> | ||
and logout and login. | and logout and login. | ||
[[Category:Developers Articles]] | [[Category:Developers Articles]] |
Revision as of 18:30, 16 December 2017
Open a terminal and copy and paste the whole code box for each step.
Install dependencies
Zandronum needs certain tools and development files in order to compile:
- Required
- gcc 4.6 or later
- make
- cmake 2.8.7 or later
- SDL 1.2.8 or later 1.2.x versions
- libGL and libGLU (SDL or libSDL pull in libGLU) or any other GL implementation provider.
- FMOD Ex 4.24.16
- libopenssl (for Zandronum 1.3 or later)
- SQLite (for Zandronum 1.3 or later)
- Recommended
- GTK2
- mercurial (needed in order to download the source and compile in commit meta data)
- nasm 0.98.39 or later (x86-32 only)
- Optional
- zlib (Zandronum has a copy of it and will be statically compiled in if not found)
- libbzip2 (possibly static)
- libjpeg (possibly static)
- Runtime
- gxmessage (optional - needed to show the crash log in a window)
- kdialog (optional - for KDE users)
- fluidsynth or timidity (optional - for MIDI playback)
Install the following as root/superuser:
Debian/Ubuntu
sudo apt-get install g++ make cmake libsdl1.2-dev mercurial zlib1g-dev \ libbz2-dev libjpeg-dev libfluidsynth-dev libgtk2.0-dev timidity nasm \ libgl1-mesa-dev libssl-dev tar
Fedora
dnf install gcc-c++ make cmake SDL-devel mercurial zlib-devel \ bzip2-devel libjpeg-turbo-devel fluidsynth-devel gtk2-devel timidity++ nasm \ mesa-libGL-devel openssl-devel tar
openSUSE
zypper install gcc-c++ make cmake libSDL-devel mercurial zlib-devel \ libbz2-devel libjpeg-devel fluidsynth-devel gtk2-devel timidity nasm \ Mesa-libGL-devel libopenssl-devel tar
Mageia
a='' && [ "$(uname -m)" = x86_64 ] && a=64 urpmi gcc-c++ make cmake lib${a}SDL-devel mercurial lib${a}zlib-devel \ lib${a}bzip2-devel lib${a}jpeg-devel lib${a}fluidsynth-devel \ lib${a}gtk+2.0-devel lib${a}cairo-devel TiMidity++ nasm \ lib${a}mesagl1-devel lib${a}openssl-devel tar
Arch Linux
pacman -S --needed gcc make cmake sdl mercurial zlib bzip2 libjpeg-turbo \ fluidsynth gtk2 timidity++ nasm mesa glu openssl tar
Gentoo
emerge -avn sys-devel/gcc sys-devel/make dev-util/cmake media-libs/libsdl \ dev-vcs/mercurial sys-libs/zlib app-arch/bzip2 media-libs/libjpeg-turbo media-sound/fluidsynth \ x11-libs/gtk+ media-sound/timidity++ dev-lang/nasm media-libs/mesa media-libs/glu \ dev-libs/openssl app-arch/tar
PCLinuxOS
a='' && [ "$(uname -m)" = x86_64 ] && a=64 apt-get install gcc-c++ make cmake lib${a}SDL-devel mercurial zlib1-devel \ lib${a}bzip2-devel lib${a}jpeg62-devel lib${a}fluidsynth1-devel \ lib${a}gtk+2.0_0-devel TiMidity++ nasm lib${a}mesagl1-devel \ lib${a}openssl-devel tar
Solus
sudo eopkg install g++ make cmake binutils glibc-devel pkg-config \ sdl1-devel mercurial zlib-devel bzip2-devel libjpeg-turbo-devel \ fluidsynth-devel libgtk-2-devel nasm mesalib-devel libglu-devel \ openssl-devel tar
Do the following sections as normal user.
Create zandronum_build directory
mkdir -pv ~/zandronum_build
Download and prepare the source
Download the Zandronum source and create buildclient and buildserver directories:
cd ~/zandronum_build && hg clone https://bitbucket.org/Torr_Samaho/zandronum && mkdir -pv zandronum/buildclient zandronum/buildserver
Download FMOD
Download FMOD 4.24.16 32-bit or 64-bit and extract files to zandronum directory:
a='' && [ "$(uname -m)" = x86_64 ] && a=64 cd ~/zandronum_build && wget -nc http://zandronum.com/essentials/fmod/fmodapi42416linux${a}.tar.gz && tar -xvzf fmodapi42416linux${a}.tar.gz -C zandronum
Compiling
To compile Zandronum client:
a='' && [ "$(uname -m)" = x86_64 ] && a=64 c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1 cd ~/zandronum_build/zandronum/buildclient && rm -f output_sdl/liboutput_sdl.so && if [ -d "../fmodapi42416linux${a}" ]; then f="-DFMOD_LIBRARY=../fmodapi42416linux${a}/api/lib/libfmodex${a}-4.24.16.so \ -DFMOD_INCLUDE_DIR=../fmodapi42416linux${a}/api/inc"; else f='-UFMOD_LIBRARY -UFMOD_INCLUDE_DIR'; fi && cmake .. -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=OFF -DRELEASE_WITH_DEBUG_FILE=OFF $f && make -j$c
A development version of Zandronum client will be compiled if you do not do #Latest stable version.
Assuming all goes well, a zandronum binary should be produced. To start Zandronum client, the following command should work:
./zandronum
To compile Zandronum server:
c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1 cd ~/zandronum_build/zandronum/buildserver && cmake .. -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=ON -DRELEASE_WITH_DEBUG_FILE=OFF && make -j$c
A development version of Zandronum server will be compiled if you do not do #Latest stable version.
Assuming all goes well, a zandronum-server binary should be produced. To start Zandronum server, the following command should work:
./zandronum-server
If Zandronum complains you do not have any IWADs set up, make sure that you have your IWAD files placed in the same directory as Zandronum, in ~/.config/zandronum/, ~/.zandronum/, $DOOMWADDIR, or /usr/local/share/. Alternatively, you can edit ~/.config/zandronum/zandronum.ini or ~/.zandronum/zandronum.ini to set the path for your IWADs.
Latest stable version
Show the latest stable version:
cd ~/zandronum_build/zandronum && if [ "$(hg log -r 'max(tagged())' --template '{rev}\n')" -ge \ "$(hg log -l1 -k 'BUILD_ID_STR to release' --template '{rev}\n')" ]; then hg identify -r 'max(tagged())'; else u="$(hg log -l1 -k 'BUILD_ID_STR to release' \ --template '{node|short}\n')"; echo "$u $(hg log -r $u --template '{desc}\n' | sed -n 's/.*changed the version string to \(.*\)/\1/p')"; fi
If you want to compile the latest stable version, run:
cd ~/zandronum_build/zandronum && if [ "$(hg log -r 'max(tagged())' --template '{rev}\n')" -ge \ "$(hg log -l1 -k 'BUILD_ID_STR to release' --template '{rev}\n')" ]; then hg update -cr 'max(tagged())'; else hg update -c $(hg log -l1 -k \ 'BUILD_ID_STR to release' --template '{node}\n'); fi
and compile.
After compiling, backing up and optionally installing the latest stable version, run:
cd ~/zandronum_build/zandronum && hg update
A specific Zandronum version by UTC commit date
To compile a specific Zandronum version, for example 3.0-alpha-170806-2040; first, checkout the commit that matches 170806-2040. From left to right, 17 (2017) is the year, 08 is the month, 06 is the day, 20 is the hour, 40 is the minute and the time zone is +0000:
cd ~/zandronum_build/zandronum && hg update -cd '2017-08-06 20:40 +0000'
Now go to #Compiling.
After compiling, backing up and optionally installing Zandronum, run:
cd ~/zandronum_build/zandronum && hg update
Older versions
First, show the Zandronum version you are currently on:
w='r ' && [ "$(uname -s)" = Linux ] && w='d @' cd ~/zandronum_build/zandronum && v="$(sed -n 's/.*#define GAMEVER_STRING "\(.*\)".*/\1/p' src/version.h)\ $(sed -n 's/.*#define DOTVERSIONSTR GAMEVER_STRING "\(.*\)".*/\1/p' src/version.h)\ $(date -u$w$(hg log -r . --template '{date}\n' | cut -d'.' -f1) +'-%y%m%d-%H%M')\ $(hg id -i | sed '/+$/!s/.*//;s/.*+$/M/')" && echo $v
If the Zandronum version you are currently on is 2.x or lower, do the following:
To compile Zandronum 2.x or older versions, you need to install gcc 4.9 or lower:
sudo apt-get install gcc-4.9 g++-4.9
Inside the buildclient and buildserver directories, run cmake with these arguments -DCMAKE_C_COMPILER=/path/to/compiler/gcc -DCMAKE_CXX_COMPILER=/path/to/compiler/g++, for example:
cd ~/zandronum_build/zandronum/buildclient && cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 \ -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9
cd ~/zandronum_build/zandronum/buildserver && cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 \ -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9
and compile.
If you are going to compile Zandronum 1.0 (120819-2011) and your Mesa version is 9.x or higher:
glxinfo | grep 'OpenGL version'
apply the fix from commit a69d59da0f51, otherwise the Zandronum client will not compile.
Backup
If you want to backup Zandronum, do the following:
Create and name a directory with the corresponding Zandronum version/revision, build type and copy zandronum, zandronum-server, zandronum.pk3, skulltag_actors.pk3 and liboutput_sdl.so to it:
cd ~/zandronum_build/zandronum && e=buildclient && i=buildserver && if [ -f "$e/CMakeCache.txt" ]; then j="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' $e/CMakeCache.txt)"; else j=''; fi && if [ -f "$i/CMakeCache.txt" ]; then k="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' $i/CMakeCache.txt)"; else k=''; fi && if [ -n "$j" ]; then b="-BuildType$j"; elif [ -n "$k" ]; then b="-BuildType$k"; else b=''; fi && r=src/svnrevision.h && if [ -f "$r" ] && [ "$(hg status $r)" != "? $r" ]; then r=$r; else r=src/gitinfo.h; fi && h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" && BACKUPZANDRONUM="../$(hg cat -r $h src/version.h | sed -n 's/.*#define GAMEVER_STRING "\(.*\)".*/\1/p')\ $(hg cat -r $h src/version.h | sed -n 's/.*#define DOTVERSIONSTR GAMEVER_STRING "\(.*\)".*/\1/p')\ $(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\-\1/p' $r)\ $(sed -n 's/.*#define HG_TIME "\(.*\)".*/\-\1/p' $r)-$h$b" && mkdir -pv "$BACKUPZANDRONUM" && x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" && if [ -f "$y" ] && [ -f "$z" ] && [ "$z" -nt "$y" ]; then x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi && o="$e/output_sdl/liboutput_sdl.so" && if [ -f "$o" ]; then l="$o"; else l=''; fi && cp -v $e/zandronum $i/zandronum-server $x/zandronum.pk3 $x/skulltag_actors.pk3 $l \ "$BACKUPZANDRONUM"/
Files are located at:
/home/<your username>/zandronum_build/<your newly created directory>
Updating
When you wish to update Zandronum, copy and paste the following:
cd ~/zandronum_build/zandronum && hg pull ; hg update
When the update finish, go to #Compiling.
Installation
- zandronum / zandronum-server = Stable version
- zandronum-alpha / zandronum-server-alpha = Development version
Commands beginning with "sudo" will require temporary superuser privileges.
If you want to install Zandronum, do the following:
Create /usr/games/zandronum and /usr/games/zandronum-alpha directories:
sudo mkdir -pv /usr/games/zandronum /usr/games/zandronum-alpha
Copy zandronum, zandronum-server, zandronum.pk3, skulltag_actors.pk3, liboutput_sdl.so and the FMOD library file to /usr/games/zandronum/ or /usr/games/zandronum-alpha/:
a='' && [ "$(uname -m)" = x86_64 ] && a=64 cd ~/zandronum_build/zandronum && e=buildclient && i=buildserver && if [ -f src/svnrevision.h ] && [ "$(hg status src/svnrevision.h)" != "? src/svnrevision.h" ]; then r=src/svnrevision.h; else r=src/gitinfo.h; fi && h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" && t="$(hg id -tr $h)" && d='' && if [ -z "$(hg log -r $h -k 'BUILD_ID_STR to release')" ]; then if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi && x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" && if [ -f "$y" ] && [ -f "$z" ] && [ "$z" -nt "$y" ]; then x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi && o="$e/output_sdl/liboutput_sdl.so" && if [ -f "$o" ]; then l="$o \ fmodapi42416linux${a}/api/lib/libfmodex${a}-4.24.16.so"; else l=''; fi && sudo cp -v $e/zandronum $i/zandronum-server $x/zandronum.pk3 $x/skulltag_actors.pk3 $l \ /usr/games/zandronum$d/
Create launch scripts:
cd ~/zandronum_build/zandronum && if [ -f src/svnrevision.h ] && [ "$(hg status src/svnrevision.h)" != "? src/svnrevision.h" ]; then r=src/svnrevision.h; else r=src/gitinfo.h; fi && h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" && t="$(hg id -tr $h)" && d='' && if [ -z "$(hg log -r $h -k 'BUILD_ID_STR to release')" ]; then if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi && printf %s "\ #!/bin/sh export LD_LIBRARY_PATH=/usr/games/zandronum$d exec /usr/games/zandronum$d/zandronum \"\$@\" " > zandronum$d.sh && printf %s "\ #!/bin/sh exec /usr/games/zandronum$d/zandronum-server \"\$@\" " > zandronum-server$d.sh && chmod 755 zandronum$d.sh zandronum-server$d.sh && sudo mv -v zandronum$d.sh /usr/bin/zandronum$d && sudo mv -v zandronum-server$d.sh /usr/bin/zandronum-server$d
Now from a terminal you should be able to run zandronum / zandronum-alpha or zandronum-server / zandronum-server-alpha from any user account.
Uninstallation
Remove /usr/games/zandronum directory and all its files:
sudo rm -rfv /usr/games/zandronum
Remove zandronum script:
sudo rm -fv /usr/bin/zandronum
Remove zandronum-server script:
sudo rm -fv /usr/bin/zandronum-server
Remove /usr/games/zandronum-alpha directory and all its files:
sudo rm -rfv /usr/games/zandronum-alpha
Remove zandronum-alpha script:
sudo rm -fv /usr/bin/zandronum-alpha
Remove zandronum-server-alpha script:
sudo rm -fv /usr/bin/zandronum-server-alpha
Developing
This page has helped you compile Zandronum, but perhaps you are interested in debugging the code or submitting code changes or fixes for inclusion. This section is intended for more advanced users who may be unfamiliar to CMake or debugging on Linux systems.
Debugging Zandronum client
Prerequisite:
Maybe you have found a way to make Zandronum client crash, and are interested in debugging it. First, you need to compile a debug build of Zandronum client. Inside the buildclient directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug:
cd ~/zandronum_build/zandronum/buildclient cmake .. -DCMAKE_BUILD_TYPE=Debug -DSERVERONLY=OFF
Optionally, you may want to use some of the #Build options.
After CMake is done, run make
or to speed up compilation, run make -j<number>
, a recommended value for the -j
option is the number of physical cores:
make
To run Zandronum client under a debugger such as gdb, use the following command:
gdb zandronum
Now gdb should have you in its own command prompt:
(gdb)
You probably want to log the output, so lets output to a file zandronumclientdebug.log:
(gdb) set logging on zandronumclientdebug.log
Now start Zandronum client by typing in run, and pressing enter:
(gdb) run
Or put any command line parameters to zandronum after run:
(gdb) run <command line parameters>
If Zandronum client crashes, gdb may be able to tell you the source file and line number it crashed in. Typing in the command backtrace or bt will produce information telling the last function calls, showing how execution got to the point where it crashed:
(gdb) backtrace
All output will be copied into the zandronumclientdebug.log, which can then be scrutinized later, or perhaps posted to the Bug Tracker for other developers to look at.
To exit gdb's command prompt, type quit, q or press Ctrl-D:
(gdb) quit
If you want to free up space, run make clean
to remove the files generated by the compilation.
Debugging Zandronum server
Prerequisite:
Maybe you have found a way to make Zandronum server crash, and are interested in debugging it. First, you need to compile a debug build of Zandronum server. Inside the buildserver directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug:
cd ~/zandronum_build/zandronum/buildserver cmake .. -DCMAKE_BUILD_TYPE=Debug -DSERVERONLY=ON
Optionally, you may want to use some of the #Build options.
After CMake is done, run make
or to speed up compilation, run make -j<number>
, a recommended value for the -j
option is the number of physical cores:
make
To run Zandronum server under a debugger such as gdb, use the following command:
gdb zandronum-server
Now gdb should have you in its own command prompt:
(gdb)
You probably want to log the output, so lets output to a file zandronumserverdebug.log:
(gdb) set logging on zandronumserverdebug.log
Now start Zandronum server by typing in run, and pressing enter:
(gdb) run
Or put any command line parameters to zandronum-server after run:
(gdb) run <command line parameters>
If Zandronum server crashes, gdb may be able to tell you the source file and line number it crashed in. Typing in the command backtrace or bt will produce information telling the last function calls, showing how execution got to the point where it crashed:
(gdb) backtrace
All output will be copied into the zandronumserverdebug.log, which can then be scrutinized later, or perhaps posted to the Bug Tracker for other developers to look at.
To exit gdb's command prompt, type quit, q or press Ctrl-D:
(gdb) quit
If you want to free up space, run make clean
to remove the files generated by the compilation.
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 |
RELEASE_WITH_DEBUG_FILE=ON | Create the debug symbols file for the release build. | cmake .. -DRELEASE_WITH_DEBUG_FILE=ON |
FMOD_LIBRARY | Set path for FMOD library file. | 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 |
CMAKE_C_COMPILER | Set path for C compiler. | cmake .. -DCMAKE_C_COMPILER=/path/to/compiler/gcc |
CMAKE_CXX_COMPILER | Set path for C++ compiler. | cmake .. -DCMAKE_CXX_COMPILER=/path/to/compiler/g++ |
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, -O2 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
Commands beginning with "sudo" will require temporary superuser privileges.
Run Zandronum/GZDoom, start a new game, open console and type vid_fps 1, see how many FPS are displayed and exit Zandronum/GZDoom.
If you do not use Intel graphics, go to #Disable Vertical Synchronization for Zandronum/GZDoom.
Enable SandyBridge's New Acceleration
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
Solus
- xorg-driver-video-intel >= 2.19
If your Intel driver version is 2.21.14-1 / 2.21.15-2 or higher:
grep 'SNA compiled:' /var/log/Xorg.0.log
go to #Disable Vertical Synchronization for Zandronum/GZDoom.
Intel SNA is useful on all Intel graphics, not just SandyBridge.
Create /etc/X11/xorg.conf.d directory:
sudo mkdir -pv /etc/X11/xorg.conf.d
Create 99-intel.conf file:
cat <<'EOF' > 99-intel.conf Section "Device" Identifier "Intel Graphics" Driver "intel" Option "AccelMethod" "sna" EndSection EOF
Move 99-intel.conf to /etc/X11/xorg.conf.d/:
sudo mv -v 99-intel.conf /etc/X11/xorg.conf.d/
and logout and login.
Disable Vertical Synchronization for Zandronum/GZDoom
Do the following step if you are using a GZDoom version prior to commit 4eb32a50e. The following step works for the open-source graphics drivers.
Create ~/.drirc file:
cat <<'EOF' > ~/.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> EOF
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.
Reverting changes
Remove ~/.drirc file:
rm -fv ~/.drirc
Remove 99-intel.conf file:
sudo rm -fv /etc/X11/xorg.conf.d/99-intel.conf
and logout and login.