Jump to content

Compiling Zandronum on Linux: Difference between revisions

Remove SQLite as a requirement (Zan now downloads it automatically)
(changes to fmod compiling for zandronum)
(Remove SQLite as a requirement (Zan now downloads it automatically))
Tag: Source edit
 
(16 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.'''
'''Open a terminal and copy and paste the whole code box for each step.'''
<div style='background-color: khaki; border: 1px solid darkkhaki; padding: 0 5px;'>
<div style='border-bottom: 1px solid darkkhaki;'>
<strong>Notice</strong>
</div>
<div>
<table>
<tr>
<td class='za-no-mobile'>
[[File:Unkna0.png]]
</td>
<td style='padding-left: 5px;'>
There is a known issue where FMOD will cause the game to crash during startup on newer versions of Linux distros. See [https://zandronum.com/forum/viewtopic.php?f=39&t=9885 this forum thread] for a workaround.
</td>
</tr>
</table>
</div>
</div>


== Install dependencies ==
== Install dependencies ==
Line 27: Line 9:
** SDL 1.2.8 or later 1.2.x versions
** 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.
** 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
** [http://zandronum.com/essentials/fmod/ FMOD Ex] 4.44.64
** libopenssl ''(for Zandronum 1.3 or later)''
** libopenssl ''(for Zandronum 1.3 or later)''
** SQLite ''(for Zandronum 1.3 or later)''
** libopus ''(for Zandronum 3.2 or later)''
* '''Recommended'''
* '''Recommended'''
** GTK2
** GTK2
** mercurial ''(needed in order to [https://bitbucket.org/Torr_Samaho/zandronum download the source] and compile in commit meta data)''
** 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)''
** nasm 0.98.39 or later ''(x86-32 only)''
* '''Optional'''
* '''Optional'''
Line 47: Line 30:
=== Debian/Ubuntu ===
=== Debian/Ubuntu ===
<pre>
<pre>
sudo apt-get install g++ make cmake libsdl1.2-dev mercurial zlib1g-dev \
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 \
libbz2-dev libjpeg-dev libfluidsynth-dev libgtk2.0-dev timidity nasm \
libgl1-mesa-dev libssl-dev tar libglew-dev
libgl1-mesa-dev libssl-dev tar libglew-dev libopus-dev
</pre>
</pre>


Line 56: Line 39:
dnf install gcc-c++ make cmake SDL-devel mercurial zlib-devel \
dnf install gcc-c++ make cmake SDL-devel mercurial zlib-devel \
bzip2-devel libjpeg-turbo-devel fluidsynth-devel gtk2-devel timidity++ nasm \
bzip2-devel libjpeg-turbo-devel fluidsynth-devel gtk2-devel timidity++ nasm \
mesa-libGL-devel openssl-devel tar
mesa-libGL-devel openssl-devel glew glew-devel tar
</pre>
</pre>


Line 63: Line 46:
zypper install gcc-c++ make cmake libSDL-devel mercurial zlib-devel \
zypper install gcc-c++ make cmake libSDL-devel mercurial zlib-devel \
libbz2-devel libjpeg-devel fluidsynth-devel gtk2-devel timidity nasm \
libbz2-devel libjpeg-devel fluidsynth-devel gtk2-devel timidity nasm \
Mesa-libGL-devel libopenssl-devel tar
Mesa-libGL-devel libopenssl-devel tar glew glew-devel
</pre>
</pre>


Line 77: Line 60:
=== Arch Linux ===
=== Arch Linux ===
<pre>
<pre>
pacman -S --needed gcc make cmake sdl mercurial zlib bzip2 libjpeg-turbo \
pacman -S --needed gcc make cmake sdl12-compat mercurial zlib bzip2 libjpeg-turbo \
fluidsynth gtk2 timidity++ nasm mesa glu openssl tar glew
fluidsynth gtk2 timidity++ nasm mesa glu openssl tar glew
</pre>
</pre>
Line 107: Line 90:


'''Do the following sections as normal user.'''
'''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 ==
== Create zandronum_build directory ==
Line 117: Line 111:
<pre>
<pre>
cd ~/zandronum_build &&
cd ~/zandronum_build &&
hg clone https://hg.osdn.net/view/zandronum/zandronum-stable zandronum &&
hg clone https://foss.heptapod.net/zandronum/zandronum-stable zandronum &&
mkdir -pv zandronum/buildclient zandronum/buildserver
mkdir -pv zandronum/buildclient zandronum/buildserver
</pre>
</pre>


== Download FMOD ==
== Download FMOD ==
'''3.1'''
 
Download FMOD 4.44.64 and extract files to zandronum directory:
Download FMOD 4.44.64 and extract files to zandronum directory:
<pre>
<pre>
Line 128: Line 122:
wget -nc https://zandronum.com/essentials/fmod/fmodapi44464linux.tar.gz &&
wget -nc https://zandronum.com/essentials/fmod/fmodapi44464linux.tar.gz &&
tar -xvzf fmodapi44464linux.tar.gz -C zandronum
tar -xvzf fmodapi44464linux.tar.gz -C zandronum
</pre>
'''3.0'''
Download FMOD 4.24.16 32-bit or 64-bit and extract files to zandronum directory:
<pre>
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
</pre>
</pre>


== Compiling ==
== Compiling ==
To compile Zandronum client:
To compile Zandronum client:
<pre>
<pre>
a='' && [ "$(uname -m)" = x86_64 ] && a=64
a='' && [ "$(uname -m)" = x86_64 ] && a=64
Line 146: Line 132:
cd ~/zandronum_build/zandronum/buildclient &&
cd ~/zandronum_build/zandronum/buildclient &&
rm -f output_sdl/liboutput_sdl.so &&
rm -f output_sdl/liboutput_sdl.so &&
if [ -d "../fmodapi42416linux${a}" ]; then
if [ -d "../fmodapi44464linux" ]; then
f="-DFMOD_LIBRARY=../fmodapi42416linux${a}/api/lib/libfmodex${a}-4.24.16.so \
f="-DFMOD_LIBRARY=../fmodapi44464linux/api/lib/libfmodex${a}-4.44.64.so \
-DFMOD_INCLUDE_DIR=../fmodapi42416linux${a}/api/inc"; else
-DFMOD_INCLUDE_DIR=../fmodapi44464linux/api/inc"; else
f='-UFMOD_LIBRARY -UFMOD_INCLUDE_DIR'; fi &&
f='-UFMOD_LIBRARY -UFMOD_INCLUDE_DIR'; fi &&
cmake .. -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=OFF -DRELEASE_WITH_DEBUG_FILE=OFF $f &&
cmake .. -DCMAKE_BUILD_TYPE=Release -DSERVERONLY=OFF -DRELEASE_WITH_DEBUG_FILE=OFF $f &&
Line 308: Line 294:
r=src/svnrevision.h && if [ -f "$r" ] && [ "$(hg status $r)" != "? $r" ]; then r=$r; else
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)" &&
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
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 &&
if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi &&
x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" &&
x="$e" && y="$e/zandronum.pk3" && z="$i/zandronum.pk3" &&
Line 314: Line 300:
x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi &&
x="$i"; elif [ ! -f "$y" ] && [ -f "$z" ]; then x="$i"; fi &&
o="$e/output_sdl/liboutput_sdl.so" && if [ -f "$o" ]; then l="$o \
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 &&
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 \
sudo cp -v $e/zandronum $i/zandronum-server $x/zandronum.pk3 $x/skulltag_actors.pk3 $l \
/usr/games/zandronum$d/
/usr/games/zandronum$d/
Line 324: Line 310:
r=src/svnrevision.h && if [ -f "$r" ] && [ "$(hg status $r)" != "? $r" ]; then r=$r; else
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)" &&
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
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 &&
if [ "$t" = tip ] || [ -z "$t" ]; then d=-alpha; fi; fi &&
printf %s "\
printf %s "\