3 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
10 # The script is located in "native_client/tests/spec2k"
13 if [[ $(basename "$(pwd)") != "spec2k" ]] ; then
14 echo "ERROR: cannot find the spec2k/ directory"
18 # TODO(pdox): Remove this dependency.
19 source ../../pnacl/scripts/common-tools.sh
20 readonly NACL_ROOT="$(GetAbsolutePath "../../")"
21 SetScriptPath "$(pwd)/run_all.sh"
22 SetLogDirectory "${NACL_ROOT}/toolchain/test-log"
23 readonly TESTS_ARCHIVE=arm-spec.tar.gz
25 ######################################################################
27 ######################################################################
28 # TODO(robertm): make this configurable from the commandline
30 readonly LIST_INT_C="164.gzip 175.vpr 176.gcc 181.mcf 186.crafty 197.parser \
31 253.perlbmk 254.gap 255.vortex 256.bzip2 300.twolf"
33 readonly LIST_FP_C="177.mesa 179.art 183.equake 188.ammp"
35 readonly LIST_INT_CPP="252.eon"
37 SPEC2K_BENCHMARKS="${LIST_FP_C} ${LIST_INT_C} ${LIST_INT_CPP}"
39 # One of {./run.train.sh, ./run.ref.sh}
40 SPEC2K_SCRIPT="./run.train.sh"
42 # uncomment this to disable verification
43 # verification time will be part of overall benchmarking time
45 export VERIFY=${VERIFY:-yes}
46 export MAKEOPTS=${MAKEOPTS:-}
48 # Helper script to process timing / other perf data.
49 # Export these paths to Makefile.common, which will be included by other
50 # Makefiles in random sub-directories (where pwd will be different).
51 export PERF_LOGGER="$(pwd)/emit_perf_log.sh"
52 export COMPILE_REPEATER="$(pwd)/compile_repeater.sh"
53 # Number of times to repeat a timed step.
54 export SPEC_RUN_REPETITIONS=${SPEC_RUN_REPETITIONS:-1}
55 export SPEC_COMPILE_REPETITIONS=${SPEC_COMPILE_REPETITIONS:-1}
57 export PNACL_LIBMODE=${PNACL_LIBMODE:-newlib}
61 ######################################################################
63 ######################################################################
65 readonly SCONS_OUT="${NACL_ROOT}/scons-out"
66 readonly TC_ROOT="${NACL_ROOT}/toolchain"
68 readonly ARM_TRUSTED_TC="${TC_ROOT}/linux_arm-trusted"
69 readonly QEMU_TOOL="${ARM_TRUSTED_TC}/run_under_qemu_arm"
72 "${TC_ROOT}/pnacl_${BUILD_PLATFORM}_${BUILD_ARCH}/${PNACL_LIBMODE}"
73 readonly ARM_LLC_NEXE=${TC_ROOT}/pnacl_translator/armv7/bin/pnacl-llc.nexe
75 readonly NNACL_TC="${TC_ROOT}/${SCONS_BUILD_PLATFORM}_x86"
76 readonly RUNNABLE_LD_X8632="${NNACL_TC}/x86_64-nacl/lib32/runnable-ld.so"
77 readonly RUNNABLE_LD_X8664="${NNACL_TC}/x86_64-nacl/lib/runnable-ld.so"
83 # If the PNaCl toolchain is installed, prefer to use its "size".
84 # TODO(robertm): standardize on one of the pnacl dirs
85 if [ -d "${PNACL_TC}/../host/bin/" ] ; then
86 GNU_SIZE="${PNACL_TC}/../host/bin/arm-pc-nacl-size"
87 elif [ -d "${PNACL_TC}/../pkg/binutils/bin/" ] ; then
88 GNU_SIZE="${PNACL_TC}/../pkg/binutils/bin/arm-pc-nacl-size"
89 elif ${BUILD_PLATFORM_LINUX} ; then
92 # There's nothing we can run here.
93 # The system might have "size" installed, but if it is not GNU,
94 # there's no guarantee it can handle ELF.
100 ######################################################################
102 ######################################################################
104 #@ run_all.sh <mode> <mode-arg>*
106 #@ ------------------------------------------------------------
108 #@ ------------------------------------------------------------
110 # Setups for building (but not running) Pexes only. Used for arm-hw translator
111 # testing where pexes are build on x86 and translated on arm
112 SetupPnaclPexeOpt() {
113 SUFFIX=opt.stripped.pexe
117 SUFFIX=unopt.stripped.pexe
122 #@ use system compiler for x86-32
130 #@ use system compiler for x86-32 with optimization
138 #@ use system compiler for x86-64
146 #@ use system compiler for x86-64 with optimization
154 #@ use Emscripten emcc compiler for Asm.js JavaScript generation
156 PREFIX=../run_asmjs.sh
164 #@ use system compiler for x86-32
172 #@ use system compiler for x86-32 with optimization
173 SetupLlvmX8632Opt() {
175 SUFFIX=llvm.opt.x8632
180 #@ use system compiler for x86-64
188 #@ use system compiler for x86-64 with optimization
189 SetupLlvmX8664Opt() {
191 SUFFIX=llvm.opt.x8664
196 #@ use system compiler for ARM
204 #@ use system compiler for ARM with optimization
207 SUFFIX=llvm.opt.hw.arm
210 ######################################################################
212 SetupNaclX8632Common() {
218 #@ use nacl-gcc compiler
226 #@ use nacl-gcc compiler with optimizations
227 SetupNaclX8632Opt() {
229 SUFFIX=nacl.opt.x8632
232 SetupNaclX8664Common() {
238 #@ use nacl-gcc64 compiler
246 #@ use nacl-gcc64 compiler with optimizations
247 SetupNaclX8664Opt() {
249 SUFFIX=nacl.opt.x8664
252 SetupNaclDynX8632Common() {
253 SetupSelLdr x86-32 "" "-s" "${RUNNABLE_LD_X8632}"
258 #@ use nacl-gcc compiler with glibc toolchain and dynamic linking
259 SetupNaclDynX8632() {
260 SetupNaclDynX8632Common
261 SUFFIX=nacl.dyn.x8632
265 #@ SetupNaclDynX8632Opt
266 #@ use nacl-gcc compiler with glibc toolchain and dynamic linking
267 SetupNaclDynX8632Opt() {
268 SetupNaclDynX8632Common
269 SUFFIX=nacl.dyn.opt.x8632
272 SetupNaclDynX8664Common() {
273 SetupSelLdr x86-64 "" "-s" "${RUNNABLE_LD_X8664}"
278 #@ use nacl64-gcc compiler with glibc toolchain and dynamic linking
279 SetupNaclDynX8664() {
280 SetupNaclDynX8664Common
281 SUFFIX=nacl.dyn.x8664
285 #@ SetupNaclDynX8664Opt
286 #@ use nacl64-gcc compiler with glibc toolchain and dynamic linking
287 SetupNaclDynX8664Opt() {
288 SetupNaclDynX8664Common
289 SUFFIX=nacl.dyn.opt.x8664
292 ######################################################################
294 SetupPnaclX8664Common() {
300 #@ use pnacl x86-64 compiler (no lto)
302 SetupPnaclX8664Common
307 #@ SetupPnaclX8664Opt
308 #@ use pnacl x86-64 compiler (with lto)
309 SetupPnaclX8664Opt() {
310 SetupPnaclX8664Common
311 SUFFIX=pnacl.opt.x8664
315 #@ SetupPnaclX8664ZBSOpt
316 #@ use pnacl x86-64 compiler (with lto)
317 #@ use x86-64 zero-based sandbox
318 SetupPnaclX8664ZBSOpt() {
319 SetupSelLdr x86-64 "" "-c"
320 # TODO(arbenson): Give this a different suffix to differentitate
321 # from the existing x86-64 build, and make the corresponding
322 # changes to the build process.
323 SUFFIX=pnacl.opt.x8664
327 #@ SetupPnaclTranslatorX8664
328 #@ use pnacl x8664 translator (no lto)
329 SetupPnaclTranslatorX8664() {
330 SetupPnaclX8664Common
331 SUFFIX=pnacl_translator.x8664
335 #@ SetupPnaclTranslatorX8664Opt
336 #@ use pnacl x8664 translator (with lto)
337 SetupPnaclTranslatorX8664Opt() {
338 SetupPnaclX8664Common
339 SUFFIX=pnacl_translator.opt.x8664
343 #@ SetupPnaclTranslatorFastX8664Opt
344 #@ use pnacl x8664 translator fast mode (with lto)
345 SetupPnaclTranslatorFastX8664Opt() {
346 SetupPnaclX8664Common
347 SUFFIX=pnacl_translator_fast.opt.x8664
352 SetupPnaclTranslatorJITX8632Common() {
353 SetupSelLdr x86-32 "" "-S" "${RUNNABLE_LD_X8632} -- --library-path ${NNACL_TC}/x86_64-nacl/lib32 ${NACL_ROOT}/toolchain/pnacl_linux_x86/glibc/tools-sb/x8632/nonsrpc/bin/lli.x8632.nexe -asm-verbose=false -march=x86 -mcpu=pentium4 -mtriple=i686-none-nacl-gnu -jit-emit-debug=false -disable-lazy-compilation"
359 #@ SetupPnaclTranslatorJITX8632
360 #@ use pnacl x8632 JIT translator (no lto)
361 SetupPnaclTranslatorJITX8632() {
362 SetupPnaclTranslatorJITX8632Common
367 #@ SetupPnaclTranslatorJITX8632Opt
368 #@ use pnacl x8632 JIT translator
369 SetupPnaclTranslatorJITX8632Opt() {
370 SetupPnaclTranslatorJITX8632Common
371 SUFFIX=opt.stripped.pexe
374 SetupPnaclX8632Common() {
380 #@ use pnacl x86-32 compiler (no lto)
382 SetupPnaclX8632Common
387 #@ SetupPnaclX8632Opt
388 #@ use pnacl x86-32 compiler (with lto)
389 SetupPnaclX8632Opt() {
390 SetupPnaclX8632Common
391 SUFFIX=pnacl.opt.x8632
396 #@ SetupPnaclTranslatorX8632
397 #@ use pnacl x8632 translator (no lto)
398 SetupPnaclTranslatorX8632() {
399 SetupPnaclX8632Common
400 SUFFIX=pnacl_translator.x8632
404 #@ SetupPnaclTranslatorX8632Opt
405 #@ use pnacl x8632 translator (with lto)
406 SetupPnaclTranslatorX8632Opt() {
407 SetupPnaclX8632Common
408 SUFFIX=pnacl_translator.opt.x8632
412 #@ SetupPnaclTranslatorFastX8632Opt
413 #@ use pnacl x8632 translator fast mode (with lto)
414 SetupPnaclTranslatorFastX8632Opt() {
415 SetupPnaclX8632Common
416 SUFFIX=pnacl_translator_fast.opt.x8632
422 #@ use gcc cross compiler
424 PREFIX="${QEMU_TOOL}"
430 #@ use gcc cross compiler
432 PREFIX="${QEMU_TOOL}"
437 SetupPnaclArmCommon() {
438 SetupSelLdr arm "${QEMU_TOOL}" "-Q"
443 #@ use pnacl arm compiler (with lto) -- run with QEMU
451 #@ use pnacl arm compiler (no lto) -- run with QEMU
458 #@ SetupPnaclTranslatorArm
459 #@ use pnacl arm translator (no lto)
460 SetupPnaclTranslatorArm() {
462 SUFFIX=pnacl_translator.arm
466 #@ SetupPnaclTranslatorArmOpt
467 #@ use pnacl arm translator (with lto)
468 SetupPnaclTranslatorArmOpt() {
470 SUFFIX=pnacl_translator.opt.arm
474 #@ SetupPnaclTranslatorFastArmOpt
475 #@ use pnacl arm translator fast mode (with lto)
476 SetupPnaclTranslatorFastArmOpt() {
478 SUFFIX=pnacl_translator_fast.opt.arm
483 SetupPnaclArmCommonHW() {
488 #@ SetupPnaclArmOptHW
489 #@ use pnacl arm compiler (with lto) -- run on ARM hardware
490 SetupPnaclArmOptHW() {
491 SetupPnaclArmCommonHW
497 #@ use pnacl arm compiler (no lto) -- run on ARM hardware
499 SetupPnaclArmCommonHW
504 #@ SetupPnaclTranslatorArmHW
505 #@ use pnacl arm translator (no lto) -- run on ARM hardware
506 SetupPnaclTranslatorArmHW() {
507 SetupPnaclArmCommonHW
508 SUFFIX=pnacl_translator.hw.arm
512 #@ SetupPnaclTranslatorArmOptHW
513 #@ use pnacl arm translator (with lto) -- run on ARM hardware
514 SetupPnaclTranslatorArmOptHW() {
515 SetupPnaclArmCommonHW
516 SUFFIX=pnacl_translator.opt.hw.arm
520 #@ SetupPnaclTranslatorFastArmOptHW
521 #@ use pnacl arm translator fast mode (with lto) -- run on ARM hardware
522 SetupPnaclTranslatorFastArmOptHW() {
523 SetupPnaclArmCommonHW
524 SUFFIX=pnacl_translator_fast.opt.hw.arm
529 SubBanner "Config Info"
530 echo "benchmarks: $(GetBenchmarkList "$@")"
531 echo "script: $(GetInputSize "$@")"
532 echo "suffix ${SUFFIX}"
533 echo "verify ${VERIFY}"
534 echo "prefix ${PREFIX}"
538 ######################################################################
539 # Functions intended to be called
540 ######################################################################
542 #@ ------------------------------------------------------------
544 #@ ------------------------------------------------------------
549 #@ Show available benchmarks
551 if [[ $# -ge 1 ]]; then
552 if [[ ($1 == "ref") || ($1 == "train") ]]; then
557 if [[ ($# == 0) || ($1 == "all") ]] ; then
558 echo "${SPEC2K_BENCHMARKS[@]}"
565 #+ GetInputSize [train|ref]
567 #+ Picks input size for spec runs (train or ref)
569 if [[ $# -ge 1 ]]; then
572 echo "./run.train.sh"
581 echo ${SPEC2K_SCRIPT}
585 #+ CheckFileBuilt <depname> <file> -
587 #+ Check that a dependency is actually built.
591 if [[ ! -f "${filename}" ]] ; then
592 echo "You have not built ${depname} yet (${filename})!" 1>&2
598 #+ SetupSelLdr <arch> <prefix> <extra_flags> <preload>
600 #+ Set up PREFIX to run sel_ldr on <arch>.
601 #+ <prefix> precedes sel_ldr in the command.
602 #+ <extra_flags> are additional flags to sel_ldr.
603 #+ <preload> is used as the actual nexe to load, making the real nexe an arg.
607 local extra_flags="${3-}"
608 local preload="${4-}"
610 local staging="${SCONS_OUT}/opt-${SCONS_BUILD_PLATFORM}-${arch}/staging"
611 SEL_LDR="${staging}/sel_ldr"
612 SEL_LDR_BOOTSTRAP="${staging}/nacl_helper_bootstrap"
613 CheckFileBuilt "sel_ldr" "${SEL_LDR}"
614 CheckFileBuilt "bootstrap" "${SEL_LDR_BOOTSTRAP}"
616 IRT_IMAGE="${SCONS_OUT}/nacl_irt-${arch}/staging/irt_core.nexe"
617 CheckFileBuilt "IRT image" "${IRT_IMAGE}"
619 local validator_bin="ncval"
620 if [[ ${arch} = "arm" ]]; then
621 validator_bin="arm-ncval-core"
623 VALIDATOR="${staging}/${validator_bin}"
624 # We don't CheckFileBuilt for VALIDATOR because we currently don't build
627 TEMPLATE_DIGITS="XXXXXXXXXXXXXXXX"
628 PREFIX="${prefix} ${SEL_LDR_BOOTSTRAP} \
629 ${SEL_LDR} --r_debug=0x${TEMPLATE_DIGITS} \
630 --reserved_at_zero=0x${TEMPLATE_DIGITS} -B ${IRT_IMAGE} \
631 -a ${extra_flags} -f ${preload}"
635 SCONS_COMMON="./scons --mode=opt-host,nacl -j8 --verbose"
637 EnableX8664ZeroBasedSandbox() {
638 export NACL_ENABLE_INSECURE_ZERO_BASED_SANDBOX=1
643 local runtime_pieces=$2
644 local extra_flags="${3-}"
645 for platform in ${platforms} ; do
646 echo "build-runtime: scons ${runtime_pieces} [${platform}]"
648 ${SCONS_COMMON} ${extra_flags} platform=${platform} ${runtime_pieces})
655 for platform in ${platforms} ; do
656 echo "build-libs-nacl: scons build_lib [${platform}] $*"
658 ${SCONS_COMMON} platform=${platform} build_lib "$@")
664 # TODO(dschuff/jvoung): fix this circular dependency with the toolchain build
665 TOOLCHAIN_LABEL=pnacl_linux_x86 pnacl/build.sh sdk newlib
670 #@ CleanBenchmarks <benchmark>*
672 #@ this is a deep clean and you have to rerun PopulateFromSpecHarness
674 local list=$(GetBenchmarkList "$@")
676 for i in ${list} ; do
677 SubBanner "Cleaning: $i"
686 #@ BuildBenchmarks <do_timing> <setup> <benchmark>*
688 #@ Build all benchmarks according to the setup
689 #@ First arg should be either 0 (no timing) or 1 (run timing measure).
690 #@ Results are delivered to {execname}.compile_time
698 local list=$(GetBenchmarkList "$@")
700 for i in ${list} ; do
701 SubBanner "Building: $i"
703 # SPEC_COMPONENT is used for Asm.js builds in Makefile.common.
704 export SPEC_COMPONENT="${i}"
706 make ${MAKEOPTS} measureit=${timeit} \
707 PERF_LOGGER="${PERF_LOGGER}" \
708 REPETITIONS="${SPEC_COMPILE_REPETITIONS}" \
709 COMPILE_REPEATER="${COMPILE_REPEATER}" \
710 BUILD_PLATFORM=${BUILD_PLATFORM} \
711 SCONS_BUILD_PLATFORM=${SCONS_BUILD_PLATFORM} \
712 BUILD_ARCH=${BUILD_ARCH} \
713 PNACL_LIBMODE=${PNACL_LIBMODE} \
720 #@ TimedRunCmd <time_result_file> {actual_cmd }
722 #@ Run the command under time and dump time data to file.
726 /usr/bin/time -f "%U %S %e %C" --append -o "${target}" "$@"
730 #@ RunBenchmarks <setup> [ref|train] <benchmark>*
732 #@ Run all benchmarks according to the setup.
738 local list=$(GetBenchmarkList "$@")
739 local script=$(GetInputSize "$@")
741 for i in ${list} ; do
742 SubBanner "Benchmarking: $i"
744 target_file=./${i#*.}.${SUFFIX}
745 gnu_size ${target_file}
746 # SCRIPTNAME is needed by run_asmjs.sh so that it knows
747 # which version of the prepackaged files to use.
748 export SCRIPTNAME="${script}"
749 ${script} ${target_file}
756 #@ RunTimedBenchmarks <setup> [ref|train] <benchmark>*
758 #@ Run all benchmarks according to the setup.
759 #@ All timing related files are stored in {execname}.run_time
760 #@ Note that the VERIFY variable effects the timing!
761 RunTimedBenchmarks() {
765 local list=$(GetBenchmarkList "$@")
766 local script=$(GetInputSize "$@")
769 for i in ${list} ; do
770 SubBanner "Benchmarking: $i"
772 local benchname=${i#*.}
773 local target_file=./${benchname}.${SUFFIX}
774 local time_file=${target_file}.run_time
775 gnu_size ${target_file}
776 # SCRIPTNAME is needed by run_asmjs.sh so that it knows
777 # which version of the prepackaged files to use.
778 export SCRIPTNAME="${script}"
779 # Clear out the previous times.
781 echo "Running benchmark ${SPEC_RUN_REPETITIONS} times"
782 for ((i=0; i<${SPEC_RUN_REPETITIONS}; i++))
784 TimedRunCmd ${time_file} ${script} ${target_file}
786 # TODO(jvoung): split runtimes by arch as well
787 # i.e., pull "arch" out of SUFFIX and add to the "runtime" label.
788 "${PERF_LOGGER}" LogRealTime "${time_file}" "runtime" \
789 ${benchname} ${SUFFIX}
798 local list=$(GetBenchmarkList "$@")
800 SubBanner "Validating: $i"
802 local benchname=${i#*.}
803 local target_file=./${benchname}.${SUFFIX}
804 local time_file=${target_file}.validation_time
806 for ((i=0; i<${SPEC_RUN_REPETITIONS}; i++))
808 TimedRunCmd ${time_file} "${VALIDATOR}" ${target_file}
810 "${PERF_LOGGER}" LogRealTime "${time_file}" "validationtime" \
811 ${benchname} ${SUFFIX}
814 if [[ ${setup_func} =~ "Arm" ]]; then
815 TimedRunCmd llc.validation_time "${VALIDATOR}" "${ARM_LLC_NEXE}"
816 "${PERF_LOGGER}" LogRealTime llc.validation_time "validationtime" \
822 #@ BuildAndRunBenchmarks <setup> [ref|train] <benchmark>*
824 #@ Builds and run all benchmarks according to the setup
825 BuildAndRunBenchmarks() {
828 BuildBenchmarks 0 ${setup} "$@"
829 RunBenchmarks ${setup} "$@"
833 #@ TimedBuildAndRunBenchmarks <setup> [ref|train] <benchmark>*
835 #@ Builds and run all benchmarks according to the setup, using
836 #@ and records the time spent at each task..
837 #@ Results are saved in {execname}.compile_time and
838 #@ {execname}.run_time for each benchmark executable
839 #@ Note that the VERIFY variable effects the timing!
840 TimedBuildAndRunBenchmarks() {
843 BuildBenchmarks 1 ${setup} "$@"
844 RunTimedBenchmarks ${setup} "$@"
848 #@ PackageArmBinaries [usual var-args for RunBenchmarks]
850 #@ Archives ARM binaries built from a local QEMU run of spec
852 #@ Note: <setup> should be the QEMU setup (e.g., SetupPnaclArmOpt)
853 #@ Note: As with the other modes in this script, this script should be
854 #@ run from the directory of the script (not the native_client directory).
856 PackageArmBinaries() {
857 local BENCH_LIST=$(GetBenchmarkList "$@")
859 local UNZIPPED_TAR=$(basename ${TESTS_ARCHIVE} .gz)
861 # Switch to native_client directory (from tests/spec2k) so that
862 # when we extract, the builder will have a more natural directory layout.
864 # Carefully tar only the parts of the spec harness that we need.
866 find tests/spec2k -name '*.bc' -delete
867 find tests/spec2k -maxdepth 1 -type f -print |
868 xargs tar --no-recursion -cvf ${UNZIPPED_TAR}
869 tar -rvf ${UNZIPPED_TAR} tests/spec2k/bin
870 for i in ${BENCH_LIST} ; do
871 tar -rvf ${UNZIPPED_TAR} tests/spec2k/$i
873 gzip -f ${UNZIPPED_TAR}
878 #@ Unpack a packaged archive of ARM SPEC binaries. The archive is
879 #@ located in the nacl root directory, but the script is run from the spec dir.
880 UnpackArmBinaries() {
882 tar xvzf ${TESTS_ARCHIVE})
885 GetTestArchiveName() {
886 echo ${TESTS_ARCHIVE}
890 #@ PopulateFromSpecHarness <path> <benchmark>*
892 #@ populate a few essential directories (src, date) from
893 #@ the given spec2k harness
894 PopulateFromSpecHarness() {
897 cp -r ${harness}/bin .
898 local list=$(GetBenchmarkList "$@")
900 for i in ${list} ; do
901 SubBanner "Populating: $i"
902 # fix the dir with the same name inside spec harness
903 src=$(find -H ${harness} -name $i)
904 # copy relevant dirs over
907 cp -r ${src}/data ${src}/src $i
909 if [[ -e $i/diff ]] ; then
911 patch -d $i --verbose -p0 < $i/diff
919 #@ BuildPrerequisites <platform> <bitcode>
921 #@ Invoke scons to build some potentially missing components, e.g.
922 #@ sel_ldr, sel_universal, irt, some untrusted libraries.
923 #@ Those compoents should be present in the SDK but are not in the
924 #@ standard toolchain tarballs.
925 BuildPrerequisites() {
928 local extrabuild="${3-}"
929 local extra_flags="${4-}"
930 # Sel universal is only used for the pnacl sandboxed translator,
931 # but prepare it just in case.
932 # IRT is used both to run the tests and to run the pnacl sandboxed translator.
933 build-runtime "${platforms}" "sel_ldr sel_universal irt_core ${extrabuild}" \
935 if [ ${bitcode} == "bitcode" ] ; then
938 # libs may be unnecessary for the glibc build, but build it just in case.
939 build-libs-nacl "${platforms}"
944 #@ BuildPrerequisitesSetupBased <setup>
946 #@ Convenience wrapper for BuildPrerequisites
947 BuildPrerequisitesSetupBased() {
950 if [[ "$1" == SetupPnacl* ]] ; then
953 if [[ "$1" == Setup*Arm* ]] ; then
955 elif [[ "$1" == Setup*X8632* ]] ; then
957 elif [[ "$1" == Setup*X8664* ]] ; then
960 echo "Bad setup [$1]"
963 BuildPrerequisites "${platforms}" "${bitcode}"
965 ######################################################################
967 ######################################################################
969 [ $# = 0 ] && set -- help # Avoid reference to undefined $1.
971 if [ "$(type -t $1)" != "function" ]; then
973 echo "ERROR: unknown mode '$1'." >&2