Building:

If you are not doing an "in-tree" build, you will need to set the environment variables NSPR_INCLUDE_DIR, NSPR_LIB_DIR, NSS_INCLUDE_DIR, and NSS_LIB_DIR to point to the appropriate places.  On Windows, if you are using the build method described below (cygwin + MSVC), you should use the "mixed" style path e.g.
export NSPR_INCLUDE_DIR=`cygpath -m $HOME/nspr-4.6.1/include`
etc.
The MSVC compiler (cl.exe) will barf on paths like /cygdrive/c/foo/bar.

Unix:
See INSTALL for the usual configure + make + make install

Windows:
Windows has now (as of 2006/2/1) released free versions of their compiler and platform SDKs - everything you need to build svrcore.

Prerequisites:
First, you must install 3 packages downloaded from Microsoft.  If the links don't work, just go to www.microsoft.com and search for their names until you get to the download links for them.
Second, install CygWin - www.cygwin.com
Third, you need nsinstall.exe from the MozTools wintools package (you don't need anything else) - http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip - just unpack the zip file, extract nsinstall.exe, and place in your PATH

* Microsoft Visual C++ Toolkit 2003
** http://msdn.microsoft.com/visualc/vctoolkit2003/ - follow the link to download

* Microsoft Windows Platform SDK
** http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
** Minimum install:
*** Choose Custom
*** Choose Windows Core SDK - omit any 64 bit options (unless you need 64 bit binaries) and omit source code (unless you really want it)
*** You can omit everything else (unless you just want to fill up your disk)
** Full Install (if you have lots of disk space, network bandwidth, and time)

* Microsoft .NET Framework SDK
** http://www.microsoft.com/downloads/details.aspx?familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d&displaylang=en

* CygWin
** www.cygwin.com
*** Download and run setup
*** Setup allows you to choose which packages you want to install.
*** Minimal Install
**** Archive - tar, zip, unzip
**** Base - most everything here
**** Database - nothing - postgres and bdb are selected by default - deselect them
**** Devel - you really only need binutils, make, and mktemp, but cvs is good to have, and you may be interested in some of the others as well
**** Doc - whatever the defaults are
**** Editors - you probably want some sort of text editor if you don't already have one and don't want to use Notepad/Wordpad
**** Games, Gnome, Graphics - Defaults
**** Interpreters - gawk, perl
**** KDE, Libs, Mail, Math, MinGW, Net, Perl, Publishing, Python - Defaults
**** Shells - ash and bash
**** System - Defaults
**** Text - less
**** Utils - Defaults + patch
**** Web, X11 - Defaults
** After installation is complete, you can have it create a cygwin desktop icon that you launch the cygwin environment from

Newer versions of the MS VC tools work as well - I've had success using
MS Visual C++ 2005 Express Edition.

* Setting up your build environment
The first time you launch the cygwin shell, it should create a $HOME/.bash_profile.  To set up your PATH, it is easiest to just call vcvars32.bat (provided)
by the MSVC tools) in a batch file that starts up bash.  If you would
rather set your PATH manually, add the following to $HOME/.bash_profile:
export INCLUDE="c:\Program Files\Microsoft Visual C++ Toolkit 2003\include;c:\Program Files\Microsoft Platform SDK\Include;c:\Program Files\Microsoft Platform SDK\Include\mfc"
export LIB="c:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;c:\Program Files\Microsoft Platform SDK\Lib;c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib"
export ANONMOZCVSROOT=:pserver:anonymous@cvvs-mirror.mozilla.org:/cvsroot
export CVSROOT=$ANONMOZCVSROOT
export PATH="$HOME/bin:/cygdrive/c/Program Files/Microsoft Visual C++ Toolkit 2003/bin:/cygdrive/c/Program Files/Microsoft Platform SDK/Bin:$PATH"

I've put my nsinstall.exe in my $HOME/bin directory and put that first in my PATH.  This assumes you've used the default paths for all of the MS and cygwin installs.  If not, change the paths accordingly.  In order for the changes to take effect, re-source your file or logout and login again.

* Building

 cd mozilla/security/svrcore/src
 make -f Makefile.win
If that barfs, that it cannot find lib.exe, or it is using the wrong
version of lib.exe (e.g. the cygwin one), do the following:
 make -f Makefile.win AR='link /lib -nologo -out:"$@"

And that's it.  The svrcore.lib will be found in mozilla/dist/*.OBJ/lib and svrcore.h will be found in mozilla/dist/public/svrcore.  When you go to build the mozilla ldap c sdk that you have checked out into the same source tree, it will automatically find the files it needs when you use configure --with-svrcore ...
