Bug 1822393 - set MOZ_UPDATE_CHANNEL for firefox-android builds. r=glandium,geckoview...
[gecko.git] / security / nss / coreconf / nspr.sh
blobd84674e0e091decc5d302676c819ec935610a334
1 #!/usr/bin/env bash
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.
7 # variables
8 nspr_cflags=
9 nspr_cxxflags=
10 nspr_ldflags=
12 # Try to avoid bmake on OS X and BSD systems
13 if hash gmake 2>/dev/null; then
14 make() { command gmake "$@"; }
17 nspr_set_flags()
19 nspr_cflags="$CFLAGS $@"
20 nspr_cxxflags="$CXXFLAGS $@"
21 nspr_ldflags="$LDFLAGS $@"
24 nspr_build()
26 local nspr_dir="$cwd"/../nspr/$target
27 mkdir -p "$nspr_dir"
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[@]}" "$@"
44 popd >/dev/null
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"
51 else
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
58 else
59 echo "NSPR [4/5] NOT running tests"
62 echo "NSPR [5/5] install ..."
63 run_verbose make -C "$nspr_dir" install
66 nspr_clean()
68 rm -rf "$cwd"/../nspr/$target
71 set_nspr_path()
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")