1,562
edits
DrinkyBird (talk | contribs) (Created page with "== 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...") |
DrinkyBird (talk | contribs) (Remove SQLite as a requirement (Zan now downloads it automatically)) Tag: Source edit |
||
(29 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
'''Open a terminal and copy and paste the whole code box for each step.''' | |||
Install the following | == 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.44.64 | |||
** libopenssl ''(for Zandronum 1.3 or later)'' | |||
** libopus ''(for Zandronum 3.2 or later)'' | |||
* '''Recommended''' | |||
** GTK2 | |||
** mercurial ''(needed in order to [https://foss.heptapod.net/zandronum/zandronum-stable download the source] and compile in commit meta data)'' | |||
*** mercurial-evolve ''(optional, includes the <tt>topic</tt> and <tt>evolve</tt> extensions, which are needed only if you intend to compile a specific topic. Some distros may include these as part of their base Mercurial package)'' | |||
** 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 [http://zdoom.org/wiki/MIDI MIDI] playback)'' | |||
Install the following as root/superuser: | |||
=== Debian/Ubuntu === | === Debian/Ubuntu === | ||
<pre> | <pre> | ||
sudo apt-get install | sudo apt-get install g++ make cmake libsdl1.2-compat-dev mercurial mercurial-evolve zlib1g-dev \ | ||
libbz2-dev libjpeg-dev libfluidsynth-dev libgtk2.0-dev timidity nasm \ | |||
libssl-dev libglew-dev | libgl1-mesa-dev libssl-dev tar libglew-dev libopus-dev | ||
</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 glew glew-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 glew glew-devel | ||
</pre> | </pre> | ||
=== Mageia === | === Mageia === | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | |||
a= | 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 | |||
urpmi gcc-c++ make lib | |||
lib | |||
lib | |||
lib | |||
</pre> | </pre> | ||
=== Arch Linux === | === Arch Linux === | ||
<pre> | <pre> | ||
pacman -S --needed gcc make zlib | pacman -S --needed gcc make cmake sdl12-compat mercurial zlib bzip2 libjpeg-turbo \ | ||
fluidsynth mesa glu openssl | fluidsynth gtk2 timidity++ nasm mesa glu openssl tar glew | ||
</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> | ||
=== PCLinuxOS === | === PCLinuxOS === | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | |||
a= | 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 | |||
apt-get install gcc-c++ make zlib1-devel lib | |||
lib | |||
lib | |||
lib | |||
</pre> | </pre> | ||
=== Solus === | |||
== | |||
<pre> | <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 sections as normal user.''' | |||
== Enable Mercurial extensions == | |||
This section is optional, and is required only if you intend to build a specific topic. Doing so requires the <tt>topic</tt> and <tt>evolve</tt> extensions to be enabled. Some distros may package these separately from the base Mercurial package, so check your package manager. | |||
Add the following to the <tt>extensions</tt> section of <tt>~/.hgrc</tt>: | |||
== | <syntaxhighlight lang="ini"> | ||
[extensions] | |||
topic = | |||
evolve = | |||
</syntaxhighlight> | |||
== Create zandronum_build directory == | |||
<pre> | <pre> | ||
cd | mkdir -pv ~/zandronum_build | ||
hg clone https:// | </pre> | ||
mkdir -pv zandronum/ | |||
== Download and prepare the source == | |||
Download the Zandronum source and create buildclient and buildserver directories: | |||
<pre> | |||
cd ~/zandronum_build && | |||
hg clone https://foss.heptapod.net/zandronum/zandronum-stable zandronum && | |||
mkdir -pv zandronum/buildclient zandronum/buildserver | |||
</pre> | </pre> | ||
== Download FMOD == | == Download FMOD == | ||
Download FMOD 4. | Download FMOD 4.44.64 and extract files to zandronum directory: | ||
<pre> | <pre> | ||
cd | cd ~/zandronum_build && | ||
wget -nc https://zandronum.com/essentials/fmod/fmodapi44464linux.tar.gz && | |||
tar -xvzf fmodapi44464linux.tar.gz -C zandronum | |||
wget -nc | |||
tar -xvzf | |||
</pre> | </pre> | ||
=== | == Compiling == | ||
To compile Zandronum client: | |||
<pre> | |||
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 "../fmodapi44464linux" ]; then | |||
f="-DFMOD_LIBRARY=../fmodapi44464linux/api/lib/libfmodex${a}-4.44.64.so \ | |||
-DFMOD_INCLUDE_DIR=../fmodapi44464linux/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> | |||
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: | |||
<pre> | |||
./zandronum | |||
</pre> | |||
To compile Zandronum server: | |||
<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 -DRELEASE_WITH_DEBUG_FILE=OFF && | |||
make -j$c | |||
</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: | |||
To | <pre> | ||
./zandronum-server | |||
</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/, ~/.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: | |||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
u="$(hg log -l1 -k 'changed the version string to' \ | |||
--template '{node|short}\n')"; echo "$u ZA_$(hg log -r $u --template '{desc}\n' | | |||
sed -n 's/.*changed the version string to \(.*\)/\1/p')" | |||
- | |||
</pre> | </pre> | ||
If you want to compile the latest stable version, run: | |||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg update -c $(hg log -l1 -k 'changed the version string to' --template '{node}\n') | |||
</pre> | </pre> | ||
and [[#Compiling|compile]]. | |||
After compiling, [[#Backup|backing up]] and optionally [[#Installation|installing]] the latest stable version, run: | |||
<pre> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg | hg update | ||
</pre> | </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> | <pre> | ||
cd | cd ~/zandronum_build/zandronum && | ||
hg update - | hg update -cd '2017-08-06 20:40 +0000' | ||
</pre> | </pre> | ||
Now go to [[#Compiling]]. | |||
After 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> | <pre> | ||
cd | cd ~/zandronum_build/zandronum/buildserver && | ||
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc-4.9 \ | |||
-DCMAKE_CXX_COMPILER=/usr/bin/g++-4.9 | |||
</pre> | </pre> | ||
and [[#Compiling|compile]]. | |||
If | 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> | ||
When the update finish, go to [[# | When the update finish, go to [[#Compiling]]. | ||
== 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/zandronum | 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 && | |||
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)" && | |||
t="$(hg id -tr $h)" && d='' && if [ -z "$(hg log -r $h -k 'changed the version string to')" ]; then | |||
fi && | if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi && | ||
sudo cp -v / | x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" && | ||
zandronum.pk3 | if [ -f "$y" ] && [ -f "$z" ] && [ "$z" -nt "$y" ]; then | ||
x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi && | |||
/usr/games/zandronum | o="$e/output_sdl/liboutput_sdl.so" && if [ -f "$o" ]; then l="$o \ | ||
fmodapi44464linux/api/lib/libfmodex${a}-4.44.64.so"; else l=''; fi && | |||
sudo cp -v $e/zandronum $i/zandronum-server $x/zandronum.pk3 $x/skulltag_actors.pk3 $l \ | |||
/usr/games/zandronum$d/ | |||
</pre> | </pre> | ||
Create launch scripts: | |||
<pre> | <pre> | ||
cd / | cd ~/zandronum_build/zandronum && | ||
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)" && | |||
t="$(hg id -tr $h)" && d='' && if [ -z "$(hg log -r $h -k 'changed the version string to')" ]; then | |||
if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi && | |||
chmod 755 zandronum && | printf %s "\ | ||
sudo | #! /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 run '''zandronum''' / '''zandronum-alpha''' or '''zandronum-server''' / '''zandronum-server-alpha''' from any user account. | |||
=== Uninstallation === | |||
Remove /usr/games/zandronum directory and all its files: | |||
<pre> | <pre> | ||
sudo rm -rfv /usr/games/zandronum | |||
</pre> | </pre> | ||
Remove zandronum script: | |||
<pre> | |||
sudo rm -fv /usr/bin/zandronum | |||
</pre> | |||
Remove zandronum-server script: | |||
<pre> | |||
sudo rm -fv /usr/bin/zandronum-server | |||
</pre> | |||
Remove /usr/games/zandronum-alpha directory and all its files: | |||
Remove /usr/games/zandronum directory and all its files: | |||
<pre> | <pre> | ||
sudo rm -rfv /usr/games/zandronum-alpha | |||
</pre> | </pre> | ||
Remove zandronum script: | Remove zandronum-alpha script: | ||
<pre> | <pre> | ||
sudo rm -fv /usr/bin/zandronum-alpha | |||
</pre> | </pre> | ||
Remove zandronum-server script: | Remove zandronum-server-alpha script: | ||
<pre> | <pre> | ||
sudo rm -fv /usr/bin/zandronum-server-alpha | |||
</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> | ||
You probably want to log the output, so lets output to a file zandronumclientdebug.log | 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> | ||
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. | |||
To exit | 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 === | |||
'''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: | |||
<pre> | <pre> | ||
(gdb) | |||
</pre> | </pre> | ||
You probably want to log the output, so lets output to a file zandronumserverdebug.log: | |||
<pre> | |||
(gdb) set logging on zandronumserverdebug.log | |||
</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. | |||
To exit | 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=" | {|class="wikitable" width="80%" | ||
|+ <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_GTK=ON||Disable GTK+ dialogs.||cmake .. -DNO_GTK=ON | ||
|- | |- | ||
|NO_SOUND=ON||Disable sound support.||cmake -DNO_SOUND=ON | |NO_SOUND=ON||Disable sound support.||cmake .. -DNO_SOUND=ON | ||
|- | |- | ||
|NO_GL=ON||Disable OpenGL support.||cmake -DNO_GL=ON | |NO_GL=ON||Disable OpenGL support.||cmake .. -DNO_GL=ON | ||
|- | |- | ||
|NO_ASM=ON||Disable assembly code.||cmake -DNO_ASM=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_INCLUDE_DIR||Set path for FMOD include directory.||cmake -DFMOD_INCLUDE_DIR=/path/to/include/dir .. | |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=" | {|class="wikitable" width="80%" | ||
|+ <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 466: | Line 542: | ||
* 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]] |