Compiling Doomseeker on Linux: Difference between revisions

From Zandronum Wiki
No edit summary
Line 53: Line 53:
=== Mageia ===
=== Mageia ===
<pre>
<pre>
if [ "$(uname -m)" = "x86_64" ]; then
a='' && [ "$(uname -m)" = x86_64 ] && a=64
a="64"
else
a=""
fi && \
urpmi gcc-c++ cmake mercurial make lib"$a"zlib-devel lib"$a"bzip2-devel \
urpmi gcc-c++ cmake mercurial make lib"$a"zlib-devel lib"$a"bzip2-devel \
lib"$a"qt5base5-devel qttools5 lib"$a"qt5help-devel lib"$a"qt5multimedia-devel \
lib"$a"qt5base5-devel qttools5 lib"$a"qt5help-devel lib"$a"qt5multimedia-devel \
Line 76: Line 72:
=== PCLinuxOS ===
=== PCLinuxOS ===
<pre>
<pre>
if [ "$(uname -m)" = "x86_64" ]; then
a='' && [ "$(uname -m)" = x86_64 ] && a=64
a="64"
else
a=""
fi && \
apt-get install gcc-c++ cmake mercurial make zlib1-devel lib"$a"bzip2-devel \
apt-get install gcc-c++ cmake mercurial make zlib1-devel lib"$a"bzip2-devel \
lib"$a"qt5base5-devel qttools5 lib"$a"qt5help-devel lib"$a"qt5multimedia-devel \
lib"$a"qt5base5-devel qttools5 lib"$a"qt5help-devel lib"$a"qt5multimedia-devel \
Line 204: Line 196:
Remove /usr/games/doomseeker directory and all its files:
Remove /usr/games/doomseeker directory and all its files:
<pre>
<pre>
cd /usr/games && \
sudo rm -rfv /usr/games/doomseeker
sudo rm -rfv doomseeker
</pre>
</pre>


Remove doomseeker script:
Remove doomseeker script:
<pre>
<pre>
cd /usr/bin && \
sudo rm -fv /usr/bin/doomseeker
sudo rm -fv doomseeker
</pre>
</pre>



Revision as of 23:19, 28 November 2016

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

Notes

If you received the error:

pulling from https://bitbucket.org/Blzut3/doomseeker

abort: HTTP Error 503: Repository Unavailable

edit "$HOME"/doomseeker_build/doomseeker/.hg/hgrc file and change the default path:

[paths]
default = https://bitbucket.org/Blzut3/doomseeker

to:

[paths]
default = https://bitbucket.org/Doomseeker/doomseeker

Prerequisites

Doomseeker requires some tools and development files in order to compile:

  • gcc - C and C++ compilers
  • make
  • cmake
  • qt5-tools qt5-multimedia
  • libqt4 and/or libqtcore4/qtcore (optional)
  • zlib (optional - possibly static)
  • libbzip2 (optional - possibly static)
  • mercurial (needed in order to download the source)

Install the following as root/superuser:

Debian/Ubuntu

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

Fedora

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

openSUSE

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

Mageia

a='' && [ "$(uname -m)" = x86_64 ] && a=64
urpmi gcc-c++ cmake mercurial make 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 cmake mercurial make zlib bzip2 qt5-tools qt5-base qt5-multimedia qt4

Gentoo

emerge -avn sys-devel/gcc dev-util/cmake dev-vcs/mercurial sys-devel/make 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++ cmake mercurial make zlib1-devel lib"$a"bzip2-devel \
lib"$a"qt5base5-devel qttools5 lib"$a"qt5help-devel lib"$a"qt5multimedia-devel \
lib"$a"qt4-devel

Do the following steps as normal user.

Make doomseeker_build directory

mkdir -pv "$HOME"/doomseeker_build

Download the Source

Download the Doomseeker source and make build directory:

cd "$HOME"/doomseeker_build && \
hg clone https://bitbucket.org/Doomseeker/doomseeker && \
mkdir -pv doomseeker/build

