compile javascript files with the closure compiler
authorMike Frysinger <vapier@gentoo.org>
Sun, 25 Aug 2013 02:39:35 +0000 (22:39 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 25 Aug 2013 02:39:35 +0000 (22:39 -0400)
.gitignore
Makefile [new file with mode: 0644]
makedist.sh

index c4c4ffc6aa41a89cc618a31d17f6d5924ddf2b10..731a8fe86ca2d10fc628e6cae91d54c0ef10a378 100644 (file)
@@ -1 +1,2 @@
 *.zip
+*.js.min
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..70ee24a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,13 @@
+CLOSURE = closure-compiler --language_in ECMASCRIPT5
+
+all:
+
+%.js.min: %.js
+       $(CLOSURE) $< > $@
+
+JS_FILES = $(shell grep '[.]js$$' manifest.files)
+js-min: $(JS_FILES:=.min)
+
+check: js-min
+
+.PHONY: all clean check js-min
index 76be81836e843477312d5604cbbe9977fb208d62..661f9f7c881747d61b71f61b909d13fae767b48b 100755 (executable)
@@ -30,7 +30,13 @@ while read line ; do
   [[ ${line} == */* ]] && mkdir -p "${P}/${line%/*}"
   ln "${line}" "${P}/${line}"
 done < <(sed 's:#.*::' manifest.files)
-cp manifest.json "${P}/"
+cp Makefile manifest.files manifest.json "${P}/"
+
+make -C "${P}" -j js-min
+while read line ; do
+       mv "${line}.min" "${line}"
+done < <(find "${P}" -name '*.js')
+rm "${P}"/{manifest.files,Makefile}
 
 sed -i \
   -e '/"version"/s:"[^"]*",:"'${PVR}'",:' \