How to Compile Mangos and Scriptdev2 for Windows

Please check the updated guide on how to compile mangos on windows instead. Which is using GIT because mangos has switched to GIT

Based on the number of emails i’ve received it seems that many people want to learn on how to compile mangos by themself. And of course compiling mangos by yourself is a must especially if you want to have the latest update for your mangos server (beside if you want to run your own public server you should know this first) and so i decided that perhaps it’d be better for me to create a guide on how to compile mangos manually so you can always get your mangos installation up to date

As a side note, actually this guide has been requested since a loooong time ago, but since i already have Microsoft Visual Studio Professional Edition already installed and downloading Microsoft Visual Studio Express is going to take a while for my slow connection, i decided to postpone it. Also as another note, this guide was made on a fresh installation of Windows XP SP3 without any other programs installed other than visual studio express and tortoise svn, which means that if it works on a freshly installed machine without any additional runtime installed, then on a live computer it should work too (unless your windows system files got corrupted of course)

And so here are the steps ..

Getting the Subversion (SVN) Client for Windows

You have two choice here, the first one is you can get a command line svn client (i’m using this) or if you prefer to have graphical based svn client you can also use it, but no matter which svn client you choose (cli or gui), i’ll write the steps below. So feel free to choose which svn client you prefer :)

Using Command Line SVN Client

1. First you need to grab the Subversion Command Line SVN Client from

http://subversion.tigris.org/files/documents/15/41686/svn-1.4.6-setup.exe

(actually there’s a more recent version of subversion but since you need to register in order to download the file i’m choose the above link instead)

2. Now all you have to do is just install it into the location of your choice

3. In order to test whether the SVN has been installed properly and you can run it anywhere from the command line, now you need to open command line and then type svn. And if you get the same message as shown below, that means subversion have been installed properly on your system

Subversion Test

Using Tortoise SVN GUI Client

1. First you need to download the client from (don’t forget to choose the correct release for your system)

http://tortoisesvn.net/downloads

2. Install it and when prompted to restart your computer choose yes to restart your computer (or no if you plan on manually restarting your computer at later time)

3. Now if you can see below image when you right click anywhere that means TortoiseSVN has been installed properly

Tortoise SVN for Windows

Getting Microsoft Visual C++ Express 2008

Because we have finished setting up the subversion client on our computer, all we have to do next is download the C++ Compiler itself in order to compile mangos and scriptdev2. And you can choose to download the ISO file or the Web installation setup file, but since the ISO file is just too big for me to download, i choose to use the Web Install method and only install the C++ Compiler only without anything else

1. Download Microsoft Visual C++ 2008 Express from

http://www.microsoft.com/express/download/

Note: The iso filesize is around 800MB (if i recall correctly) while the Visual C++ Web Install is just around 87MB only

2. And then install it, and don’t worry it’ll take a while for the install process to finish

Download Mangos Source code and Scripdev2 Source code from their SVN Repository

After finished setting up the tools we need to compile mangos and scriptdev2, now we need to grab the mangos and scriptdev2 source code itself of course. Follow the steps below to download mangos sourcecode and scriptdev2 sourcecode

Using Commandline Subversion Client

1. Go to the command prompt and change the directory into something else where you want to place your downloaded mangos source code, and in this example the source code would be placed under C:\SVN … see below image for an example on how to do this

Create SVN Directory

What the above command does is, first it change the directory into the root directory of your drive and then create the svn directory and then go directly inside it … but just in case you can’t see the above image because you block the referer here’s the command

cd \ && md SVN && cd svn

2. Now you need to checkout the mangos source code first, and to do this you just need to type below command from the command prompt

svn co http://mangos.svn.sourceforge.net/svnroot/mangos/trunk mangos

Note: the above command means it’ll checkout the source code to a mangos directory (automatically created), but if you want different directory name you can change mangos at the end of the command into something else, and you need to do this only once (unless you want to redownload the mangos source code again after you’ve downloaded it before)

2.1 Now if you want to update your mangos source code in the future, all you have to do is just type below command from your SVN Directory

cd c:\SVN
svn up mangos

or if you want to update it from anywhere in the command prompt

svn up C:\SVN\mangos

Note: If you change the mangos directory before, you need to change the above value into your mangos source code directory too

