Compiling Zandronum on Linux

Revision as of 19:11, 9 May 2024 by DrinkyBird (talk | contribs) (Add link to evolve readme)

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)

Install the following as root/superuser:

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

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

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 sdl12-compat mercurial zlib bzip2 libjpeg-turbo \
fluidsynth gtk2 timidity++ nasm mesa glu openssl tar glew

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.

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-241030-1744), use:

hg update 0c2b243f9d02

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:

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-server 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.