Version 11 (modified by 14 years ago) (diff) | ,
---|
Building NSS on Windows
Preamble
NSS stands for 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.
To avoid confusion, building NSS on Windows doesn't make use of Cygwin. If you have it (or an other version of MinGW) installed on your computer, it's a good idea to rename its folder until you're finished building NSS to avoid conflicts.
Prerequisites
- Get NSS
Download NSS with NSPR 3.12.5. Extract it so somewhere (you'll get an
nss-3.12.5-with-nspr-4.8.2
directory).
- Get MozillaBuild
Download MozillaBuild 1.4 and install it. By default it installs to
c:\mozilla-build
.
- Get MinGW
This assumes that you have MinGW working as described in the Pidgin Building Instructions.
- Get w32api sources
Download MinGW API for MS-Windows 3.14. Extract it to somewhere (you'll get a
w32api-3.14-mingw32
directory).
Build shell32 library
- Enter
w32api-3.14-mingw32
.
- Build libraries:
sh configure make
- Copy
w32api-3.14-mingw32/lib/shell32.o
towin32-dev/mingw/lib
.
Choose build flavour
The 3 most important options are:
- target OS
- optimization
- debug RTL
You can toggle them with environmental variables. Here's the matrix:
. | BUILD_OPT=0 | BUILD_OPT=1 | ||
---|---|---|---|---|
. | USE_DEBUG_RTL=0 | USE_DEBUG_RTL=1 | USE_DEBUG_RTL=0 | USE_DEBUG_RTL=1 |
OS_TARGET=WIN95 | WIN954.0_DBG.OBJ | WIN954.0_DBG.OBJD | WIN954.0_OPT.OBJ | N/A |
OS_TARGET=WINNT | WINNT6.1_DBG.OBJ | WINNT6.1_DBG.OBJD | WINNT6.1_OPT.OBJ | N/A |
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 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.
Pick the desired configuration (in other words, cell), and set the environmental variables with set
. Example:
set BUILD_OPT=1 set OS_TARGET=WIN95
WARNING: it seems the builder considers any variable as 1 if it's set. So if you enter
set BUILD_OPT=0
you'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).
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:
USE_DEBUG_RTL=1 | BUILD_OPT=1 | ||
OS_TARGET=WIN95 | WIN954.0_DBG.OBJ | WIN954.0_DBG.OBJD | WIN954.0_OPT.OBJ |
OS_TARGET=WINNT | WINNT6.1_DBG.OBJ | WINNT6.1_DBG.OBJD | WINNT6.1_OPT.OBJ |
OS_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
set BUILD_OPT=1 set USE_DEBUG_RTL=1
you'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:
set BUILD_OPT=
More info about the build variables can be found on the Build instructions page of the Mozilla Developer Central.
Patch NSS
There's an error which prevents NSS from building with GCC. Apply the following patch to nss-3.12.5-with-nspr-4.8.2\mozilla\security\nss\lib\freebl\config.mk
:
-
config.mk
old new 85 85 RESNAME = freebl.rc 86 86 87 87 ifndef WINCE 88 ifndef NS_USE_GCC 88 89 OS_LIBS += shell32.lib 89 90 endif 91 endif 90 92 91 93 ifdef NS_USE_GCC 94 OS_LIBS += -lshell32 95 DEFINES += -D_WIN32_IE=0x0400 92 96 EXTRA_SHARED_LIBS += \ 93 97 -L$(DIST)/lib \ 94 98 -L$(NSSUTIL_LIB_DIR) \
Build NSS
The easiest way to do this with consistent results to to make a build script (the following is what the binary included with Pidgin is built with):
#!/bin/bash #The path that we've extracted the nss source tarball into NSS_SRC_DIR=/c/devel/nss-devel #Set our Build Arguments: #Optimized Build export BUILD_OPT=1 #Target Windows NT Family export OS_TARGET=WINNT #Use GCC (as opposed to VC) export NS_USE_GCC=1 #Set up the build path with MinGW and Moztools PATH=/c/devel/pidgin-devel/win32-dev/mingw/bin:$PATH PATH=/c/devel/mozilla-build/moztools/bin:$PATH export PATH pushd $NSS_SRC_DIR/nss-3.12.5-with-nspr-4.8.2/mozilla/security/nss make nss_build_all popd
Launch a MSYS shell using c:\mozilla-build\msys\msys.bat
and run the above script.
The build will likely not complete successfully (it will bail out building .../cmd/bltest
). If it gets that far, it has built the various libraries successfully.
The resulting binaries will be placed in nss-3.12.5-with-nspr-4.8.2\mozilla\dist
. The contents of private
and public
are the same across all flavours so they can be distributed separately.
Attachments (7)
-
build-x86.bat (2.1 KB) - added by 11 years ago.
Build Batch file
-
nss-wdk.patch (9.1 KB) - added by 11 years ago.
Local copy of https://github.com/hexchat/hexchat/blob/master/win32/ext/nss-wdk/nss-wdk.patch
-
nss-wdk.2.patch (8.8 KB) - added by 10 years ago.
Patch for NSS 3.15.2
-
nss-wdk-3.16.patch (8.4 KB) - added by 10 years ago.
Patch for NSS 3.16
-
nss-wdk-3.17.1.patch (10.8 KB) - added by 9 years ago.
Patch for 3.17.1
-
nss-wdk-3.20.1.patch (10.4 KB) - added by 8 years ago.
Patch for NSS 3.20.1
- nss-wdk-3.24.patch (11.8 KB) - added by 8 years ago.
Download all attachments as: .zip