2013-10-19 07:06:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Compile and optimize JS code
|
|
|
|
# Copyright 2013 Lu Wang <coolwanglu@gmail.com>
|
|
|
|
|
|
|
|
# To enable closure-compiler, you need to install and configure JAVA environment
|
|
|
|
# Read 3rdparty/closure-compiler/README for details
|
|
|
|
|
|
|
|
|
|
|
|
BASEDIR=$(dirname $0)
|
|
|
|
OUTPUT="$BASEDIR/../pdf2htmlEX.js"
|
|
|
|
|
|
|
|
(echo "Compiling pdf2htmlEX.js with closure-compiler..." && \
|
|
|
|
tmpfile=$(mktemp 2>/dev/null) && \
|
2013-10-19 07:21:36 +00:00
|
|
|
java -jar "$BASEDIR/../../3rdparty/closure-compiler/compiler.jar" --compilation_level ADVANCED_OPTIMIZATIONS --process_jquery_primitives --externs "$BASEDIR/../jquery.js" --js "$BASEDIR/css_class_names.js" --js "$BASEDIR/viewer.js" > "$tmpfile" 2>/dev/null && \
|
2013-10-19 07:06:32 +00:00
|
|
|
cat "$BASEDIR/header.js" "$tmpfile" > "$OUTPUT" && \
|
|
|
|
rm -f -- "$tmpfile") || \
|
|
|
|
(echo "Failed. Fall back to naive concatenation" && \
|
2013-10-19 07:21:36 +00:00
|
|
|
cat "$BASEDIR/header.js" "$BASEDIR/css_class_names.js" "$BASEDIR/viewer.js" > "$OUTPUT")
|
2013-10-19 07:06:32 +00:00
|
|
|
|
|
|
|
|