Compiling Doomseeker on Linux: Difference between revisions
Compiling Doomseeker on Linux (view source)
Revision as of 18:30, 16 December 2017
, 16 December 2017no edit summary
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
'''Open a terminal and copy and paste the whole code box for each step.''' | '''Open a terminal and copy and paste the whole code box for each step.''' | ||
== | == Install dependencies == | ||
[http://doomseeker.drdteam.org/ 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''' | |||
** mercurial ''(needed in order to [https://bitbucket.org/Doomseeker/doomseeker download the source] and compile in commit meta data)'' | |||
* '''Optional''' | |||
** zlib ''(Doomseeker has a copy of it and will be statically compiled in if not found)'' | |||
** libbzip2 ''(possibly static)'' | |||
** [[#Build Options|libqt4 and/or libqtcore4/qtcore]] 4.8.2 | |||
* gcc | |||
* make | |||
* cmake | |||
* qt5-tools qt5-multimedia | |||
* [ | |||
* zlib ''( | |||
* libbzip2 ''( | |||
* | |||
Install the following as root/superuser: | Install the following as root/superuser: | ||
Line 35: | Line 20: | ||
=== Debian/Ubuntu === | === Debian/Ubuntu === | ||
<pre> | <pre> | ||
sudo apt-get install g++ cmake mercurial | sudo apt-get install g++ make cmake mercurial zlib1g-dev libbz2-dev \ | ||
qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt4-dev | qttools5-dev qttools5-dev-tools qtmultimedia5-dev libqt4-dev | ||
</pre> | </pre> | ||
Line 41: | Line 26: | ||
=== Fedora === | === Fedora === | ||
<pre> | <pre> | ||
dnf install gcc-c++ make cmake mercurial zlib-devel bzip2-devel \ | |||
qt5-qttools-devel qt5-qtmultimedia-devel qt-devel | qt5-qttools-devel qt5-qtmultimedia-devel qt-devel | ||
</pre> | </pre> | ||
Line 47: | Line 32: | ||
=== openSUSE === | === openSUSE === | ||
<pre> | <pre> | ||
zypper install gcc-c++ cmake mercurial | zypper install gcc-c++ make cmake mercurial zlib-devel libbz2-devel \ | ||
libqt5-qttools-devel libqt5-qtmultimedia-devel libqt4-devel | libqt5-qttools-devel libqt5-qtmultimedia-devel libqt4-devel | ||
</pre> | </pre> | ||
Line 54: | Line 39: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | a='' && [ "$(uname -m)" = x86_64 ] && a=64 | ||
urpmi gcc-c++ cmake mercurial | urpmi gcc-c++ make cmake mercurial lib${a}zlib-devel \ | ||
lib | lib${a}bzip2-devel lib${a}qt5base5-devel qttools5 lib${a}qt5help-devel \ | ||
lib | lib${a}qt5multimedia-devel lib${a}qt4-devel lib${a}qtcore4 | ||
</pre> | </pre> | ||
=== Arch Linux === | === Arch Linux === | ||
<pre> | <pre> | ||
pacman -S --needed gcc cmake mercurial | pacman -S --needed gcc make cmake mercurial zlib bzip2 qt5-tools qt5-base qt5-multimedia qt4 | ||
</pre> | </pre> | ||
=== Gentoo === | === Gentoo === | ||
<pre> | <pre> | ||
emerge -avn sys-devel/gcc dev-util/cmake dev-vcs/mercurial | emerge -avn sys-devel/gcc sys-devel/make dev-util/cmake dev-vcs/mercurial \ | ||
dev-qt/linguist dev-qt/linguist-tools dev-qt/qtmultimedia dev-qt/qtcore | sys-libs/zlib app-arch/bzip2 dev-qt/linguist dev-qt/linguist-tools \ | ||
dev-qt/qtmultimedia dev-qt/qtcore | |||
</pre> | </pre> | ||
Line 73: | Line 59: | ||
<pre> | <pre> | ||
a='' && [ "$(uname -m)" = x86_64 ] && a=64 | a='' && [ "$(uname -m)" = x86_64 ] && a=64 | ||
apt-get install gcc-c++ cmake mercurial | apt-get install gcc-c++ make cmake mercurial zlib1-devel \ | ||
lib | lib${a}bzip2-devel lib${a}qt5base5-devel qttools5 lib${a}qt5help-devel \ | ||
lib | lib${a}qt5multimedia-devel lib${a}qt4-devel | ||
</pre> | |||
=== Solus === | |||
<pre> | |||
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 | |||
</pre> | </pre> | ||
'''Do the following | '''Do the following sections as normal user.''' | ||
== | == Create doomseeker_build directory == | ||
<pre> | <pre> | ||
mkdir -pv | mkdir -pv ~/doomseeker_build | ||
</pre> | </pre> | ||
== Download the | == Download and prepare the source == | ||
Download the Doomseeker source and | Download the Doomseeker source and create an out of tree build directory: | ||
<pre> | <pre> | ||
cd | cd ~/doomseeker_build && | ||
hg clone https://bitbucket.org/Doomseeker/doomseeker && | hg clone https://bitbucket.org/Doomseeker/doomseeker && | ||
mkdir -pv doomseeker/build | mkdir -pv doomseeker/build | ||
</pre> | </pre> | ||
== Compiling == | == Compiling == | ||
To compile | To compile Doomseeker: | ||
<pre> | <pre> | ||
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 | make -j$c | ||
</pre> | </pre> | ||
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: | Assuming all goes well, a doomseeker binary should be produced. To start Doomseeker, the following command should work: | ||
<pre> | <pre> | ||
Line 106: | Line 101: | ||
</pre> | </pre> | ||
=== | === Latest stable version === | ||
Show the | Show the latest stable version: | ||
<pre> | <pre> | ||
cd | cd ~/doomseeker_build/doomseeker && | ||
hg identify -r 'max(tagged())' | hg identify -r 'max(tagged())' | ||
</pre> | </pre> | ||
If you want to compile the | If you want to compile the latest stable version, run: | ||
<pre> | <pre> | ||
cd | cd ~/doomseeker_build/doomseeker && | ||
hg update -cr 'max(tagged())' | hg update -cr 'max(tagged())' | ||
</pre> | </pre> | ||
and [[#Compiling|compile]]. | and [[#Compiling|compile]]. | ||
After compiling and [[#Backup|backing up]] the | After compiling and [[#Backup|backing up]] the latest stable version, run: | ||
<pre> | <pre> | ||
cd | cd ~/doomseeker_build/doomseeker && | ||
hg update default | hg update default | ||
</pre> | </pre> | ||
== Backup == | == 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: | |||
<pre> | <pre> | ||
cd | cd ~/doomseeker_build/doomseeker/build && | ||
if [ -f CMakeCache.txt ]; then | |||
$(sed -n 's/.* | k="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' CMakeCache.txt)"; else k=''; fi && | ||
$(sed -n 's/.*#define | if [ -n "$k" ]; then b="-BuildType$k"; else b=''; fi && | ||
h="$(sed -n 's/.*#define HG_REVISION_HASH_STRING "\(.*\)".*/\1/p' ../src/core/svnrevision.h)" && | |||
cp -rv doomseeker | if [ -n "$(hg cat -r $h ../src/core/versiondefs.h 2>/dev/null)" ]; then r=h; else r=cmake; fi && | ||
"$BACKUPDOOMSEEKER" | BACKUPDOOMSEEKER="../../$(hg cat -r $h ../src/core/versiondefs.$r | sed -n 's/.*VERSION_STRING "\(.*\)".*/\1/p')\ | ||
$(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\-\1/p' ../src/core/svnrevision.h)-$h$b" && | |||
mkdir -pv "$BACKUPDOOMSEEKER" && | |||
cp -rv doomseeker libwadseeker.so engines \ | |||
"$BACKUPDOOMSEEKER"/ | |||
</pre> | </pre> | ||
Files are located at: | |||
/home/<your username>/doomseeker_build/<your newly created directory> | |||
== Updating == | == Updating == | ||
When you wish to update Doomseeker, copy and paste the following: | When you wish to update Doomseeker, copy and paste the following: | ||
<pre> | <pre> | ||
cd | cd ~/doomseeker_build/doomseeker && | ||
hg pull ; hg update | hg pull ; hg update | ||
</pre> | </pre> | ||
Line 163: | Line 153: | ||
== Installation == | == Installation == | ||
Commands beginning with "sudo" will require temporary superuser privileges. | |||
If you want to install Doomseeker, do the following: | If you want to install Doomseeker, do the following: | ||
Create /usr/games/doomseeker directory: | |||
<pre> | <pre> | ||
sudo mkdir -pv /usr/games/doomseeker | sudo mkdir -pv /usr/games/doomseeker | ||
</pre> | </pre> | ||
Copy doomseeker, libwadseeker.so and the engines directory to /usr/games/doomseeker: | Copy doomseeker, libwadseeker.so and the engines directory to /usr/games/doomseeker/: | ||
<pre> | <pre> | ||
cd ~/doomseeker_build/doomseeker/build && | |||
libwadseeker.so | sudo cp -rv doomseeker libwadseeker.so engines \ | ||
/usr/games/doomseeker/ | |||
</pre> | </pre> | ||
Create launch script: | |||
<pre> | <pre> | ||
cd / | cd ~/doomseeker_build/doomseeker/build && | ||
printf %s "\ | |||
#!/bin/sh | |||
export LD_LIBRARY_PATH=/usr/games/doomseeker | |||
exec /usr/games/doomseeker/doomseeker \"\$@\" | |||
chmod 755 doomseeker && | " > doomseeker.sh && | ||
sudo mv -v doomseeker /usr/bin | chmod 755 doomseeker.sh && | ||
sudo mv -v doomseeker.sh /usr/bin/doomseeker | |||
</pre> | </pre> | ||
Now from a terminal you should be able to | Now from a terminal you should be able to run '''doomseeker''' from any user account. | ||
=== Uninstallation === | === Uninstallation === | ||
Remove /usr/games/doomseeker directory and all its files: | Remove /usr/games/doomseeker directory and all its files: | ||
<pre> | <pre> | ||
Line 204: | Line 194: | ||
</pre> | </pre> | ||
== Debugging == | == 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:''' | '''Prerequisite:''' | ||
* [http://www.gnu.org/software/gdb/ gdb] | * [http://www.gnu.org/software/gdb/ gdb] | ||
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: | |||
<pre> | <pre> | ||
cd ~/doomseeker_build/doomseeker/build | |||
cmake .. -DCMAKE_BUILD_TYPE=Debug | |||
</pre> | </pre> | ||
Optionally, you may want to use some of the [[#Build options]]. | |||
After CMake is done, run <code>make</code> or to speed up compilation, run <code>make -j<number></code>, a recommended value for the <code>-j</code> option is the number of physical cores: | |||
<pre> | <pre> | ||
make | make | ||
</pre> | </pre> | ||
To run Doomseeker under a debugger such as gdb, use the following command: | |||
<pre> | <pre> | ||
gdb doomseeker | gdb doomseeker | ||
</pre> | </pre> | ||
Now gdb should have you in its own command prompt | Now gdb should have you in its own command prompt: | ||
<pre> | |||
(gdb) | |||
</pre> | |||
You probably want to log the output, so lets output to a file doomseekerdebug.log: | |||
<pre> | <pre> | ||
(gdb) set logging on doomseekerdebug.log | (gdb) set logging on doomseekerdebug.log | ||
</pre> | </pre> | ||
Now start Doomseeker by typing in run, and pressing enter: | |||
<pre> | <pre> | ||
(gdb) run | (gdb) run | ||
</pre> | </pre> | ||
Or put any command line parameters to doomseeker after run: | |||
<pre> | <pre> | ||
(gdb) run <command line parameters> | (gdb) run <command line parameters> | ||
</pre> | </pre> | ||
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: | |||
<pre> | <pre> | ||
(gdb) | (gdb) backtrace | ||
</pre> | </pre> | ||
All output will be copied into the doomseekerdebug.log, which can then be scrutinized later, or perhaps posted to the [http://zandronum.com/tracker/ Bug Tracker] for other developers to look at. | All output will be copied into the doomseekerdebug.log, which can then be scrutinized later, or perhaps posted to the [http://zandronum.com/tracker/ Bug Tracker] for other developers to look at. | ||
To exit gdb's command prompt, | To exit gdb's command prompt, type quit, q or press Ctrl-D: | ||
<pre> | <pre> | ||
(gdb) quit | (gdb) quit | ||
</pre> | </pre> | ||
If you want to free up space, run <code>make clean</code> to remove the files generated by the compilation. | |||
== Build | === Build options === | ||
{|class="wikitable" width="72%" | {|class="wikitable" width="72%" | ||
|+ <span style="text-decoration: underline">CMake | |+ <span style="text-decoration: underline">CMake options</span> | ||
|- | |- | ||
!width="10%"|Options!!width="25%"|Description!!width="65%"|Example | !width="10%"|Options!!width="25%"|Description!!width="65%"|Example | ||
|- | |- | ||
|FORCE_QT4=ON||Force Qt4.||cmake -DCMAKE_BUILD_TYPE=Release -DFORCE_QT4=ON | |FORCE_QT4=ON||Force Qt4.||cmake .. -DCMAKE_BUILD_TYPE=Release -DFORCE_QT4=ON | ||
|} | |} | ||
{|class="wikitable" width="72%" | {|class="wikitable" width="72%" | ||
|+ <span style="text-decoration: underline">CMake | |+ <span style="text-decoration: underline">CMake build types</span> | ||
|- | |- | ||
!width="10%"|Types!!width="45%"|Description!!width="45%"|Example | !width="10%"|Types!!width="45%"|Description!!width="45%"|Example | ||
|- | |- | ||
|Debug||Debug information, -O1 optimization.||cmake -DCMAKE_BUILD_TYPE=Debug | |Debug||Debug information, -O1 optimization.||cmake .. -DCMAKE_BUILD_TYPE=Debug | ||
|- | |- | ||
|Release||No debug information, -O3 optimization.||cmake -DCMAKE_BUILD_TYPE=Release | |Release||No debug information, -O3 optimization.||cmake .. -DCMAKE_BUILD_TYPE=Release | ||
|- | |- | ||
|RelWithDebInfo||Debug information, - | |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 | |MinSizeRel||Similar to Release but with less optimizations in order to save space.||cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel | ||
|} | |} | ||
[[Category:Developers Articles]] | [[Category:Developers Articles]] |