Permalink
Browse files

update postprocess.js to take paths as args

  • Loading branch information...
postspectacular committed Aug 12, 2016
1 parent 0660f39 commit 16aa2392ad402a50ab3642630944edbb61364b3b
Showing with 8 additions and 5 deletions.
  1. +6 −3 compile
  2. +2 −2 postprocess.js
View
@@ -20,6 +20,7 @@ Usage:
-a : separate asm.js output
-c : enable Closure compiler step
-d : remove duplicate functions
-e : disable function export
-D SYM : add define
-h : show this help
-k : enable runtime checks
@@ -30,7 +31,7 @@ EOF
exit 1
}
while getopts acdhkmstD: opt; do
while getopts acdehkmstD: opt; do
case $opt in
s) CFLAGS="$CFLAGS -DCT_FEATURE_SSE -fslp-vectorize -msse2"
EMFLAGS="$EMFLAGS -s SIMD=1"
@@ -43,6 +44,8 @@ while getopts acdhkmstD: opt; do
# EMFLAGS="$EMFLAGS -s ELIMINATE_DUPLICATE_FUNCTIONS_PASSES=5"
EMFLAGS="$EMFLAGS -s ELIMINATE_DUPLICATE_FUNCTIONS_DUMP_EQUIVALENT_FUNCTIONS=1"
;;
e) CFLAGS="$CFLAGS -DCT_NO_EXPORT"
;;
k) CFLAGS="$CFLAGS -DCT_FEATURE_CHECKS"
;;
m) CFLAGS="$CFLAGS -DCT_FEATURE_CHECK_MEM"
@@ -82,8 +85,8 @@ time emcc $CFLAGS \
$TESTS
ls -la $OUT
echo "postprocessing..."
node postprocess.js
echo "postprocessing... $OUT -> $MIN"
node postprocess.js $OUT $MIN
ls -la $MIN
cp $OUT geom-cljs/resources/public/js/
cp $MIN geom-cljs/resources/public/js/
View
@@ -1,6 +1,6 @@
fs=require('fs');
src=fs.readFileSync('cthing.js','utf8');
src=fs.readFileSync(process.argv[2],'utf8');
src=src.replace(/_ct_\w+_\d+:[\w\$]+,?/g, '');
src=src.replace(/\w+\._ct_\w+_\d+\=\w+._ct_\w+_\d+;/g, '');
src=src.replace(/;\s{2,}/g,'\n');
fs.writeFileSync('cthing.min.js', src, 'utf8');
fs.writeFileSync(process.argv[3], src, 'utf8');

0 comments on commit 16aa239

Please sign in to comment.