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 Initial Version and Version 1 of BuildingWinNSS


Ignore:
Timestamp:
Feb 28, 2010, 5:10:45 PM (14 years ago)
Author:
bviktor
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BuildingWinNSS

    v1 v1  
     1= Building NSS on Windows =
     2
     3== Preamble ==
     4
     5NSS stands for [http://www.mozilla.org/projects/security/pki/nss/ Network Security Services]. NSS is required to use SSL in Pidgin. NSS depends on NSPR and a shared database (SQLite since NSS 3.12), but you don't have to worry about these, there's and NSS with NSPR package which is compact thus it contains all sources required to build NSS.
     6
     7== Prerequisites ==
     8
     9 1. Get NSS
     10
     11  Download [ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_5_RTM/src/nss-3.12.5-with-nspr-4.8.2.tar.gz NSS with NSPR 3.12.5]. Extract it so somewhere (you'll get an `nss-3.12.5-with-nspr-4.8.2` directory).
     12
     13 2. Get MozillaBuild
     14
     15  Download [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.4.exe MozillaBuild 1.4] and install it. By default it installs to `c:\mozilla-build`. Add `c:\mozilla-build\msys\bin` and `c:\mozilla-build\moztools\bin` to your PATH.
     16
     17 3. Get MinGW
     18
     19  Download a recent build of the [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_20100223/mingw-w32-bin_i686-mingw_20100223_sezero.zip/download MinGW-w64 w32 toolchain]. Extract it to `c:\mozilla-build\msys` so that MSYS and MinGW have the same folder hiearchy (e.g. MinGW binaries go to `c:\mozilla-build\msys\bin` etc.).
     20
     21 4. Get Visual C++ Express
     22
     23  Download [http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&displaylang=en#filelist Visual C++ 2008 Express Edition SP1] (vcsetup.exe). Install without SQL Server (you can install it, but it's not required for building NSS).
     24
     25== Start build environment ==
     26
     27 1. Run Visual Studio 2008 Command Prompt from Start Menu.
     28
     29 2. Go to `nss-3.12.5-with-nspr-4.8.2\mozilla\security\nss`.
     30
     31== Choose build flavour ==
     32
     33The 3 most important options are:
     34
     35 * target OS
     36 * optimization
     37 * debug RTL
     38
     39You can toggle them with environmental variables. Here's the matrix:
     40
     41{{{
     42#!comment
     43||||BUILD_OPT=0||BUILD_OPT=0||BUILD_OPT=1||BUILD_OPT=1||
     44||||USE_DEBUG_RTL=0||USE_DEBUG_RTL=1||USE_DEBUG_RTL=0||USE_DEBUG_RTL=1||
     45||OS_TARGET=WIN95||WIN954.0_DBG.OBJ||WIN954.0_DBG.OBJD||WIN954.0_OPT.OBJ||N/A||
     46||OS_TARGET=WINNT||WINNT6.1_DBG.OBJ||WINNT6.1_DBG.OBJD||WINNT6.1_OPT.OBJ||N/A||
     47}}}
     48
     49{{{
     50#!rst
     51
     52=================  =================  =================  =================  =================
     53        .                      BUILD_OPT=0                           BUILD_OPT=1
     54-----------------  ------------------------------------  ------------------------------------
     55        .          USE_DEBUG_RTL=0    USE_DEBUG_RTL=1    USE_DEBUG_RTL=0    USE_DEBUG_RTL=1
     56=================  =================  =================  =================  =================
     57OS_TARGET=WIN95    WIN954.0_DBG.OBJ   WIN954.0_DBG.OBJD  WIN954.0_OPT.OBJ   N/A
     58OS_TARGET=WINNT    WINNT6.1_DBG.OBJ   WINNT6.1_DBG.OBJD  WINNT6.1_OPT.OBJ   N/A
     59=================  =================  =================  =================  =================
     60
     61}}}
     62
     63The 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.
     64
     65The default values are 0 for numerical variables and current OS for OS_TARGET. So on Windows 7 with no values set you'll end up building WINNT6.1_DBG.OBJ.
     66
     67Pick the desired configuration (in other words, cell), and set the environmental variables with `set`. Example:
     68
     69{{{
     70set BUILD_OPT=1
     71set OS_TARGET=WIN95
     72}}}
     73
     74'''WARNING''': it seems the builder considers any variable as 1 if it's set. So if you enter
     75
     76{{{
     77set BUILD_OPT=0
     78}}}
     79
     80you'll get an optimized build although you wanted 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).
     81
     82'''Solution''': set a variable only if you want the related build. Here's the table for seeing what you actually have to enter and what you'll get:
     83
     84||||||USE_DEBUG_RTL=1||BUILD_OPT=1||
     85||OS_TARGET=WIN95||WIN954.0_DBG.OBJ||WIN954.0_DBG.OBJD||WIN954.0_OPT.OBJ||
     86||OS_TARGET=WINNT||WINNT6.1_DBG.OBJ||WINNT6.1_DBG.OBJD||WINNT6.1_OPT.OBJ||
     87
     88OS_TARGET is an exception and isn't affected by this error because it's not numerical, so the script checks for its value instead of its existence. As a sidenote, BUILD_OPT seems to have a higher priority, so if you enter
     89
     90{{{
     91set BUILD_OPT=1
     92set USE_DEBUG_RTL=1
     93}}}
     94
     95you'll get an optimized build without linking with the debug RTL. In case you want, for example, a debug build after an optimized, you can unset the variable by setting it without a value, such as:
     96
     97{{{
     98set BUILD_OPT=
     99}}}
     100
     101More info about the build variables can be found in the [https://developer.mozilla.org/en/NSS_reference/Building_and_installing_NSS/Build_instructions Build instructions] page of the Mozilla Developer Central.
     102
     103== Build NSS ==
     104
     105Enter
     106
     107{{{
     108make nss_build_all
     109}}}
     110
     111The resulting binaries will be placed in `nss-3.12.5-with-nspr-4.8.2\mozilla\dist`.
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!