Make building & installing the core components of Evergreen optional.
[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 OPENSRF_JSLIBS = "$(OPENSRF_LIBS)/javascript"
9 CHROME_LOCALES = $$(ls -1 chrome/locale)
10 SKIN_CSS = $$(ls -1 server/skin/*css | sed -e "s/.css/_custom.css/")
11
12 #------------------------------
13 # Build ILS XUL CLIENT/SERVER
14 #------------------------------
15
16 if BUILDILSCLIENT
17 OILSSERVER_INST = server-xul
18 endif
19
20 install-exec-local: $(OILSSERVER_INST)
21
22 build: build_dir chrome2remote localize_manifest generated custom_skins open-ils stamp 
23         @echo To test the staff client:
24         @echo "  cd build/"
25         @echo "  xulrunner application.ini"
26
27 build_dir:
28         @echo ' * Creating and populating build/ '
29         @mkdir -p build/
30         @cp -fR chrome build/
31         @cp -fR server build/
32         @cp -fR defaults build/
33         @cp -fR components build/
34         @cp application.ini build/
35         @cp -fR build/chrome/content/util/ build/server/
36         @cp -fR build/chrome/content/auth/ build/server/
37         @cp build/chrome/content/main/constants.js build/server/main/constants.js
38         @cp build/chrome/content/main/bindings.xml build/server/main/bindings.xml
39         @cp build/chrome/content/OpenILS/data.js build/server/OpenILS/data.js
40         @cp build/chrome/content/OpenILS/global_util.js build/server/OpenILS/global_util.js
41         @external/prune_dirs.sh build/
42
43 # Convert chrome to remote for server localization
44 chrome2remote:
45         @for loc in $(CHROME_LOCALES); do \
46                 cp -fr chrome/locale/$$loc build/server/locale/. ; \
47         done;
48
49 # Update the manifest for our installed locales
50 localize_manifest:
51         @for loc in $(CHROME_LOCALES) ; do \
52                 if [ "$$loc" != "en-US" ]; then ( echo "locale open_ils_staff_client $$loc locale/$$loc/" >> build/chrome/chrome.manifest ) ; fi; \
53         done;
54
55 stamp:
56         @/bin/date +"%Y%m%d.%H%M%S" > build/BUILD_ID
57         @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
58         @if [ -z "${STAFF_CLIENT_BUILD_ID}" ]; then ( echo "No Build ID for versioning" ; echo "none" > build/BUILD_ID ) ; fi
59         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then sed -i s/^Version=.\*/Version=${STAFF_CLIENT_BUILD_ID}/ build/application.ini ; fi
60         @if [ -n "${STAFF_CLIENT_BUILD_ID}" ]; then sed -i s/^BuildID=.\*/BuildID=${STAFF_CLIENT_BUILD_ID}/ build/application.ini ; fi
61         @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
62         @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
63         @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
64         @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
65         @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
66         @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
67
68 bundle:
69         @rm -f build/build.tar
70         @tar cf build.tar build/
71         @mv build.tar build/
72
73 generated:
74         @echo ' * Grabbing lang.dtd from the OPAC code '
75         @cp @top_srcdir@/Open-ILS/web/opac/locale/en-US/lang.dtd build/chrome/locale/en-US/
76
77 open-ils:
78         @echo ' * Grabbing more OPAC code and legacy code and custom code'
79         @cp @top_srcdir@/Open-ILS/web/opac/common/js/*.js build/chrome/content/OpenILS/util/
80         @cp $(OPENSRF_JSLIBS)/*.js build/chrome/content/OpenILS/util/
81         @external/prune_dirs.sh build/
82
83 custom_skins:
84         @for skin in $(SKIN_CSS); do \
85                 if [ ! -f "$$skin" ]; then ( touch build/"$$skin" ); fi \
86         done;
87
88 server-xul: build
89         @echo $@
90         mkdir -p $(WEBDIR)
91         mkdir -p $(WEBDIR)/xul/
92         @echo "BUILD_ID = $(STAFF_CLIENT_BUILD_ID)"
93         @echo "Copying xul into $(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
94         mkdir -p "$(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
95         cp -R @top_srcdir@/Open-ILS/xul/staff_client/build/server "${WEBDIR}/xul/${STAFF_CLIENT_BUILD_ID}/"