Library

Compile MaNGOS On Linux

From MangosWiki

Contents

This is guide is for Debian based systems, other distributions may vary.

Get your packages

To begin, You must install the following: (Enables you to compile MaNGOS)

  • GCC 4.1.X ( gcc / g++ / cpp / fort77 / g77 / gpp)
  • automake
  • autoconf
  • glibc & glibc-dev(glibc headers) [ libc6 ]
  • make
  • mysql-server 4.1 or mysql-server 5.0 && libmysql++-dev
  • libtool
  • OpenSSL (libssl-dev)
  • subversion and patch
  • git
  • zlibc

Make sure you are root first or are in the sudoers file before attempting anything below.

You are able to do this using the Terminal:

sudo apt-get install gcc g++ automake autoconf make libmysql++-dev libtool libssl-dev subversion patch zlibc libc6 git git-core pkg-config

Ubuntu users also can follow Compile MaNGOS On Ubuntu or continue using this guide with the following:

sudo apt-get install build-essential automake autoconf libmysql++-dev libtool libssl-dev subversion zlibc git-core pkg-config

Fedora users can use the following yum packages:

sudo yum install gcc gcc-c++ automake autoconf make mysql-devel libtool openssl-devel subversion patch zlib-devel git-core pkgconfig

Configure git if need be

By default, running 'git' on Debian will attempt to run another application other than the git version control utility, the code below will configure this to work properly. Ubuntu users don't need to run this step.

First run:

/usr/bin/git-scm

Make note of the information displayed and enter the corresponding numerals when prompted after running the command below:

update-alternatives --config git

Obtain sources

You can clone the latest version of mangos by running this command:

git clone git://github.com/mangos/mangos.git mangos

Change directories into the folder that was just created

cd mangos

There is an auxiliary project called ScriptDev2 which will patch mangos to allow better customization, you need to create a directory within your mangos folder to hold these sources.:

mkdir src/bindings/ScriptDev2

Script2Dev uses subversion to manage their codebase, so check it out from SourceForge using this line:

svn co https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2/ src/bindings/ScriptDev2

Now we need to patch SD2 (ScriptDev2) into mangos. There will be a script named very similar to the one listed in the command below, generally you can just use tab completion and fill out the only script available.

git apply src/bindings/ScriptDev2/patches/MaNGOS-XXXX-ScriptDev2.patch

Compile the sources

If the ScriptDev2 patched itself into mangos correctly (no errors) you can go ahead and build it, run these commands:

autoreconf --install --force
mkdir objdir
cd objdir
../configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --datadir=/opt/mangos
make
make install
make clean
cd ..
rm -r objdir

You can replace:

../configure --prefix=/opt/mangos --sysconfdir=/opt/mangos/etc --datadir=/opt/mangos

With:

../configure --prefix=[working path] --sysconfdir=[working path]/etc  --datadir=[working path]
with your [working path]

For example:

../configure --prefix=/opt/foo --sysconfdir=/opt/mangos/foo --datadir=/opt/foo

Once you have run make install, the above code will have caused it to be place the binaries in "/opt/foo/" and the server needs to be ran from the bin folder.

Now proceed with the guide to set MaNGOS up

Setting up MaNGOS

Based on sources from