2 # This script builds NSPR for NSS.
4 # This build system is still under development. It does not yet support all
5 # the features or platforms that the regular NSPR build supports.
12 # Try to avoid bmake on OS X and BSD systems
13 if hash gmake
2>/dev
/null
; then
14 make() { command gmake
"$@"; }
19 nspr_cflags
="$CFLAGS $@"
20 nspr_cxxflags
="$CXXFLAGS $@"
21 nspr_ldflags
="$LDFLAGS $@"
26 local nspr_dir
="$cwd"/..
/nspr
/$target
29 # These NSPR options are directory-specific, so they don't need to be
30 # included in nspr_opt and changing them doesn't force a rebuild of NSPR.
31 extra_params
=(--prefix="$dist_dir"/$target)
32 if [ "$opt_build" = 1 ]; then
33 extra_params
+=(--disable-debug --enable-optimize)
35 if [ "$target_arch" = "x64" ]; then
36 extra_params
+=(--enable-64bit)
39 echo "NSPR [1/5] configure ..."
40 pushd "$nspr_dir" >/dev
/null
41 CFLAGS
="$nspr_cflags" CXXFLAGS
="$nspr_cxxflags" \
42 LDFLAGS
="$nspr_ldflags" CC
="$CC" CXX
="$CCC" \
43 run_verbose ..
/configure
"${extra_params[@]}" "$@"
45 echo "NSPR [2/5] make ..."
46 run_verbose
make -C "$nspr_dir"
48 if [ "$build_nspr_tests" = 1 ]; then
49 echo "NSPR [3/5] build tests ..."
50 run_verbose
make -C "$nspr_dir/pr/tests"
52 echo "NSPR [3/5] NOT building tests"
55 if [[ "$build_nspr_tests" = 1 && "$run_nspr_tests" = 1 ]]; then
56 echo "NSPR [4/5] run tests ..."
57 run_verbose
make -C "$nspr_dir/pr/tests" runtests
59 echo "NSPR [4/5] NOT running tests"
62 echo "NSPR [5/5] install ..."
63 run_verbose
make -C "$nspr_dir" install
68 rm -rf "$cwd"/..
/nspr
/$target
73 local include
=$
(echo "$1" | cut
-d: -f1)
74 local lib
=$
(echo "$1" | cut
-d: -f2)
75 gyp_params
+=(-Dnspr_include_dir="$include")
76 gyp_params
+=(-Dnspr_lib_dir="$lib")