]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/Makefile.am
google closure compiler: experiment with compressing staff client javascript
[Evergreen.git] / Open-ILS / xul / staff_client / Makefile.am
1 #---------------------------------------------------------
2 # Makefile.am for xul/staff_client
3 ## Process this file with automake to generate Makefile.in
4 #---------------------------------------------------------
5
6 export STAFF_CLIENT_BUILD_ID = $$(/bin/cat build/BUILD_ID)
7
8 # from http://closure-compiler.googlecode.com/files/compiler-latest.zip  FIXME: Autotools this?
9 export CLOSURE_COMPILER_JAR = ~/closure-compiler/compiler.jar
10
11 OPENSRF_JSLIBS = "$(OPENSRF_LIBS)/javascript"
12 CHROME_LOCALES = $$(ls -1 chrome/locale)
13 SKIN_CSS = $$(ls -1 server/skin/*css | sed -e "s/.css/_custom.css/")
14
15 #------------------------------
16 # Build ILS XUL CLIENT/SERVER
17 #------------------------------
18
19 if BUILDILSCLIENT
20 OILSSERVER_INST = server-xul
21 endif
22
23 install-exec-local: $(OILSSERVER_INST)
24
25 build: build_dir chrome2remote localize_manifest generated custom_skins open-ils stamp 
26         @echo To test the staff client:
27         @echo "  cd build/"
28         @echo "  xulrunner application.ini"
29
30 build_dir:
31         @echo ' * Creating and populating build/ '
32         @mkdir -p build/
33         @cp -fR chrome build/
34         @cp -fR server build/
35         @cp -fR defaults build/
36         @cp -fR components build/
37         @cp application.ini build/
38         @cp -fR build/chrome/content/util/ build/server/
39         @cp -fR build/chrome/content/auth/ build/server/
40         @cp build/chrome/content/main/constants.js build/server/main/constants.js
41         @cp build/chrome/content/main/bindings.xml build/server/main/bindings.xml
42         @cp build/chrome/content/OpenILS/data.js build/server/OpenILS/data.js
43         @cp build/chrome/content/OpenILS/global_util.js build/server/OpenILS/global_util.js
44         @external/prune_dirs.sh build/
45
46 # Convert chrome to remote for server localization
47 chrome2remote:
48         @for loc in $(CHROME_LOCALES); do \
49                 cp -fr chrome/locale/$$loc build/server/locale/. ; \
50         done;
51
52 # Update the manifest for our installed locales
53 localize_manifest:
54         @for loc in $(CHROME_LOCALES) ; do \
55                 if [ "$$loc" != "en-US" ]; then ( echo "locale open_ils_staff_client $$loc locale/$$loc/" >> build/chrome/chrome.manifest ) ; fi; \
56         done;
57
58 stamp:
59         @/bin/date +"%Y%m%d.%H%M%S" > build/BUILD_ID
60         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then ( echo "Stamping with Build ID: ${STAFF_CLIENT_BUILD_ID}" ; echo ${STAFF_CLIENT_BUILD_ID} > build/BUILD_ID ) ; fi
61         @if [ -z "${STAFF_CLIENT_BUILD_ID}" ]; then ( echo "No Build ID for versioning" ; echo "none" > build/BUILD_ID ) ; fi
62         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then sed -i s/^Version=.\*/Version=${STAFF_CLIENT_BUILD_ID}/ build/application.ini ; fi
63         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then sed -i s/^BuildID=.\*/BuildID=${STAFF_CLIENT_BUILD_ID}/ build/application.ini ; fi
64         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then find build/ -name '*.css' -exec sed -i s/xul\\\/server/xul\\\/${STAFF_CLIENT_BUILD_ID}\\\/server/g {} \; ; fi
65         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then find build/ -name '*.xul' -exec sed -i s/xul\\\/server/xul\\\/${STAFF_CLIENT_BUILD_ID}\\\/server/g {} \; ; fi
66         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then find build/ -name '*.html' -exec sed -i s/xul\\\/server/xul\\\/${STAFF_CLIENT_BUILD_ID}\\\/server/g {} \; ; fi
67         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then find build/ -name '*.xhtml' -exec sed -i s/xul\\\/server/xul\\\/${STAFF_CLIENT_BUILD_ID}\\\/server/g {} \; ; fi
68         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then find build/ -name '*.js' -exec sed -i s/xul\\\/server/xul\\\/${STAFF_CLIENT_BUILD_ID}\\\/server/g {} \; ; fi
69         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then find build/ -name '*.xml' -exec sed -i s/xul\\\/server/xul\\\/${STAFF_CLIENT_BUILD_ID}\\\/server/g {} \; ; fi
70
71 bell:
72         @perl -e 'print "Ringing bell..." . chr(7) . "\n";'
73
74 bundle:
75         @rm -f build/build.tar
76         @tar cf build.tar build/
77         @mv build.tar build/
78
79 generated:
80         @echo ' * Grabbing lang.dtd from the OPAC code '
81         @cp @top_srcdir@/Open-ILS/web/opac/locale/en-US/lang.dtd build/chrome/locale/en-US/
82
83 open-ils:
84         @echo ' * Grabbing more OPAC code and legacy code and custom code'
85         @cp @top_srcdir@/Open-ILS/web/opac/common/js/*.js build/chrome/content/OpenILS/util/
86         @cp $(OPENSRF_JSLIBS)/*.js build/chrome/content/OpenILS/util/
87         @external/prune_dirs.sh build/
88
89 custom_skins:
90         @for skin in $(SKIN_CSS); do \
91                 if [ ! -f "$$skin" ]; then ( touch build/"$$skin" ); fi \
92         done;
93
94 server-xul: build
95         @echo $@
96         mkdir -p $(WEBDIR)
97         mkdir -p $(WEBDIR)/xul/
98         @echo "BUILD_ID = $(STAFF_CLIENT_BUILD_ID)"
99         @echo "Copying xul into $(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
100         mkdir -p "$(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
101         cp -R @top_srcdir@/Open-ILS/xul/staff_client/build/server "${WEBDIR}/xul/${STAFF_CLIENT_BUILD_ID}/"
102
103 compress-javascript: build
104         @echo "Size of build/ before compression = " `du -sh build/`
105         @echo " * Running Google's Closure Compiler against javascript.  Errors in build/compression.err"
106         @external/closure_compiler.sh $(CLOSURE_COMPILER_JAR) 2>> build/compression.err
107         @echo `find build/ -name '*.js~' -size 0 -print | wc -l` compression failures
108         @find build/ -name '*.js~' -size 0 -exec rm {} \; # remove the output files for those that did not compile
109         @echo `find build/ -name '*.js~' -print | wc -l` compression successes
110         @find build/ -name '*.js~' -exec perl -e '$$a = "{}"; chop $$a; `mv $$a~ $$a`;' \;
111         @echo "Size of build/ (minus compression.err) after compression = " `du -sh --exclude compression.err build/`
112