Compiling Zandronum on Linux: Difference between revisions

Remove SQLite as a requirement (Zan now downloads it automatically)
(Add glew to Arch packages)
(Remove SQLite as a requirement (Zan now downloads it automatically))
Tag: Source edit
 
(21 intermediate revisions by 5 users not shown)
Line 9: 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 29: 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 38: 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 45: 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 59: 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 89: 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 99: Line 111:
<pre>
<pre>
cd ~/zandronum_build &&
cd ~/zandronum_build &&
hg clone https://bitbucket.org/Torr_Samaho/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 ==
Download FMOD 4.24.16 32-bit or 64-bit and extract files to zandronum directory:
 
Download FMOD 4.44.64 and extract files to zandronum directory:
<pre>
<pre>
a='' && [ "$(uname -m)" = x86_64 ] && a=64
cd ~/zandronum_build &&
cd ~/zandronum_build &&
wget -nc http://zandronum.com/essentials/fmod/fmodapi42416linux${a}.tar.gz &&
wget -nc https://zandronum.com/essentials/fmod/fmodapi44464linux.tar.gz &&
tar -xvzf fmodapi42416linux${a}.tar.gz -C zandronum
tar -xvzf fmodapi44464linux.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 119: 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 152: Line 165:
<pre>
<pre>
cd ~/zandronum_build/zandronum &&
cd ~/zandronum_build/zandronum &&
if [ "$(hg log -r 'max(tagged())' --template '{rev}\n')" -ge \
u="$(hg log -l1 -k 'changed the version string to' \
"$(hg log -l1 -k 'BUILD_ID_STR to release' --template '{rev}\n')" ]; then
--template '{node|short}\n')"; echo "$u ZA_$(hg log -r $u --template '{desc}\n' |
hg identify -r 'max(tagged())'; else u="$(hg log -l1 -k 'BUILD_ID_STR to release' \
sed -n 's/.*changed the version string to \(.*\)/\1/p')"
--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>


Line 162: Line 173:
<pre>
<pre>
cd ~/zandronum_build/zandronum &&
cd ~/zandronum_build/zandronum &&
if [ "$(hg log -r 'max(tagged())' --template '{rev}\n')" -ge \
hg update -c $(hg log -l1 -k 'changed the version string to' --template '{node}\n')
"$(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]].
Line 286: 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 292: 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 302: 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 "\
#!/bin/sh
#! /bin/sh
export LD_LIBRARY_PATH=/usr/games/zandronum$d
export LD_LIBRARY_PATH=/usr/games/zandronum$d
exec /usr/games/zandronum$d/zandronum \"\$@\"
exec /usr/games/zandronum$d/zandronum \"\$@\"
" > zandronum$d.sh &&
" > zandronum$d.sh &&
printf %s "\
printf %s "\
#!/bin/sh
#! /bin/sh
exec /usr/games/zandronum$d/zandronum-server \"\$@\"
exec /usr/games/zandronum$d/zandronum-server \"\$@\"
" > zandronum-server$d.sh &&
" > zandronum-server$d.sh &&