Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Changes between Version 35 and Version 36 of BuildingWinNSS


Ignore:
Timestamp:
Oct 15, 2011, 6:06:24 PM (12 years ago)
Author:
itsnotabigtruck
Comment:

Updated for WDK build

Legend:

Unmodified
Added
Removed
Modified
  • BuildingWinNSS

    v35 v36  
    99== Prerequisites ==
    1010
    11  1. '''Get GNU Patch:'''[[BR]]Download [http://gnuwin32.sourceforge.net/packages/patch.htm Patch] from the !GnuWin32 project. Note that Windows thinks that "patch.exe" is a patch for a program and will prompt you to UAC elevate it whenever you use it (see [http://math.nist.gov/oommf/software-patchsets/patch_on_Windows7.html this page]).
    12  1. '''Get the Windows SDK:'''[[BR]]Download the [https://www.microsoft.com/download/en/details.aspx?id=8279 Windows SDK for Windows 7 SP1] and install it to the default location.
    13  1. '''Get the Windows Driver Kit (WDK):'''[[BR]]Download the [https://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11800 WDK for Windows 7 SP1] and install it to the default location.
    14  1. '''Get the Netscape Portable Runtime (NSPR):'''[[BR]]Download the latest version of [ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases/ NSPR] (currently 4.8.9) and extract it to `c:\devel\pidgin-devel\win32-dev`.
    15  1. '''Get Network Security Services (NSS):'''[[BR]]Download the latest version of [ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/ NSS] (currently 3.12.11 w/ CKBI 1.87) and extract it to the same location.
    16  1. '''Get MozillaBuild:'''[[BR]]Download the latest version of [ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe MozillaBuild] and install it to `c:\devel\mozilla-build`.
     11 1. '''GNU Patch:'''[[BR]]Download [http://gnuwin32.sourceforge.net/packages/patch.htm Patch] from the !GnuWin32 project. Note that Windows thinks that "patch.exe" is a patch for a program and will prompt you to UAC elevate it whenever you use it (see [http://math.nist.gov/oommf/software-patchsets/patch_on_Windows7.html this page]).
     12 1. '''Windows SDK:'''[[BR]]Download the [https://www.microsoft.com/download/en/details.aspx?id=8279 Windows SDK for Windows 7 SP1] and install it to the default location. If you have Visual Studio 2010 Pro or Ultimate installed, this step can be ignored.[[BR]]''NOTE:'' The build script below is written for Visual Studio 2010 and its included SDK - it might be necessary to tweak the script for any other configuration.
     13 1. '''Windows Driver Kit (WDK):'''[[BR]]Download the [https://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11800 WDK for Windows 7 SP1] and install it to the default location.
     14 1. '''Netscape Portable Runtime (NSPR) source:'''[[BR]]Download the latest version of [ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases/ NSPR] (currently 4.8.9) and extract it to `c:\devel\pidgin-devel\win32-dev`.
     15 1. '''Network Security Services (NSS) source:'''[[BR]]Download the latest version of [ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/ NSS] (currently 3.12.11 w/ CKBI 1.87) and extract it to the same location.
     16 1. '''MozillaBuild:'''[[BR]]Download the latest version of [ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe MozillaBuild] and install it to `c:\devel\mozilla-build`.
     17 1. '''WDK build patch:'''[[BR]]Download the [http://code.google.com/p/xchat-wdk/ XChat-WDK project]'s [http://code.google.com/p/xchat-wdk/source/browse/ext/nss-wdk/nss-wdk.patch?name=wdk WDK build patch] to `c:\devel\pidgin-devel\win32-dev\nss-wdk.patch`.
     18 1. '''WDK build script:'''[[BR]]Download [https://gist.github.com/1289898 this build script] to `c:\devel\pidgin-devel\win32-dev\build-x86.bat`.
    1719
    18 == Apply patches ==
     20== Prepare the build tree ==
    1921
    20 Download the [http://code.google.com/p/xchat-wdk/source/browse/ext/nss-wdk/nss-wdk.patch?name=wdk WDK build patch] from the [http://code.google.com/p/xchat-wdk/ XChat-WDK project]. Open a command prompt at your NSS/NSPR directory and run `"c:\path\to\patch.exe" -p1 --binary -i nss-wdk.patch`.
     22Open a command prompt at your NSS/NSPR directory and run `"%PROGRAMFILES(X86)%\GnuWin32\bin\patch" -p1 --dry-run --binary -i nss-wdk.patch`. If there aren't any problems, re-run the command without the `--dry-run` flag.
     23
     24Once this is done, open `c:\devel\pidgin-devel\win32-dev\build-x86.bat` in your editor of choice and adjust it so that the WDK binaries, mt.exe from the Windows SDK, and lib.exe from the Visual C++ compiler package are all in the PATH. If you have Visual Studio 2010 installed, it should work without modification as long as the paths are correct.
    2125
    2226== Choose build configuration ==
    2327
    24 The two most important options are:
     28The NSS build configuration is controlled by environment variables. The most important options are:
    2529
    26  * optimization
    27  * debug RTL
     30 * Enable optimizations (BUILD_OPT)
     31 * Use debug runtime library (USE_DEBUG_RTL)
     32 * Enable elliptic curve cryptography (NSS_ENABLE_ECC)
     33 * Disable legacy DBM database (NSS_DISABLE_DBM)
    2834
    29 You can toggle them with environmental variables. Here's the matrix:
     35The first two options select the build type according to the matrix below:
    3036
    3137   {{{
    3238#!rst
    3339+---------------+--------------------+---------------------+
    34 |               |``USE_DEBUG_RTL=`` |``USE_DEBUG_RTL=1``  |
     40|               |``USE_DEBUG_RTL=0`` |``USE_DEBUG_RTL=1``  |
    3541+===============+====================+=====================+
    36 |``BUILD_OPT=`` |``WINNT6.1_DBG.OBJ``|``WINNT6.1_DBG.OBJD``|
     42|``BUILD_OPT=0``|``WINNT5.1_DBG.OBJ``|``WINNT5.1_DBG.OBJD``|
    3743+---------------+--------------------+---------------------+
    38 |``BUILD_OPT=1``|``WINNT6.1_OPT.OBJ``|``N/A``              |
     44|``BUILD_OPT=1``|``WINNT5.1_OPT.OBJ``|``N/A``              |
    3945+---------------+--------------------+---------------------+
    4046   }}}
    4147
    42 The version after WINNT is the version of your current OS (you can check it with the `winver` command). WINNT6.1 assumes you're building on Windows 7. The default setting is an unoptimized build with the release RTL (WINNT6.1_DBG.OBJ).
     48The version after WINNT is the target OS version - WINNT5.1 assumes you're building for Windows XP.
    4349
    44 '''WARNING''': it seems the builder considers an option to be enabled if it's set, so if you enter `set BUILD_OPT=0` you'll get an optimized build, not a debug one. The answer lies in `mozilla\security\coreconf\WIN32.mk`. They check variables with ifdefs, which is just plain wrong (or they should mention it this way in the documentation).
     50The second two options control which features are enabled. Normally, both NSS_ENABLE_ECC and NSS_DISABLE_DBM should be selected.
    4551
    46 More info about the build variables can be found on the [https://developer.mozilla.org/en/NSS_reference/Building_and_installing_NSS/Build_instructions Build instructions] page of the Mozilla Developer Central.
     52When using the build script below, the default build is WINNT5.1_OPT.OBJ with ECC enabled and DBM disabled. In order to override these settings, set the corresponding environment variables to 0 or 1 before performing the build. Note that this behavior is different than when using the Mozilla makefiles directly. More info about the build variables can be found on the [https://developer.mozilla.org/en/NSS_reference/Building_and_installing_NSS/Build_instructions build instructions] page of Mozilla Developer Central.
    4753
    48 == Build NSS ==
     54== Do the build ==
    4955
    50   ''To be updated with DDK build instructions''
    51 
    52 The easiest way to do this with consistent results is to make a build script (the following is what the binary included with Pidgin is built with):
    53 {{{
    54 #!sh
    55 #!/bin/bash
    56 
    57 #The path that we've extracted the nss source tarball into
    58 NSS_SRC_DIR=/c/devel/pidgin-devel/win32-dev
    59 
    60 #Set our Build Arguments:
    61 #Optimized Build
    62 export BUILD_OPT=1
    63 #Target Windows NT Family
    64 export OS_TARGET=WINNT
    65 #Use GCC (as opposed to VC)
    66 export NS_USE_GCC=1
    67 
    68 #Set up the build path with MinGW and Moztools
    69 PATH=/c/devel/pidgin-devel/win32-dev/mingw/bin
    70 PATH=/c/devel/mozilla-build/moztools/bin:$PATH
    71 PATH=/c/devel/mozilla-build/msys/bin:$PATH
    72 export PATH
    73 
    74 pushd $NSS_SRC_DIR/nss-3.12.8/mozilla/security/nss
    75 make nss_build_all
    76 popd
    77 
    78 }}}
    79 
    80 Save this script as `build.sh`. Launch a command prompt and run:
    81 
    82 {{{
    83 c:\devel\mozilla-build\msys\bin\sh build.sh
    84 }}}
    85 
    86 The build will likely not complete successfully due to hardcoded library paths and other problems in the build system (it will bail out building `.../cmd/bltest`).  If it gets that far, it has already built the various libraries successfully.
     56Launch a Windows XP build environment window (Start > All Programs > Windows Driver Kits > WDK 7600.16385.1 > Build Environments > Windows XP > x86 Free Build Environment) and navigate to `c:\devel\pidgin-devel\win32-dev\`. When you're ready to build, run `build-x86` and wait for the build to complete!
    8757
    8858The resulting binaries will be placed in `c:\devel\pidgin-devel\win32-dev\nss-3.12.8\mozilla\dist`. The contents of `private` and `public` are the same across all configurations so they can be distributed separately. The following files need to be distributed with Pidgin:
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!