nspr_build_instructions.rst (3433B)
1 NSPR build instructions 2 ======================= 3 4 Prerequisites 5 ~~~~~~~~~~~~~ 6 7 On Windows, the NSPR build system needs GNU make and a Unix command-line 8 utility suite such as MKS Toolkit, Cygwin, and MSYS. The easiest way to 9 get these tools is to install the 10 :ref:`MozillaBuild` package. 11 12 Introduction 13 ~~~~~~~~~~~~ 14 15 The top level of the NSPR source tree is the ``mozilla/nsprpub`` 16 directory. Although ``nsprpub`` is a subdirectory under ``mozilla``, 17 NSPR is independent of the Mozilla client source tree. 18 19 Building NSPR consists of three steps: 20 21 #. run the configure script. You may override the compilers (the CC 22 environment variable) or specify options. 23 #. build the libraries 24 #. build the test programs 25 26 For example, 27 28 :: 29 30 # check out the source tree from Mercurial 31 hg clone https://hg.mozilla.org/projects/nspr 32 # create a build directory 33 mkdir target.debug 34 cd target.debug 35 # run the configure script 36 ../nspr/configure [optional configure options] 37 # build the libraries 38 gmake 39 # build the test programs 40 cd pr/tests 41 gmake 42 43 On Mac OS X, use ``make``, which is GNU ``make``. 44 45 .. _Configure_options: 46 47 Configure options 48 ~~~~~~~~~~~~~~~~~ 49 50 Although NSPR uses autoconf, its configure script has two default values 51 that are different from most open source projects. 52 53 #. If the OS vendor provides a compiler (for example, Sun and HP), NSPR 54 uses that compiler instead of GCC by default. 55 #. NSPR build generates a debug build by default. 56 57 .. _--disable-debug_--enable-optimize: 58 59 --disable-debug --enable-optimize 60 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 61 62 Specify these two options to generate an optimized (release) build. 63 64 These two options can actually be used independently, but it's not 65 recommended. 66 67 --enable-64bit 68 ^^^^^^^^^^^^^^ 69 70 On a dual 32-bit/64-bit platform, NSPR build generates a 32-bit build by 71 default. To generate a 64-bit build, specify the ``--enable-64bit`` 72 configure option. 73 74 .. _--targetx86_64-pc-mingw32: 75 76 --target=x86_64-pc-mingw32 77 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 78 79 For 64-bit builds on Windows, when using the mozbuild environment. 80 81 .. _--enable-win32-target.3DWIN95: 82 83 --enable-win32-target=WIN95 84 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 85 86 This option is only used on Windows. NSPR build generates a "WINNT" 87 configuration by default on Windows for historical reasons. We recommend 88 most applications use the "WIN95" configuration. The "WIN95" 89 configuration supports all versions of Windows. The "WIN95" name is 90 historical; it should have been named "WIN32". 91 92 To generate a "WIN95" configuration, specify the 93 ``--enable-win32-target=WIN95`` configure option. 94 95 .. _--enable-debug-rtl: 96 97 --enable-debug-rtl 98 ^^^^^^^^^^^^^^^^^^ 99 100 This option is only used on Windows. NSPR debug build uses the release C 101 run-time library by default. To generate a debug build that uses the 102 debug C run-time library, specify the ``--enable-debug-rtl`` configure 103 option. 104 105 .. _Makefile_targets: 106 107 Makefile targets 108 ~~~~~~~~~~~~~~~~ 109 110 - all (default) 111 - clean 112 - realclean 113 - distclean 114 - install 115 - release 116 117 .. _Running_the_test_programs: 118 119 Running the test programs 120 ~~~~~~~~~~~~~~~~~~~~~~~~~ 121 122 The tests were built above, in the ``pr/tests`` directory. 123 124 On Mac OS X, they can be executed with the following: 125 126 .. code:: 127 128 /bin/sh: 129 130 $ cd pr/tests 131 $ DYLD_LIBRARY_PATH=../../dist/lib ./accept 132 PASS 133 $ 134 $ # to run all the NSPR tests... 135 $ 136 $ DYLD_LIBRARY_PATH=../../dist/lib ../../../nspr/pr/tests/runtests.sh ../..