|
|
@ -211,14 +211,31 @@ for i in \ |
|
|
|
done |
|
|
|
|
|
|
|
# Initjs code: built-in Ecmascript code snippets which are evaluated when |
|
|
|
# a new global context is created. UglifyJS is used to compact the source, |
|
|
|
# not to obfuscate it (although that happens as an unwanted side effect). |
|
|
|
# a new global context is created. UglifyJS or the closure compiler is |
|
|
|
# used to compact the source. Obfuscating the code is not a goal, although |
|
|
|
# that happens as an unwanted side effect. |
|
|
|
# |
|
|
|
# Closure compiler --compilation_level ADVANCED_OPTIMIZATIONS breaks some |
|
|
|
# of the existing code, so don't use it. |
|
|
|
|
|
|
|
cat \ |
|
|
|
src/duk_initjs.js \ |
|
|
|
cat src/duk_initjs.js \ |
|
|
|
| UglifyJS/bin/uglifyjs --ascii --no-dead-code --no-copyright \ |
|
|
|
> $DISTSRCSEP/duk_initjs_min.js.tmp |
|
|
|
cp $DISTSRCSEP/duk_initjs_min.js.tmp $DISTSRCSEP/duk_initjs_min.js |
|
|
|
> $DISTSRCSEP/duk_initjs_uglify.js.tmp |
|
|
|
java -jar compiler.jar \ |
|
|
|
--warning_level QUIET \ |
|
|
|
--language_in ECMASCRIPT5 \ |
|
|
|
--compilation_level SIMPLE_OPTIMIZATIONS \ |
|
|
|
src/duk_initjs.js \ |
|
|
|
> $DISTSRCSEP/duk_initjs_closure.js.tmp |
|
|
|
|
|
|
|
INITJS_ORIG=`wc -c < src/duk_initjs.js` |
|
|
|
INITJS_UGLIFY=`wc -c < $DISTSRCSEP/duk_initjs_uglify.js.tmp` |
|
|
|
INITJS_CLOSURE=`wc -c < $DISTSRCSEP/duk_initjs_closure.js.tmp` |
|
|
|
echo "Minified initjs size: original=$INITJS_ORIG, UglifyJS=$INITJS_UGLIFY, closure=$INITJS_CLOSURE" |
|
|
|
|
|
|
|
# choose which minifier to use |
|
|
|
#echo "Using UglifyJS minified version"; cp $DISTSRCSEP/duk_initjs_uglify.js.tmp $DISTSRCSEP/duk_initjs_min.js |
|
|
|
echo "Using closure minified version"; cp $DISTSRCSEP/duk_initjs_closure.js.tmp $DISTSRCSEP/duk_initjs_min.js |
|
|
|
|
|
|
|
# Autogenerated strings and built-in files |
|
|
|
# |
|
|
@ -234,7 +251,7 @@ python src/genbuildparams.py \ |
|
|
|
|
|
|
|
python src/genbuiltins.py \ |
|
|
|
--buildinfo=$DISTSRCSEP/buildparams.json.tmp \ |
|
|
|
--initjs-data=$DISTSRCSEP/duk_initjs_min.js.tmp \ |
|
|
|
--initjs-data=$DISTSRCSEP/duk_initjs_min.js \ |
|
|
|
--out-header=$DISTSRCSEP/duk_builtins.h \ |
|
|
|
--out-source=$DISTSRCSEP/duk_builtins.c \ |
|
|
|
|
|
|
|