Remove sed from post-build code, due to portability issues between GNU and BSD versions.
authorawgy <josh.varner@gmail.com>
Sat, 12 Feb 2011 02:35:41 +0000 (03:35 +0100)
committerAnton M <obhvsbypqghgc@gmail.com>
Sat, 12 Feb 2011 12:53:04 +0000 (13:53 +0100)
Follow up to ba43d37394b6018779d9a668c548e11579cd424a which apparently
didn't fix the problem completly on Mac OS X.

Makefile
build/post-compile.js [new file with mode: 0644]

index 48a885d..bf41bcc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ DIST_DIR = ${PREFIX}/dist
 
 JS_ENGINE ?= `which node nodejs`
 COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
+POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
 
 BASE_FILES = ${SRC_DIR}/core.js\
        ${SRC_DIR}/support.js\
@@ -106,8 +107,8 @@ ${JQ_MIN}: jquery
        @@if test ! -z ${JS_ENGINE}; then \
                echo "Minifying jQuery" ${JQ_MIN}; \
                ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
-               sed '$ s#^\( \*/\)\(.\+\)#\1\n\2;#' ${JQ_MIN}.tmp > ${JQ_MIN}; \
-               rm -rf ${JQ_MIN}.tmp; \
+               ${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \
+               rm -f ${JQ_MIN}.tmp; \
        else \
                echo "You must have NodeJS installed in order to minify jQuery."; \
        fi
diff --git a/build/post-compile.js b/build/post-compile.js
new file mode 100644 (file)
index 0000000..4bcafe8
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+
+var print = require("sys").print,
+       src = require("fs").readFileSync(process.argv[2], "utf8");
+
+// Previously done in sed but reimplemented here due to portability issues
+print(src.replace(/^(\s*\*\/)(.+)/m, "$1\n$2;"));