==[ GENERAL GUIDELINES ]==
First of all you need Microsoft Visual C++ (see below), compiling with
cygwin is not supported.

Compatible compilers:
cygwin      NOT supported. Will not work. Should be no reason to use this anyway
            as cygwin is an emulation layer. It's obviously much better to run
            native (Windows) code on Windows.
msvc  6.x   Microsoft Visual Studio 6 does not work, this compiler is too old.
msvc  7.x   Microsoft Visual Studio 7.x (.NET), works.
msvc  8.x   Microsoft Visual Studio 8.x (.NET 2005), including the free kit, works.
msvc  9.x   Microsoft Visual Studio 9.x (.NET 2008), is used for official compile.
mssdk       Microsoft Windows SDK for Windows 7

If you don't have the paid version of Microsoft Visual Studio 7.x, then you can
use the FREE development kit available for Windows 7 explained below:
1. Download the 'MS SDK for Windows 7 and .NET Framework 3.5 SP1' at:
   http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en
      
2. NOTE: Whenever you need to compile something we say 'Start the Visual Studio
   .NET Command Prompt' below, but you - a person using the free version - will
   actually have to start the CMD Shell instead (check out the
   Start Menu under Microsoft Windows SDK v7.0). Users on x64 environment will have
   to change their environment to x86 by typing 'SETENV /x86'.    

3. Download http://www.vulnscan.org/tmp/dlltool.exe and put the file somewhere
   in your path (eg: put it in c:\windows\system32).

==[ EXTERNAL LIBRARIES ]==
Fetch the external libraries (c-ares, tre, openssl, curl) from:
http://www.vulnscan.org/unrealwin32dev/

==[ COMPILING ]==
1. Start the Visual Studio .NET Command Prompt
2. Go to your UnrealIRCd dir (like: cd \dev\unreal3.2)
3. Have a look at 'makefile.win32' to look at what parameters you need to
   use, this depends on what libraries you want to link in and their location.
4. Two options, use either one (B is preferred), and read step 5 too:
   A. Edit makefile.win32 directly to reflect your configuration and run
      'nmake -f makefile.win32'
   B. Don't edit makefile.win32 but instead create a one-line command (which
      you can put in a batch file), like this (all on one line!):
      nmake -f makefile.win32 USE_SSL=1
      OPENSSL_INC_DIR="c:\openssl\include" OPENSSL_LIB_DIR="c:\openssl\lib"
      USE_REMOTEINC=1 LIBCURL_INC_DIR="c:\dev\curl-ssl\include"
      LIBCURL_LIB_DIR="c:\dev\curl-ssl\lib\dll-release"
      CARES_LIB_DIR="C:\dev\c-ares\vc\cares\dll-release"
      CARES_INC_DIR="C:\dev\c-ares" CARESLIB="cares.lib"
      TRE_LIB_DIR="C:\dev\tre\win32\release" TRE_INC_DIR="C:\dev\tre"
      TRELIB="tre.lib"
5. You are likely to encounter an error like
   M_OPER.obj : error LNK2019: unresolved external symbol _sendto_snomask_global
   referenced in function _m_oper
   (the exact name and symbol will differ!!)
   In that case you need to generate a symbols file:
   nmake -f makefile.win32 SYMBOLFILE
   And after that simply re-run your nmake -f makefile.win32 [options]
   command, the same command you ran before the error occured.
   You should not get any unresolved external symbol error again.
   If you still do, then something is wrong.
6. Your compile is now done, you can package unreal if you have InnoSetup,
   in that case check out src\win32\unrealinst.iss
   Otherwise, manually copy over the necessary files (and the dll files
   from the external libraries).

==[ Compiling modules ]==
1. Put your module (the .c file) in src\modules (eg: c:\dev\unreal3.2\src\modules).
2. Start the Visual Studio .NET Command Prompt
3. Go to your UnrealIRCd dir (like: cd \dev\unreal3.2).
4. Compile the module with:
   nmake -f makefile.win32 <YOUR OPTIONS> custommodule MODULEFILE=<name>
   <name> is the name of the module WITHOUT the .c suffix, so if your
   module has the filename 'm_crappymod.c', then you use:
   nmake -f makefile.win32 <YOUR OPTIONS> custommodule MODULEFILE=m_crappymod
   Note that <YOUR OPTIONS> is the whole lot of options explained in
   previous section under 4B. If you use method 4A then there aren't any.
   Note 2: If you get any symbol file errors, see the section 'SYMBOL FILES'
5. Done. A .dll file should have been created.

If you compiled with the same Visual Studio version that we use to compile
the official UnrealIRCd version, and use the same Unreal3.2.X.tar.gz as the
official version (and not CVS!), then your module is fully binary compatible
and you can put it on your website (or ours) so users can use them.
If you do anything else, this won't work.
So, again, it will NOT work properly, if:
1. You use a different UnrealIRCd source (like CVS, or a previous version).
2. You use another compiler... this might still work but may require an
   additional .DLL file to be put in your UnrealIRCd directory (MSVxxxxxx.DLL).
3. You compile with different options, such as compiling with SSL but trying
   to load the module on non-SSL.
   NOTE: unless your module uses SSL-specific code, you should compile
         without SSL as it will run on both SSL and non-SSL UnrealIRCd's.

==[ SYMBOL FILES ]==
If you get something like this:

  Creating library ....
M_OPER.obj : error LNK2019: unresolved external symbol _sendto_snomask_global
 referenced in function _m_oper

(note: the exact name of the symbol will vary!)

Then you will have to rebuild the wircd.def symbol file. You do this by
downloading http://www.vulnscan.org/tmp/dlltool.exe and putting the file somewhere
in your path (eg: c:\winnt\system32).
Then, to compile you do this:
nmake -f makefile.win32 [your other options here]
nmake -f makefile.win32 SYMBOLFILE
nmake -f makefile.win32 [your other options here]

So basically you just run 'nmake -f makefile.win32 SYMBOLFILE' and then restart
compiling again.

==[ COMPILING SSL/CURL YOURSELF ]==
This is off-topic and not explained here.
Again, use the stuff from the win32 development pack unless you have a good
reason to do otherwise.