3. Now after finished downloading mangos source code, you need to download the scriptdev2 source code too, and you can do this by typing

cd C:\SVN
svn co http://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2 scriptdev2

3.1 And to update the scriptdev2 in the future you just need to use the same command like updating mangos source

cd c:\SVN
svn up scriptdev2

Additional Note: You can always create a batch file to make updating your mangos / scriptdev source code easy by simply executing that batch file instead of typing the above command whenever you want to update mangos, but just make sure to use the full path if you want to use a batch file

Using TortoiseSVN GUI

1. The first thing you need of course it checkout the mangos source code from it’s svn repository and to do this you just need to right click on a folder of your choice and choose checkout to grab the source code, see below image for example

Tortoise SVN Checkout

2. And another window will pop out, and all you have to do is just insert the mangos svn address and scriptdev2 svn address as shown below

Mangos SVN Checkout

Scriptdev2 SVN Checkout

3. And to update it in the future … you just need to go into the SVN directory (in this example C:\SVN) and then right click on each folder (mangos and or scriptdev2) and then choose svn update

Mangos and Scriptdev2 SVN Update

Compiling Mangos

After finished with all the preparation above, now we need to compile mangos and this can be done simply by going into where you placed your mangos source code, and go inside win directory and open the mangosdVC90.sln file. In this example because i put the mangos source code in C:\SVN\mangos the full path is C:\SVN\mangos\win\mangosdVC90.sln … but to make things easier to read here’s a detailed process on how it’s done

1. Go to Win directory under your mangos source code folder and then open mangosdVC90.sln and Visual Studio Express will open automatically

2. Now all you have to do is just change the Build Output from Debug to Release and then choose Build from the toolbar and then choose Clean Solution and finally choose Rebuild Solution and wait until it’s done … see below image for example

Compile Mangos

Compiling Scriptdev2

After finished compiling mangos now we need to compile scriptdev2 to enhance mangos … here’s a detailed explanation on how to do it

1. Copy the entire scriptdev2 directory into your mangos bindings directory, and in this example the full path of mangos bindings directory would be C:\SVN\mangos\src\bindings and the final results would be C:\SVN\mangos\src\bindings\scriptdev2 and get into that directory

2. Now you just need to open scriptVC90.sln and Visual Studio will be launched automatically

3. Do the same process like mangos and that is … change the Build Output into Release -> Clean Solution -> Rebuild Solution and … done

Final Output

You can see the final output of your mangos build in your mangos source code directory under bin\win32_release … in this example the full path would be C:\SVN\mangos\bin\win32_release … and finally don’t forget to copy the mangosd.conf.in and realmd.conf.in and scriptdev2.conf from mangos directory (just use your windows search function) into the same directory as your mangos release directory and remove .in extension (so it’ll result in mangosd.conf, realmd.conf, and scriptdev2.conf)

As a side note, you can always change compiler option as you like it

Optional: Using Custom Patches

So we are done with compiling mangos, but what if you found a great patch somewhere and want to include it into your mangos source code? … well there are two ways to do this … and of course the first way of doing this is via command line (i’m using this), while the second way to do this is via Tortoise SVN Graphical User Interface (GUI)

And in this example the patch is called reaper-test.patch (but you can use a file with .diff extension too)

Using The Command Line Client to Apply Patch

1. Grab the unix patch tools that is already ported for Windows system from below link (download the complete package without sources unless you know what you’re doing) and then install it

http://gnuwin32.sourceforge.net/packages/patch.htm

2. After finished with the installation process now you need to setup an environment variable path so you can run the patch command from anywhere in the command prompt, to do this you need to open Control Panel -> System -> Advanced Tab -> Environment Variable -> Edit the system PATH as shown below

Setup environment variable for PATH

Note: If you use another directory to install the patch command, make sure to adjust that to your installation path

3. Put the patch file into the root of your mangos source directory (in this example it would be C:\svn\mangos)

4. After finished setting up everything now we can test patching file manually from the command line using this command

patch -p0 patch-filename

Applying Patch on Windows

but please note depending on how the patch file created you need to adjust the directory level by changing the -p0 into -pnumber … depending on the directory level itself but in most case you just need to put the patch into the root of mangos source code and then use the above command :)

