Compiling UnrealIRCd on Windows

''NOTE: This article is for experienced developers only. Everyone else should follow Installing (Windows) instead.''

Should I compile myself?
The UnrealIRCd project provides precompiled binaries and an installer. If you're after something simple then see Installing (Windows).

If, however, you are a developer and want to compile UnrealIRCd yourself, then follow this article. Possible reasons for doing so:
 * 1) You want to compile a 3rd party module on Windows
 * 2) You want to tweak a compile-time setting (such as in include\config.h or include\struct.h)
 * 3) You want to make source code changes

Which compilers are supported
The official UnrealIRCd releases are compiled with Visual Studio 2012 (also called Visual Studio 11.x). This version and later version should work.

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 Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 here
 * 2) 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). Once in the shell be sure to change the 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).

Other compilers such as cygwin or mingw are not and will not be supported.

External libraries
Fetch the external libraries (c-ares, tre, pcre2, libressl, curl) from http://www.vulnscan.org/unrealwin32dev/ and extract them all to c:\dev

Compiling
nmake -f makefile.win32 USE_SSL=1 OPENSSL_INC_DIR="C:\dev\libressl\include" OPENSSL_LIB_DIR="C:\dev\libressl\x86" USE_REMOTEINC=1 LIBCURL_INC_DIR="c:\dev\curl-ssl\include" LIBCURL_LIB_DIR="C:\dev\curl-ssl\builds\libcurl-vc-x86-release-dll-ssl-dll-ipv6-sspi-obj-lib" CARES_LIB_DIR="C:\dev\c-ares\msvc110\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" PCRE2_INC_DIR="c:\dev\pcre2\build" PCRE2_LIB_DIR="c:\dev\pcre2\build\release" PCRE2LIB="pcre2-8.lib" nmake -f makefile.win32 SYMBOLFILE nmake -f makefile.win32 USE_SSL=1 OPENSSL_INC_DIR="C:\dev\libressl\include" OPENSSL_LIB_DIR="C:\dev\libressl\x86" USE_REMOTEINC=1 LIBCURL_INC_DIR="c:\dev\curl-ssl\include" LIBCURL_LIB_DIR="C:\dev\curl-ssl\builds\libcurl-vc-x86-release-dll-ssl-dll-ipv6-sspi-obj-lib" CARES_LIB_DIR="C:\dev\c-ares\msvc110\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" PCRE2_INC_DIR="c:\dev\pcre2\build" PCRE2_LIB_DIR="c:\dev\pcre2\build\release" PCRE2LIB="pcre2-8.lib"
 * 1) Start the Visual Studio .NET Command Prompt
 * 2) Be sure to run SETENV /x86 if necessary
 * 3) Change to your UnrealIRCd compile directory, for example c:\dev\unrealircd-4.0.X
 * 4) Use the following nmake command:

Compiling modules
Note: you'll need to compile UnrealIRCd first, see previous step.


 * 1) Start the Visual Studio .NET Command Prompt
 * 2) Be sure to run SETENV /x86 if necessary
 * 3) Change to your UnrealIRCd compile directory, for example c:\dev\unrealircd-4.0.X
 * 4) Put your module (the .c file) in src\modules\third, eg: c:\dev\unrealircd-4.0.X\src\modules\third\somemod.c
 * 5) Use the same build command as with  but add the following at the end of the long line: CUSTOMMODULE MODULEFILE=somemod With this we mean: nmake -f makefile.win32 USE_SSL=1 OPENSSL_INC_DIR="C:\dev\libressl\include" ...etc. etc.... CUSTOMMODULE MODULEFILE=somemod
 * 6) Done. You have a DLL file.