Compiling Zandronum on Linux: Difference between revisions

From Zandronum Wiki
(Greatly simplified version of the build guide)
Tag: Source edit
 
m (DrinkyBird moved page User:DrinkyBird/Linux build guide to Compiling Zandronum on Linux: Replace with reworked page)
 
(6 intermediate revisions by 2 users not shown)
Line 25: Line 25:
** kdialog ''(optional - for KDE users)''
** kdialog ''(optional - for KDE users)''
** fluidsynth or timidity ''(optional - for [http://zdoom.org/wiki/MIDI MIDI] playback)''
** fluidsynth or timidity ''(optional - for [http://zdoom.org/wiki/MIDI MIDI] playback)''
Install the following as root/superuser:


=== Debian/Ubuntu ===
=== Debian/Ubuntu ===
Line 39: Line 37:
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 glew glew-devel tar
mesa-libGL-devel openssl-devel glew glew-devel tar opus
</pre>
</pre>


Line 46: Line 44:
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 glew glew-devel
Mesa-libGL-devel libopenssl-devel tar glew glew-devel libopus-devel
</pre>
 
=== Mageia ===
<pre>
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
</pre>
</pre>


Line 61: Line 50:
<pre>
<pre>
pacman -S --needed gcc make cmake sdl12-compat 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 opus
</pre>
 
=== Gentoo ===
<pre>
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
</pre>
</pre>
=== PCLinuxOS ===
<pre>
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
</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>
'''Do the following sections as normal user.'''


== Enable Mercurial extensions ==
== 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.
'''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. Alternatively, it is possible to install evolve from the Python Package Index, see [https://foss.heptapod.net/mercurial/evolve/-/blob/branch/default/README.rst the evolve readme] for more information.


Add the following to the <tt>extensions</tt> section of <tt>~/.hgrc</tt>:
Add the following to the <tt>extensions</tt> section of <tt>~/.hgrc</tt>:
Line 148: Line 110:
  cd buildclient
  cd buildclient


Then, use CMake to generate the Makefiles:
Then, use CMake to generate the Makefiles.
 
Replace <code>/path/to/fmodapi44464linux</code> in the commands below with where you extracted FMOD.


  cmake \
  cmake \
Line 161: Line 125:
  make -j`nproc`
  make -j`nproc`


A <code>zandronum-server</code> binary will be output to the build directory.
A <code>zandronum</code> binary will be output to the build directory.


== Build server-only ==
== Build server-only ==

Latest revision as of 11:43, 25 October 2024

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.44.64
    • libopenssl (for Zandronum 1.3 or later)
    • libopus (for Zandronum 3.2 or later)
  • Recommended
    • GTK2
    • mercurial (needed in order to download the source and compile in commit meta data)
      • mercurial-evolve (optional, includes the topic and evolve 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 MIDI playback)

Debian/Ubuntu

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 \
libgl1-mesa-dev libssl-dev tar libglew-dev libopus-dev

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 glew glew-devel tar opus

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 glew glew-devel libopus-devel

Arch Linux

pacman -S --needed gcc make cmake sdl12-compat mercurial zlib bzip2 libjpeg-turbo \
fluidsynth gtk2 timidity++ nasm mesa glu openssl tar glew opus

Enable Mercurial extensions

This section is optional, and is required only if you intend to build a specific topic. Doing so requires the topic and evolve extensions to be enabled. Some distros may package these separately from the base Mercurial package, so check your package manager. Alternatively, it is possible to install evolve from the Python Package Index, see the evolve readme for more information.

Add the following to the extensions section of ~/.hgrc:

[extensions]
topic = 
evolve =

Clone source repository

Clone the Zandronum source repository, and change your working directory to it:

hg clone https://foss.heptapod.net/zandronum/zandronum-stable
cd zandronum-stable

Check out desired version

Stable release

Tags are available for stable releases of Zandronum. See Version history for all releases and their tags. For example, to check out the latest stable release (3.1), use:

hg update ZA_3.1

Latest beta release

Currently, no tags are available for beta releases. To check out a beta, you must find its changeset hash. A table of betas and their hashes is available on the relevant article for that version - for the current beta release, see here.

For example, to check out the latest beta release (3.2-alpha-241027-2139), use:

hg update 4e8342339656

Build client

Download FMOD

Download FMOD 4.44.64 and extract the files:

wget https://zandronum.com/essentials/fmod/fmodapi44464linux.tar.gz
tar xf fmodapi44464linux.tar.gz

Make a note of where you extracted FMOD.

Compile

In the directory where you cloned Zandronum, create and move into a directory for the build files:

mkdir buildclient
cd buildclient

Then, use CMake to generate the Makefiles.

Replace /path/to/fmodapi44464linux in the commands below with where you extracted FMOD.

cmake \
 -DFMOD_LIBRARY=/path/to/fmodapi44464linux/api/lib/libfmodex64-4.44.64.so \
 -DFMOD_INCLUDE_DIR=/path/to/fmodapi44464linux/api/inc \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
 ..

Then build:

make -j`nproc`

A zandronum binary will be output to the build directory.

Build server-only

Note that the client build is also a server build when using the -host command-line parameter. If you built a client above, then building server-only is unneccesary.

Return to the directory which Zandronum was cloned to, and create and move into another directory for building:

mkdir buildserver
cd buildserver

Then, use CMake to generate the Makefiles:

cmake \
 -DSERVERONLY=ON \
 -DCMAKE_BUILD_TYPE=Release \
 ..

Then build:

make -j`nproc`

A zandronum-server binary will be output to the build directory.