Compiling

To compile the development version:

cd "$HOME"/doomseeker_build/doomseeker/build && \
make clean ; rm -f engines/*.so ; \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make

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

./doomseeker

Current release version

Show the current release version:

cd "$HOME"/doomseeker_build/doomseeker && \
hg identify -r 'max(tagged())'

If you want to compile the current release version, run the following:

cd "$HOME"/doomseeker_build/doomseeker && \
hg update -cr 'max(tagged())'

and compile.

After compiling and backing up the current release version, run the following:

cd "$HOME"/doomseeker_build/doomseeker && \
hg update default

Backup

Follow this step if you want or manually copy (backup) doomseeker, libwadseeker.so and the engines directory.

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

cd "$HOME"/doomseeker_build/doomseeker/src/core && \
BACKUPDOOMSEEKER="$(sed -n 's/.*#define VERSION_STRING "\(.*\)".*/\1/p' versiondefs.h)\
$(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\-\1/p' svnrevision.h)\
$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\-\1/p' svnrevision.h)" && \
cd ../../.. && mkdir -pv "$BACKUPDOOMSEEKER" && \
cp -rv doomseeker/build/{doomseeker,libwadseeker.so,engines} \
"$BACKUPDOOMSEEKER"

Backup (Optional)

Make and name a directory with the current year, month, day, hour and minute and copy doomseeker, libwadseeker.so and the engines directory to it:

cd "$HOME"/doomseeker_build && \
COPYANDPASTEDS="$(date +'%Y%m%d-%H%M')" && \
mkdir -pv "$COPYANDPASTEDS" && \
cp -rv doomseeker/build/{doomseeker,libwadseeker.so,engines} \
"$COPYANDPASTEDS"

If you did "Backup" or "Backup (Optional)", the previous files should be located at:

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

Updating

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

cd "$HOME"/doomseeker_build/doomseeker && \
hg pull ; hg update

When the update finish, go to #Compiling.

Installation

The following steps have commands that require to be run as superuser with the sudo command.

If you want to install Doomseeker, do the following:

Make /usr/games/doomseeker directory:

sudo mkdir -pv /usr/games/doomseeker

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

sudo cp -rv /home/"$USER"/doomseeker_build/doomseeker/build/{doomseeker,\
libwadseeker.so,engines} /usr/games/doomseeker

Make doomseeker script, add executable permission and move it to /usr/bin:

cd /tmp && \
echo '#!/bin/sh' > doomseeker && \
echo >> doomseeker && \
echo 'export LD_LIBRARY_PATH=/usr/games/doomseeker' >> doomseeker && \
echo 'exec /usr/games/doomseeker/doomseeker "$@"' >> doomseeker && \
chmod 755 doomseeker && \
sudo mv -v doomseeker /usr/bin

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

Uninstallation

To remove the previous installation steps:

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

sudo rm -rfv /usr/games/doomseeker

Remove doomseeker script:

sudo rm -fv /usr/bin/doomseeker

Debugging

Prerequisite:

In most cases it is good idea to generate a backtrace when Doomseeker crashes.

Make debug directory:

mkdir -pv "$HOME"/doomseeker_build/doomseeker/debug

Make a debug build of Doomseeker:

cd "$HOME"/doomseeker_build/doomseeker/debug && \
make clean ; rm -f engines/*.so ; \
cmake -DCMAKE_BUILD_TYPE=Debug .. && \
make

You should now be able to use gdb to generate a backtrace:

gdb doomseeker

Now gdb should have you in its own command prompt. You probably want to log the output, so lets output to a file doomseekerdebug.log:

(gdb) set logging on doomseekerdebug.log

Use "run" to start doomseeker:

(gdb) run

To start and pass command line parameters to doomseeker:

(gdb) run <command line parameters>

Use "bt" to get the backtrace after a crash:

(gdb) bt

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, use "quit", "q" or Ctrl-D:

(gdb) quit

Build Options

CMake Build 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, -O3 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 ..