On Windows, the NSPR build system needs GNU make and a Unix command-line utility suite such as MKS Toolkit, Cygwin, and MSYS. The easiest way to get these tools is to install the MozillaBuild package.
The top level of the NSPR source tree is the mozilla/nsprpub
directory. Although nsprpub
is a subdirectory under mozilla
, NSPR is independent of the Mozilla client source tree.
Building NSPR consists of three steps:
For example,
# check out the source tree from Mercurial hg clone https://hg.mozilla.org/projects/nspr # create a build directory mkdir target.debug cd target.debug # run the configure script ../nspr/configure [optional configure options] # build the libraries gmake # build the test programs cd pr/tests gmake
On Mac OS X, use make
, which is GNU make
.
Although NSPR uses autoconf, its configure script has two default values that are different from most open source projects.
Specify these two options to generate an optimized (release) build.
These two options can actually be used independently, but it's not recommended.
On a dual 32-bit/64-bit platform, NSPR build generates a 32-bit build by default. To generate a 64-bit build, specify the --enable-64bit
configure option.
For 64-bit builds on Windows, when using the MozillaBuild environment.
This option is only used on Windows. NSPR build generates a "WINNT" configuration by default on Windows for historical reasons. We recommend most applications use the "WIN95" configuration. The "WIN95" configuration supports all versions of Windows. The "WIN95" name is historical; it should have been named "WIN32".
To generate a "WIN95" configuration, specify the --enable-win32-target=WIN95
configure option.
This option is only used on Windows. NSPR debug build uses the release C run-time library by default. To generate a debug build that uses the debug C run-time library, specify the --enable-debug-rtl
configure option.
The tests were built above, in the pr/tests
directory.
On Mac OS X, they can be executed with the following:
/bin/sh: $ cd pr/tests $ DYLD_LIBRARY_PATH=../../dist/lib ./accept PASS $ $ # to run all the NSPR tests... $ $ DYLD_LIBRARY_PATH=../../dist/lib ../../../nspr/pr/tests/runtests.sh ../..