1: #!/bin/bash
2:
3: # this builds dist/LC_math_editor.min.js using google closure compiler.
4: # It must be run in the math_editor directory.
5:
6: cd "$(dirname "$0")"
7: mkdir -p dist
8: tmp=$(mktemp)
9: cat <<% >$tmp
10: "use strict";
11: var LCMATH = function () {
12: %
13: cat src/*.js >>$tmp
14: cat <<% >>$tmp
15: return({
16: "Definitions": Definitions,
17: "ENode": ENode,
18: "Operator": Operator,
19: "ParseException": ParseException,
20: "Parser": Parser,
21: "initEditors": initEditors,
22: "updateMathSpanAndDiv": updateMathSpanAndDiv
23: });
24: }();
25: %
26:
27: # use the local application if Java is available
28: if hash java 2>/dev/null; then
29: java -jar lib/compiler.jar --language_in=ECMASCRIPT5_STRICT --compilation_level=SIMPLE_OPTIMIZATIONS $tmp >dist/LC_math_editor.min.js
30: exit 0
31: fi
32:
33: # otherwise use the web service with compressjs.sh
34: NEWFILE="c`date +"%d%m%y"`.js"
35: /bin/sh ./compressjs.sh -strict $tmp
36: mv "$NEWFILE" ./dist/LC_math_editor.min.js
37: rm -f $tmp
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>