Difference between revisions of "Compile ECWolf on Linux"

From ECWolf Wiki
Line 40: Line 40:
 
<pre>
 
<pre>
 
if [ "$(uname -m)" = "x86_64" ]; then  
 
if [ "$(uname -m)" = "x86_64" ]; then  
whatsurhw="64"  
+
a="64"  
 
else
 
else
whatsurhw=""
+
a=""
 
fi && \
 
fi && \
urpmi cmake gcc-c++ lib"$whatsurhw"SDL-devel lib"$whatsurhw"SDL_mixer-devel \
+
urpmi cmake gcc-c++ lib"$a"SDL-devel lib"$a"SDL_mixer-devel \
lib"$whatsurhw"zlib-devel lib"$whatsurhw"bzip2-devel mercurial make \
+
lib"$a"zlib-devel lib"$a"bzip2-devel mercurial make \
lib"$whatsurhw"jpeg-devel lib"$whatsurhw"gtk+2.0-devel lib"$whatsurhw"cairo-devel
+
lib"$a"jpeg-devel lib"$a"gtk+2.0-devel lib"$a"cairo-devel
 
</pre>
 
</pre>
  

Revision as of 14:28, 16 October 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 
a="64" 
else
a=""
fi && \
urpmi cmake gcc-c++ lib"$a"SDL-devel lib"$a"SDL_mixer-devel \
lib"$a"zlib-devel lib"$a"bzip2-devel mercurial make \
lib"$a"jpeg-devel lib"$a"gtk+2.0-devel lib"$a"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 -DCMAKE_BUILD_TYPE=Release -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

To exit GDB's command prompt, use "quit", "q" or Ctrl-D.

(gdb) quit

Build Options

CMake Build Options
Options Description Example
GPL=ON Switch ECWolf's default original non-commercial license to GNU GPL. OPL emulator is changed from MAME's to the one from Dosbox. cmake -DGPL=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 ..