5. Now you just need to recompile mangos in order for the patch to be applied to the mangos code

Using TortoiseSVN GUI to Apply Patch

1. Put the patch file into your mangos source code directory

2. Right click on the patch filename and choose to Apply Patch, and when another window displayed you just need to right click on the filename listed at the left window and choose Patch All

Apply Patch using TortoiseSVN

3. Now you need to recompile mangos in order for the patch to be applied

Finally …

That’s all for compiling mangos on windows system, and hopefully now you can compile your own mangos release without problem. And i do hope that you can understand this guide. But please keep this in mind, this is a guide on how to compile mangos and scriptdev2 manually, you still need to configure mangos in order for it to work. And as a final note, back then actually i already wrote a guide on how to configure mangos manually just in case you want to see it too (btw since that guide is created before i created my own repack so perhaps that is a little bit outdated although not too outdated, and ooh i can always rewrite it again if anyone wants me to do it)

and hopefully i didn’t forget / miss anything ..

Comment?

Note: Comment may not appear right away.

50 comments on “How to Compile Mangos and Scriptdev2 for Windows

  1. Based from your message (and via translation made by Google) it appears that scriptdev2 can’t find genrevision.exe from your mangos build. Were you able to locate this file by yourself manually?

  2. Grtz…

    Everything works fine till i try to compile scriptdev2.. It gives this error..

    c:\SVN\mangos\src\bindings\scriptdev2\VC90>cd “C:\SVN\mangos\src\bindings\scriptdev2\”
    C:\SVN\mangos\src\bindings\scriptdev2>”..\..\..\win\VC90\genrevision__Win32_Release\genrevision.exe”
    Het systeem kan het opgegeven pad niet vinden.
    C:\SVN\mangos\src\bindings\scriptdev2>if errorlevel 1 goto VCReportError
    C:\SVN\mangos\src\bindings\scriptdev2>echo Project : error PRJ0019: A tool returned an error code from “Extracting Revision”
    Project : error PRJ0019: A tool returned an error code from “Extracting Revision”
    C:\SVN\mangos\src\bindings\scriptdev2>exit 1
    Build log was saved at “file://c:\SVN\mangos\src\bindings\scriptdev2\VC90\ScriptDev2__Win32_Release\BuildLog.htm”
    ScriptDev2 – 2 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    It can’t find some directory…

    “C:\SVN\mangos\src\bindings\scriptdev2>”..\..\..\win\VC90\genrevision__Win32_Release\genrevision.exe”
    Het systeem kan het opgegeven pad niet vinden.”

    Some help plz…

    Thx in advance..

  3. # Marx

    Each System variables will be different because some programs may changed it, but you don’t need to worry about that as long as you have all the necessary tools in your PATH;)

    # wow lover

    Could you tell me what’s the error message?

    # Alpha136xxx

    You can get UDB from http://unifieddb.svn.sourceforge.net/svnroot/unifieddb


    To those who are looking to update mangos source code from it’s GIT Repository, please take a look at my previous comment at:

    http://www.reaper-x.com/2008/10/21/sourceforge-svn-problem/#comment-210977

    I’ll update this post later to reflect the new change :)

  4. Well I’ve compiled my Mangos BEFORE but I remembered before you needed a new mangos.sql or you wont have items… etc. Just wondering where I can get the DB? I checked PSDB but I think the forum is dead or somthing :(

  5. Hello reaper, when i try to compile scriptdev2 there are: 1 errors 1 up-date
    how can i fix this and in my win 32 directory (after compiling mangos) there are nothing in it.

  6. I need help with this system variable. I noticed that my variable value was different than in picture.

    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adobe\AGL;D:\MYSQL\bin;D:\MySQL\MySQL Server 5.0\bin;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Subversion\bin;C:\Program Files\GnuWin32\bin

    I need to know what’s the right value of it.If it is possible,then please type it here :P I need all what’s written there. & that’s why i didn’t get the patch.Help! :(

  7. # TimR and Steveya

    The extraction tools (dbc and vmap) actually already included and can be found in the contrib directory ;)

    as for the guide on how to install / upgrade i’m still working on it. Well actually i almost completed on writing the how to guide about installing everything from scratch, but because the guide is just too long (much longer than this post), i think it’s better for me to rewrite it again lol

  8. Where to find the latest extraction tools in the SVN and how to use them. (As TimR just said) Would be very usefull.

  9. Again, congratulations on an easy to follow guide.

    It might be worth including two more things for idiots like me who didn’t know.

    1) Where to find the latest extraction tools in the SVN and how to use them.

    2) How to install / upgrade your database using MySql.

    Those things are kind of “assumed knowledge” on the scriptdev2 forums, and I couldn’t find any info on here about them, so I had to do research. I think it’d be great if you included it here.

    Thanks again reaper-x and the rest of the team!

  10. Great guide. I just used it to attempt to make a 2.4.3 server. The only problem I’m having now is that the extractor from the latest repack doesn’t get all the files that are needed to run the server.

    Any idea what I need to change to grab all the data?

  11. Mystic, there’s some patches of the fixed mage blink on the scriptdev2 site( or there should be atleast, might be included in on of the next revs, not sure)

    GM island vendors are the Silvermoonproject databse, go to http://projectsilvermoon.net/ and get their database.

    and for custom items just look on google for “WoW vendetta” I don’t remember the exact site but they have ALOOOOT of custom items

  12. Does anyone know how to fix the following:

    Mage wont blink still broken I really need a fix as mage is my main char.

    GM Island Vendors how do I install them or make them with latest versions of Mangos. Need guide for this.

    anyone got custom items or stuff that would be good to share with other ppl?

  13. @reaper-X

    Ya np. Cuz thats actually where i get screwed up. I think i get mangos compiled correctly, its just when i add the sqls for UDB, SD2, and ACID. It seems to work, but as soon as i go to run mangosd.exe. It seems to not like the whole item template and then says something when loading the creature.script not creaturetemplate. it says that there should some amount of fields in table and there might have been a format or something. its really confusing me, i have no idea what to do. Im really good at this stuff too, this just beats me…

    but ya, thats a good idea to re write that, very good idea.
    thanks for taking my idea into consideration.

  14. # Colt45

    Thanks Colt ;)

    # mhs2011

    Hey thanks for mentioning about the database too (to be honest i completely forgot about it) but i think it’d be better if i write it into a separate guide (for example rewriting the how to setup mangos manually and put the database into that one) :)

    and ooh btw, actually Colt and Oatman is going to be the one who created the next repack

  15. I’ve been a fan of the Reaper-X Repack and have started compiling Mangos and Scriptdev2 on my own in the past few weeks. It was nice to see this post as it is very similar to the method I have been using with the added bonus of “how to add patches” (which I have yet to do).

    One thing that still plagues me is the Opera event. In my compiles with Scriptdev2, I seem to be missing something. The announcer changes into his tux and then never walks in the other room. Do the mobs need to be spawned in the database first? I know that in the most recent Reaper-X Repack, this event was semi-working. Much better than my own, anyway. Even using the latest UDB and scriptdev2 database patches doesn’t seem to be enough.

    My next plan is to set the Reaper-X database beside mine and try to compare the tables relating to the event, but before I rack my brain with that, I thought I would ask, while we were on the “how-to” subject. I guess there is a small chance the event is broken in current builds, but I haven’t seen any posts to suggest that.

    Thanks, and I hope you don’t mind a question in the comments :).

  16. Thanks a lot reaper. The Guide on mangosproject doesn’t explain it as good as you did. This really helped me out. But it would be nice to put in where they can get the databases from, like UDB or PSDB. at least put in the SVN directories.
    but thanks again, you did a great job. ill miss your repacks though…

  17. aah thanks for mentioning about VS Registration but actually when i write this post i choose to not register the vs express

    as for svn, you can use to get the svn binary instead (because you dont need to install it) just in case the computer you have access to the internet (i assume at work) doesn’t allow you to install software ;)

    btw i’m sorry there’s a delay before your comment appear here because i just noticed your comment goes into the spam queue (dunno why too)

  18. hey, thanks for the tutorial / setup reaper, Will do this tonight I hope. One thing you forgot, when people install the express install of C++ they will need to remember to register it ( free ) otherwise it doesn’t work.

    Another thing, is there a way to get the SVN rather than using tortoiseSVN for those who don’t have the interwebs? .. like me :D