]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/Makefile.am
Rough cut at providing the staff client as a Firefox extension.
[working/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 devbuild: build
26         @echo ' * Copying in developer preferences'
27         @cp external/developers.js build/defaults/preferences/
28
29 extension: build
30         @echo ' * Packaging as an XPI'
31         @perl -ne '@f = split /\s+/; if (/open_ils_staff_client/) { if (! /chrome:\/\/open_ils_staff_client/) { $$f[ scalar(@f) - 1 ] = "chrome/" . $$f[ scalar(@f) - 1 ]; }; print join(" ",@f) . "\n"; }' build/chrome/chrome.manifest > build/chrome.manifest
32         @(cd build/ && zip -q -r evergreen.xpi * -x server/\* -x defaults/preferences/standalone_xul_app.js)
33         @md5sum build/evergreen.xpi > build/evergreen.xpi.md5
34
35 build: build_dir chrome2remote localize_manifest generated custom_skins open-ils stamp 
36         @echo To test the staff client:
37         @echo "  cd build/"
38         @echo "  xulrunner application.ini"
39
40 build_dir:
41         @echo ' * Creating and populating build/ '
42         @rm -rf build/
43         @mkdir -p build/
44         @cp -fR chrome build/
45         @cp -fR server build/
46         @cp -fR defaults build/
47         @cp -fR components build/
48         @cp application.ini build/
49         @cp install.rdf build/
50         @cp -fR build/chrome/content/util/ build/server/
51         @cp -fR build/chrome/content/auth/ build/server/
52         @cp build/chrome/content/main/constants.js build/server/main/constants.js
53         @cp build/chrome/content/main/bindings.xml build/server/main/bindings.xml
54         @cp build/chrome/content/OpenILS/data.js build/server/OpenILS/data.js
55         @cp build/chrome/content/OpenILS/global_util.js build/server/OpenILS/global_util.js
56         @external/prune_dirs.sh build/
57
58 # Convert chrome to remote for server localization
59 chrome2remote:
60         @for loc in $(CHROME_LOCALES); do \
61                 cp -fr chrome/locale/$$loc build/server/locale/. ; \
62         done;
63
64 # Update the manifest for our installed locales
65 localize_manifest:
66         @for loc in $(CHROME_LOCALES) ; do \
67                 if [ "$$loc" != "en-US" ]; then ( echo "locale open_ils_staff_client $$loc locale/$$loc/" >> build/chrome/chrome.manifest ) ; fi; \
68         done;
69
70 stamp:
71         @/bin/date +"%Y%m%d.%H%M%S" > build/BUILD_ID
72         @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
73         @if [ -z "${STAFF_CLIENT_BUILD_ID}" ]; then ( echo "No Build ID for versioning" ; echo "none" > build/BUILD_ID ) ; fi
74         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then sed -i s/^Version=.\*/Version=${STAFF_CLIENT_BUILD_ID}/ build/application.ini ; fi
75         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then sed -i s/^BuildID=.\*/BuildID=${STAFF_CLIENT_BUILD_ID}/ build/application.ini ; fi
76         @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
77         @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
78         @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
79         @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
80         @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
81         @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
82
83 bell:
84         @perl -e 'print "Ringing bell..." . chr(7) . "\n";'
85
86 bundle:
87         @rm -f build/build.tar
88         @tar cf build.tar build/
89         @mv build.tar build/
90         @md5sum build/build.tar > build/build.tar.md5
91
92 generated:
93         @echo ' * Grabbing lang.dtd from the OPAC code '
94         @cp @top_srcdir@/Open-ILS/web/opac/locale/en-US/lang.dtd build/chrome/locale/en-US/
95
96 open-ils:
97         @echo ' * Grabbing more OPAC code and legacy code and custom code'
98         @cp @top_srcdir@/Open-ILS/web/opac/common/js/*.js build/chrome/content/OpenILS/util/
99         @cp $(OPENSRF_JSLIBS)/*.js build/chrome/content/OpenILS/util/
100         @external/prune_dirs.sh build/
101
102 custom_skins:
103         @for skin in $(SKIN_CSS); do \
104                 if [ ! -f "$$skin" ]; then ( touch build/"$$skin" ); fi \
105         done;
106
107 server-xul: build
108         @echo $@
109         mkdir -p $(WEBDIR)
110         mkdir -p $(WEBDIR)/xul/
111         @echo "BUILD_ID = $(STAFF_CLIENT_BUILD_ID)"
112         @echo "Copying xul into $(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
113         mkdir -p "$(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
114         cp -R @top_srcdir@/Open-ILS/xul/staff_client/build/server "${WEBDIR}/xul/${STAFF_CLIENT_BUILD_ID}/"
115
116 compress-javascript: build
117         @echo "Size of build/ before compression = " `du -sh build/`
118         @echo " * Running Google's Closure Compiler against javascript.  Errors in build/compression.err"
119         @external/closure_compiler.sh $(CLOSURE_COMPILER_JAR) 2>> build/compression.err
120         @echo `find build/ -name '*.js~' -size 0 -print | wc -l` compression failures
121         @find build/ -name '*.js~' -size 0 -exec rm {} \; # remove the output files for those that did not compile
122         @echo `find build/ -name '*.js~' -print | wc -l` compression successes
123         @find build/ -name '*.js~' -exec perl -e '$$a = "{}"; chop $$a; `mv $$a~ $$a`;' \;
124         @echo "Size of build/ (minus compression.err) after compression = " `du -sh --exclude compression.err build/`
125