Compiling Doomseeker on Linux

From Zandronum Wiki

Open a terminal and copy and paste the whole code box for each step.

Install dependencies

Doomseeker needs certain tools and development files in order to compile:

  • Required
    • gcc 4.4 or later
    • make
    • cmake 2.8.12 or later
    • qt5-tools
    • qt5-multimedia
  • Recommended
  • Optional

Install the following as root/superuser:

Debian/Ubuntu

sudo apt-get install g++ make cmake mercurial zlib1g-dev libbz2-dev \
qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt4-dev

Fedora

dnf install gcc-c++ make cmake mercurial zlib-devel bzip2-devel \
qt5-qttools-devel qt5-qtmultimedia-devel qt-devel

openSUSE

zypper install gcc-c++ make cmake mercurial zlib-devel libbz2-devel \
libqt5-qttools-devel libqt5-qtmultimedia-devel libqt4-devel

Mageia

a='' && [ "$(uname -m)" = x86_64 ] && a=64
urpmi gcc-c++ make cmake mercurial lib${a}zlib-devel \
lib${a}bzip2-devel lib${a}qt5base5-devel qttools5 lib${a}qt5help-devel \
lib${a}qt5multimedia-devel lib${a}qt4-devel lib${a}qtcore4

Arch Linux

pacman -S --needed gcc make cmake mercurial zlib bzip2 qt5-tools qt5-base qt5-multimedia qt4

Gentoo

emerge -avn sys-devel/gcc sys-devel/make dev-util/cmake dev-vcs/mercurial \
sys-libs/zlib app-arch/bzip2 dev-qt/linguist dev-qt/linguist-tools \
dev-qt/qtmultimedia dev-qt/qtcore

PCLinuxOS

a='' && [ "$(uname -m)" = x86_64 ] && a=64
apt-get install gcc-c++ make cmake mercurial zlib1-devel \
lib${a}bzip2-devel lib${a}qt5base5-devel qttools5 lib${a}qt5help-devel \
lib${a}qt5multimedia-devel lib${a}qt4-devel

Solus

sudo eopkg install g++ make cmake binutils glibc-devel pkg-config \
mercurial zlib-devel bzip2-devel qt5-tools-devel qt5-base-devel \
qt5-multimedia-devel qt4-devel

Do the following sections as normal user.

Create doomseeker_build directory

mkdir -pv ~/doomseeker_build

Download and prepare the source

Download the Doomseeker source and create an out of tree build directory:

cd ~/doomseeker_build &&
hg clone https://bitbucket.org/Doomseeker/doomseeker &&
mkdir -pv doomseeker/build

Compiling

To compile Doomseeker:

c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1
cd ~/doomseeker_build/doomseeker/build &&
cmake .. -DCMAKE_BUILD_TYPE=Release &&
make -j$c

A development version of Doomseeker will be compiled if you do not do #Latest stable version.

Assuming all goes well, a doomseeker binary should be produced. To start Doomseeker, the following command should work:

./doomseeker

Latest stable version

Show the latest stable version:

cd ~/doomseeker_build/doomseeker &&
hg identify -r 'max(tagged())'

If you want to compile the latest stable version, run:

cd ~/doomseeker_build/doomseeker &&
hg update -cr 'max(tagged())'

and compile.

After compiling and backing up the latest stable version, run:

cd ~/doomseeker_build/doomseeker &&
hg update default

Backup

If you want to backup Doomseeker, do the following:

Create and name a directory with the corresponding Doomseeker version/revision, build type and copy doomseeker, libwadseeker.so* and the engines directory to it:

cd ~/doomseeker_build/doomseeker/build &&
if [ -f CMakeCache.txt ]; then
k="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' CMakeCache.txt)"; else k=''; fi &&
if [ -n "$k" ]; then b="-BuildType$k"; else b=''; fi &&
r=../src/core/svnrevision.h && if [ -f "$r" ] && [ "$(hg status $r)" != "? $r" ]; then r=$r; else
r=../src/core/gitinfo.h; fi && h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' $r)" &&
if [ -n "$(hg cat -r $h ../src/core/versiondefs.h 2>/dev/null)" ]; then s=h; else s=cmake; fi &&
BACKUPDOOMSEEKER="../../$(hg cat -r $h ../src/core/versiondefs.$s | sed -n 's/.*VERSION_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 "$BACKUPDOOMSEEKER" &&
cp -rv doomseeker libwadseeker.so* engines \
"$BACKUPDOOMSEEKER"/

Files are located at:

/home/<your username>/doomseeker_build/<your newly created directory>

Updating

When you wish to update Doomseeker, copy and paste the following:

cd ~/doomseeker_build/doomseeker &&
hg pull ; hg update

When the update finish, go to #Compiling.

Installation

Commands beginning with "sudo" will require temporary superuser privileges.

If you want to install Doomseeker, do the following:

Create /usr/games/doomseeker directory:

sudo mkdir -pv /usr/games/doomseeker

Copy doomseeker, libwadseeker.so* and the engines directory to /usr/games/doomseeker/:

cd ~/doomseeker_build/doomseeker/build &&
sudo cp -rv doomseeker libwadseeker.so* engines \
/usr/games/doomseeker/

Create launch script:

cd ~/doomseeker_build/doomseeker/build &&
printf %s "\
#!/bin/sh
export LD_LIBRARY_PATH=/usr/games/doomseeker
exec /usr/games/doomseeker/doomseeker \"\$@\"
" > doomseeker.sh &&
chmod 755 doomseeker.sh &&
sudo mv -v doomseeker.sh /usr/bin/doomseeker

Now from a terminal you should be able to run doomseeker from any user account.

Uninstallation

Remove /usr/games/doomseeker directory and all its files:

sudo rm -rfv /usr/games/doomseeker

Remove doomseeker script:

sudo rm -fv /usr/bin/doomseeker

Developing

This page has helped you compile Doomseeker, 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

Prerequisite:

Maybe you have found a way to make Doomseeker crash, and are interested in debugging it. First, you need to compile a debug build of Doomseeker. Inside the build directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug:

cd ~/doomseeker_build/doomseeker/build
cmake .. -DCMAKE_BUILD_TYPE=Debug

Optionally, you may want to use some of the #Build options.

After CMake is done, run make or to speed up compilation, run make -j<number>, a recommended value for the -j option is the number of physical cores:

make

To run Doomseeker under a debugger such as gdb, use the following command:

gdb doomseeker

Now gdb should have you in its own command prompt:

(gdb)

You probably want to log the output, so lets output to a file doomseekerdebug.log:

(gdb) set logging on doomseekerdebug.log

Now start Doomseeker by typing in run, and pressing enter:

(gdb) run

Or put any command line parameters to doomseeker after run:

(gdb) run <command line parameters>

To see the available command line parameters for Doomseeker, type run --help and press enter.

If Doomseeker 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:

(gdb) backtrace

All output will be copied into the doomseekerdebug.log, which can then be scrutinized later, or perhaps posted to the Bug Tracker for other developers to look at.

To exit gdb's command prompt, type quit, q or press Ctrl-D:

(gdb) quit

If you want to free up space, run make clean to remove the files generated by the compilation.

Build options

CMake options
Options Description Example
FORCE_QT4=ON Force Qt4. cmake .. -DCMAKE_BUILD_TYPE=Release -DFORCE_QT4=ON
CMake build types
Types Description Example
Debug Debug information, -O1 optimization. cmake .. -DCMAKE_BUILD_TYPE=Debug
Release No debug information, -O3 optimization. cmake .. -DCMAKE_BUILD_TYPE=Release
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