Difference between revisions of "Compile ECWolf on Linux"
(Mercurial) |
|||
Line 6: | Line 6: | ||
* [http://cmake.org/ CMake] 2.6 | * [http://cmake.org/ CMake] 2.6 | ||
* [http://gcc.gnu.org/ GCC] 4.4.1 | * [http://gcc.gnu.org/ GCC] 4.4.1 | ||
+ | * [http://www.gnu.org/software/make/ make] | ||
* [http://www.libsdl.org/ libsdl] 1.2 | * [http://www.libsdl.org/ libsdl] 1.2 | ||
* [http://www.libsdl.org/projects/SDL_mixer/ SDL_mixer] 1.2.11 | * [http://www.libsdl.org/projects/SDL_mixer/ SDL_mixer] 1.2.11 | ||
Line 11: | Line 12: | ||
* [http://www.zlib.net/ zlib] 1.2.3 | * [http://www.zlib.net/ zlib] 1.2.3 | ||
* [http://bzip.org/ bzip2] 1.0.5 | * [http://bzip.org/ bzip2] 1.0.5 | ||
+ | * [http://www.ijg.org/ libjpeg] >= 6b | ||
+ | * [http://www.gtk.org/ GTK2] 2 | ||
[http://tortoisehg.bitbucket.org/ Mercurial] is also needed to checkout a copy of the latest source. | [http://tortoisehg.bitbucket.org/ Mercurial] is also needed to checkout a copy of the latest source. | ||
+ | |||
+ | Install the following dependencies as superuser: | ||
+ | |||
+ | === Debian & Ubuntu === | ||
+ | <pre> | ||
+ | sudo apt-get install cmake g++ libsdl1.2-dev libsdl-mixer1.2-dev \ | ||
+ | zlib1g-dev libbz2-dev mercurial make libjpeg-dev libgtk2.0-dev | ||
+ | </pre> | ||
+ | |||
+ | === Fedora === | ||
+ | <pre> | ||
+ | yum install cmake gcc-c++ SDL-devel SDL_mixer-devel zlib-devel \ | ||
+ | bzip2-devel mercurial make libjpeg-turbo-devel gtk2-devel | ||
+ | </pre> | ||
+ | |||
+ | === OpenSUSE === | ||
+ | <pre> | ||
+ | zypper install cmake gcc-c++ libSDL-devel libSDL_mixer-devel \ | ||
+ | zlib-devel libbz2-devel mercurial make libjpeg-devel gtk2-devel | ||
+ | </pre> | ||
+ | |||
+ | === Mageia === | ||
+ | <pre> | ||
+ | if [ "$(uname -m)" = "x86_64" ]; then | ||
+ | whatsurhw="64" | ||
+ | else | ||
+ | whatsurhw="" | ||
+ | fi && \ | ||
+ | urpmi cmake gcc-c++ lib"$whatsurhw"SDL-devel lib"$whatsurhw"SDL_mixer-devel \ | ||
+ | lib"$whatsurhw"zlib-devel lib"$whatsurhw"bzip2-devel mercurial make \ | ||
+ | lib"$whatsurhw"jpeg-devel lib"$whatsurhw"gtk+2.0-devel lib"$whatsurhw"cairo-devel | ||
+ | </pre> | ||
+ | |||
+ | === Arch Linux === | ||
+ | <pre> | ||
+ | pacman -S --needed cmake gcc sdl sdl_mixer zlib bzip2 mercurial make libjpeg-turbo gtk2 | ||
+ | </pre> | ||
+ | |||
+ | === Gentoo === | ||
+ | <pre> | ||
+ | emerge -avn dev-util/cmake sys-devel/gcc media-libs/libsdl media-libs/sdl-mixer \ | ||
+ | sys-libs/zlib app-arch/bzip2 dev-vcs/mercurial sys-devel/make media-libs/libjpeg-turbo \ | ||
+ | x11-libs/gtk+ | ||
+ | </pre> | ||
+ | |||
+ | === PCLinuxOS === | ||
+ | <pre> | ||
+ | if [ "$(uname -m)" = "x86_64" ]; then | ||
+ | whatsurhw="64" | ||
+ | else | ||
+ | whatsurhw="" | ||
+ | fi && \ | ||
+ | apt-get install cmake gcc-c++ lib"$whatsurhw"SDL-devel lib"$whatsurhw"SDL_mixer1.2-devel \ | ||
+ | zlib1-devel lib"$whatsurhw"bzip2-devel mercurial make lib"$whatsurhw"jpeg62-devel \ | ||
+ | lib"$whatsurhw"gtk+2.0_0-devel | ||
+ | </pre> | ||
+ | |||
+ | '''Do the following steps as normal user.''' | ||
+ | |||
+ | == Make ecwolf_build directory == | ||
+ | <pre> | ||
+ | mkdir -pv $HOME/ecwolf_build | ||
+ | </pre> | ||
== Retrieving the Source == | == Retrieving the Source == | ||
Use Mercurial to retrieve the latest version of the source. | Use Mercurial to retrieve the latest version of the source. | ||
+ | cd $HOME/ecwolf_build | ||
hg clone [https://bitbucket.org/Blzut3/ecwolf https://bitbucket.org/Blzut3/ecwolf] | hg clone [https://bitbucket.org/Blzut3/ecwolf https://bitbucket.org/Blzut3/ecwolf] | ||
Line 24: | Line 91: | ||
cd build | cd build | ||
Run CMake to generate a Makefile. Assuming there were no errors, you should be able to run make to compile. | Run CMake to generate a Makefile. Assuming there were no errors, you should be able to run make to compile. | ||
− | cmake .. | + | cmake -DGPL=ON .. |
make | make | ||
An ecwolf binary should be produced. | An ecwolf binary should be produced. | ||
./ecwolf | ./ecwolf | ||
+ | |||
+ | == Backup ECWolf == | ||
+ | |||
+ | Follow this step if you want or manually copy (backup) ecwolf and ecwolf.pk3. | ||
+ | |||
+ | Make and name a directory with the corresponding ECWolf version/revision and copy ecwolf and ecwolf.pk3 to it: | ||
+ | <pre> | ||
+ | cd $HOME/ecwolf_build && \ | ||
+ | BACKUPECWOLF="$(sed -n 's/.*#define DOTVERSIONSTR_NOREV "\(.*\)".*/\1/p' \ | ||
+ | $HOME/ecwolf_build/ecwolf/src/version.h)\ | ||
+ | -r$(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\1/p' \ | ||
+ | $HOME/ecwolf_build/ecwolf/src/svnrevision.h)" && \ | ||
+ | mkdir -pv "$BACKUPECWOLF" && \ | ||
+ | cp -v ecwolf/build/{ecwolf,ecwolf.pk3} "$BACKUPECWOLF" | ||
+ | </pre> | ||
+ | |||
+ | === Backup ECWolf (Optional) === | ||
+ | |||
+ | Make and name a directory with the current year, month, day, hour and minute and copy ecwolf and ecwolf.pk3 to it: | ||
+ | <pre> | ||
+ | cd $HOME/ecwolf_build && \ | ||
+ | BACKUPECW="$(date +%Y%m%d%H%M)" && \ | ||
+ | mkdir -pv "$BACKUPECW" && \ | ||
+ | cp -v ecwolf/build/{ecwolf,ecwolf.pk3} "$BACKUPECW" | ||
+ | </pre> | ||
+ | |||
+ | If you did "Backup ECWolf" or "(Optional)", the previous files should be located at: | ||
+ | : '''/home/<your username>/ecwolf_build/''' | ||
+ | |||
+ | == Update ECWolf == | ||
+ | |||
+ | When you wish to update ECWolf, copy and paste the following: | ||
+ | <pre> | ||
+ | cd $HOME/ecwolf_build/ecwolf/build && \ | ||
+ | make clean ; \ | ||
+ | cd .. && hg pull ; \ | ||
+ | hg update && \ | ||
+ | cd build && \ | ||
+ | cmake -DGPL=ON .. && \ | ||
+ | make | ||
+ | </pre> | ||
+ | |||
+ | When the update and compiling finish, go to [[#Backup ECWolf|Backup ECWolf]]. | ||
+ | |||
+ | == Install ECWolf == | ||
+ | |||
+ | '''The following steps contain commands that require to be run as superuser with the sudo command.''' | ||
+ | |||
+ | If you want to install ECWolf, do the following: | ||
+ | |||
+ | Make /usr/games/ecwolf directory: | ||
+ | <pre> | ||
+ | sudo mkdir -pv /usr/games/ecwolf | ||
+ | </pre> | ||
+ | |||
+ | Copy ecwolf and ecwolf.pk3 to /usr/games/ecwolf: | ||
+ | <pre> | ||
+ | sudo cp -v /home/$USER/ecwolf_build/ecwolf/build/{ecwolf,ecwolf.pk3} /usr/games/ecwolf | ||
+ | </pre> | ||
+ | |||
+ | Make ecwolf script, add executable permission and copy it to /usr/bin: | ||
+ | <pre> | ||
+ | cd /tmp && \ | ||
+ | touch ecwolf && \ | ||
+ | echo '#!/bin/bash' >> ecwolf && \ | ||
+ | echo '/usr/games/ecwolf/ecwolf $*' >> ecwolf && \ | ||
+ | echo 'exit $?' >> ecwolf && \ | ||
+ | chmod 755 ecwolf && \ | ||
+ | sudo cp -v ecwolf /usr/bin && \ | ||
+ | rm -fv ecwolf | ||
+ | </pre> | ||
+ | |||
+ | Now from a terminal you should be able to execute '''ecwolf''' from any user account. | ||
+ | |||
+ | === Remove ECWolf === | ||
+ | |||
+ | To remove the previous installation steps: | ||
+ | |||
+ | Remove /usr/games/ecwolf directory and all its files: | ||
+ | <pre> | ||
+ | cd /usr/games && \ | ||
+ | sudo rm -rfv ecwolf | ||
+ | </pre> | ||
+ | |||
+ | Remove ecwolf script: | ||
+ | <pre> | ||
+ | cd /usr/bin && \ | ||
+ | sudo rm -fv ecwolf | ||
+ | </pre> | ||
== Debugging == | == Debugging == |
Revision as of 22:10, 6 July 2013
This guide will demonstrate how to compile the Mercurial version of ECWolf on Linux.
Dependencies
The following programs/libraries are used by ECWolf. The versions listed below are known to work, however other versions may work.
In addition to the above, the following are optional dependencies.
Mercurial is also needed to checkout a copy of the latest source.
Install the following dependencies as superuser:
Debian & Ubuntu
sudo apt-get install cmake g++ libsdl1.2-dev libsdl-mixer1.2-dev \ zlib1g-dev libbz2-dev mercurial make libjpeg-dev libgtk2.0-dev
Fedora
yum install cmake gcc-c++ SDL-devel SDL_mixer-devel zlib-devel \ bzip2-devel mercurial make libjpeg-turbo-devel gtk2-devel
OpenSUSE
zypper install cmake gcc-c++ libSDL-devel libSDL_mixer-devel \ zlib-devel libbz2-devel mercurial make libjpeg-devel gtk2-devel
Mageia
if [ "$(uname -m)" = "x86_64" ]; then whatsurhw="64" else whatsurhw="" fi && \ urpmi cmake gcc-c++ lib"$whatsurhw"SDL-devel lib"$whatsurhw"SDL_mixer-devel \ lib"$whatsurhw"zlib-devel lib"$whatsurhw"bzip2-devel mercurial make \ lib"$whatsurhw"jpeg-devel lib"$whatsurhw"gtk+2.0-devel lib"$whatsurhw"cairo-devel
Arch Linux
pacman -S --needed cmake gcc sdl sdl_mixer zlib bzip2 mercurial make libjpeg-turbo gtk2
Gentoo
emerge -avn dev-util/cmake sys-devel/gcc media-libs/libsdl media-libs/sdl-mixer \ sys-libs/zlib app-arch/bzip2 dev-vcs/mercurial sys-devel/make media-libs/libjpeg-turbo \ x11-libs/gtk+
PCLinuxOS
if [ "$(uname -m)" = "x86_64" ]; then whatsurhw="64" else whatsurhw="" fi && \ apt-get install cmake gcc-c++ lib"$whatsurhw"SDL-devel lib"$whatsurhw"SDL_mixer1.2-devel \ zlib1-devel lib"$whatsurhw"bzip2-devel mercurial make lib"$whatsurhw"jpeg62-devel \ lib"$whatsurhw"gtk+2.0_0-devel
Do the following steps as normal user.
Make ecwolf_build directory
mkdir -pv $HOME/ecwolf_build
Retrieving the Source
Use Mercurial to retrieve the latest version of the source.
cd $HOME/ecwolf_build hg clone https://bitbucket.org/Blzut3/ecwolf
Compiling
It is recommended that you create a build directory in the newly created ecwolf directory.
cd ecwolf mkdir build cd build
Run CMake to generate a Makefile. Assuming there were no errors, you should be able to run make to compile.
cmake -DGPL=ON .. make
An ecwolf binary should be produced.
./ecwolf
Backup ECWolf
Follow this step if you want or manually copy (backup) ecwolf and ecwolf.pk3.
Make and name a directory with the corresponding ECWolf version/revision and copy ecwolf and ecwolf.pk3 to it:
cd $HOME/ecwolf_build && \ BACKUPECWOLF="$(sed -n 's/.*#define DOTVERSIONSTR_NOREV "\(.*\)".*/\1/p' \ $HOME/ecwolf_build/ecwolf/src/version.h)\ -r$(sed -n 's/.*#define SVN_REVISION_STRING "\(.*\)".*/\1/p' \ $HOME/ecwolf_build/ecwolf/src/svnrevision.h)" && \ mkdir -pv "$BACKUPECWOLF" && \ cp -v ecwolf/build/{ecwolf,ecwolf.pk3} "$BACKUPECWOLF"
Backup ECWolf (Optional)
Make and name a directory with the current year, month, day, hour and minute and copy ecwolf and ecwolf.pk3 to it:
cd $HOME/ecwolf_build && \ BACKUPECW="$(date +%Y%m%d%H%M)" && \ mkdir -pv "$BACKUPECW" && \ cp -v ecwolf/build/{ecwolf,ecwolf.pk3} "$BACKUPECW"
If you did "Backup ECWolf" or "(Optional)", the previous files should be located at:
- /home/<your username>/ecwolf_build/
Update ECWolf
When you wish to update ECWolf, copy and paste the following:
cd $HOME/ecwolf_build/ecwolf/build && \ make clean ; \ cd .. && hg pull ; \ hg update && \ cd build && \ cmake -DGPL=ON .. && \ make
When the update and compiling finish, go to Backup ECWolf.
Install ECWolf
The following steps contain commands that require to be run as superuser with the sudo command.
If you want to install ECWolf, do the following:
Make /usr/games/ecwolf directory:
sudo mkdir -pv /usr/games/ecwolf
Copy ecwolf and ecwolf.pk3 to /usr/games/ecwolf:
sudo cp -v /home/$USER/ecwolf_build/ecwolf/build/{ecwolf,ecwolf.pk3} /usr/games/ecwolf
Make ecwolf script, add executable permission and copy it to /usr/bin:
cd /tmp && \ touch ecwolf && \ echo '#!/bin/bash' >> ecwolf && \ echo '/usr/games/ecwolf/ecwolf $*' >> ecwolf && \ echo 'exit $?' >> ecwolf && \ chmod 755 ecwolf && \ sudo cp -v ecwolf /usr/bin && \ rm -fv ecwolf
Now from a terminal you should be able to execute ecwolf from any user account.
Remove ECWolf
To remove the previous installation steps:
Remove /usr/games/ecwolf directory and all its files:
cd /usr/games && \ sudo rm -rfv ecwolf
Remove ecwolf script:
cd /usr/bin && \ sudo rm -fv ecwolf
Debugging
In most cases it is good idea to generate a back trace when ECWolf crashes. To make a debug build of ecwolf simply replace the cmake command with the following.
cmake -DCMAKE_BUILD_TYPE=Debug make
You should now be able to use gdb to generate a back trace.
gdb ecwolf
GDB has it's own command prompt. Use "run" to start ecwolf and use "bt" to get the back trace after a crash.
(gdb) run (gdb) bt