Rev 13124 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
13124 | georgesk | 1 | DESTDIR = |
2 | WIMS_VERSION = $(shell basename $$(pwd) | sed 's/wims-\([.0-9a-z]*\).*/\1/') |
||
3 | |||
4 | BINFILES = bin download localwims other README sessions tmp \ |
||
5 | lib log s2 |
||
6 | PHTML_BINFILES = bases fdl.txt nogif.html opl.html \ |
||
7 | webget.sites html interrupt.cgi msg \ |
||
8 | bin |
||
9 | INDEPFILES = gifs mathfonts scripts themes java |
||
10 | ADDBINDIRS = backup download/modules public_html/modules/contrib \ |
||
11 | public_html/w/texgif public_html/modules/data/images |
||
12 | DATE = $(shell date '+%Y-%m-%d') |
||
13 | |||
14 | SORRY_NO_JAR=Sorry, sourceless JAR files are removed |
||
15 | SORRY_NO_SWF=Sorry, sourceless SWF files are removed |
||
16 | |||
17 | all: all-arch all-indep |
||
18 | |||
19 | all-arch: wimsbuild |
||
20 | |||
21 | all-indep: javabuild |
||
22 | |||
23 | clean: |
||
24 | find wims -name "*.o" | xargs rm -f |
||
25 | rm -f wims/public_html/bases/sys/define.conf wims/src/configure |
||
26 | for d in wims/public_html/scripts/authors/jm.evers/js \ |
||
27 | wims/src/Misc/authors/jm.evers/applets; do \ |
||
28 | [ ! -f $$d/Makefile ] || make -C $$d clean; \ |
||
29 | done |
||
30 | rm -rf wims/public_html/gifs/themes/jalon/.DS_Store |
||
31 | for d in jalon wimsedu wimsedu1 wimsedu2; do \ |
||
32 | rm -rf wims/public_html/gifs/themes/$$d/.DS_Store; \ |
||
33 | rm -rf wims/public_html/gifs/themes/$$d/.svn; \ |
||
34 | done |
||
35 | rm -f wims/public_html/gifs/WIMSchem/*.png |
||
36 | rm -f wims/bin/wims_mathml |
||
37 | cd wims/src/Mathml; [ ! -f Makefile ] || make clean |
||
38 | rm -f wims/public_html/scripts/js/edit_area/reg_syntax/flydraw.js |
||
39 | #remove pre-compiled JAR files |
||
40 | rm -f wims/public_html/scripts/authors/jm.evers/applets/*.jar |
||
41 | rm -f wims/public_html/java/WIMSchem/WIMSchem.jar |
||
42 | rm -f wims/public_html/java/ThreeD/ThreeD.jar |
||
43 | rm -f wims/public_html/java/Clicktile/Clicktile.jar |
||
44 | rm -f wims/public_html/java/Lattice/Lattice.jar |
||
45 | rm -f wims/public_html/java/zirkel/zirkel.jar |
||
46 | rm -f wims/public_html/java/Input/input.jar |
||
47 | # clean java build zones which are not managed by Joke Evers |
||
48 | wd=$$(pwd); \ |
||
49 | for a in WIMSchem ThreeD Clicktile Lattice zirkel Input; do \ |
||
50 | cd wims/src/Misc/applets/$$a; \ |
||
51 | ant -v clean >/dev/null 2>&1; \ |
||
52 | cd $${wd}; \ |
||
53 | done |
||
54 | # completly clean wims subdirectory |
||
55 | [ ! -f wims/src/Makefile ] || $(MAKE) -C wims/src distclean |
||
56 | # removes obsoleted gd library and links |
||
57 | rm -rf wims/src/Flydraw/gd* |
||
58 | # remove file which was not uninstalled |
||
59 | rm -f wims/other/bin/canvasdraw |
||
60 | |||
61 | wimsbuild: |
||
62 | #builds executables for wims |
||
63 | $(MAKE) -C wims/src all-debianpkg |
||
64 | |||
65 | javabuild: jmEversApplets otherApplets |
||
66 | |||
67 | jmEversApplets: |
||
68 | $(MAKE) -C wims/src/Misc/authors/jm.evers/applets |
||
69 | |||
70 | otherApplets: |
||
71 | wd=$$(pwd); \ |
||
72 | for a in WIMSchem ThreeD Clicktile Lattice zirkel Input; do \ |
||
73 | cd wims/src/Misc/applets/$$a; \ |
||
74 | echo -n "compiling $$a.jar..."; \ |
||
75 | if ant -v >/dev/null 2>&1; then \ |
||
76 | echo " [done]."; \ |
||
77 | else \ |
||
78 | echo "[failed]."; \ |
||
79 | fi; \ |
||
80 | cd $${wd}; \ |
||
81 | done |
||
82 | |||
83 | JAVA_SHAREDIR = $(DESTDIR)/usr/share/wims/java |
||
84 | install-applets: |
||
85 | # Joke Evers' java files |
||
86 | make -C wims/src/Misc/authors/jm.evers/applets install DESTDIR=$(DESTDIR)/usr/share/wims/java/authors/jm.evers |
||
87 | # make symlinks in var/lib/wims |
||
88 | install -d $(DESTDIR)/var/lib/wims/public_html/scripts/authors/jm.evers/applets |
||
89 | for f in $(JAVA_SHAREDIR)/authors/jm.evers/*.jar; do \ |
||
90 | ln -s /usr/share/wims/java/authors/jm.evers/$$(basename $$f) $(DESTDIR)/var/lib/wims/public_html/scripts/authors/jm.evers/applets/; \ |
||
91 | done |
||
92 | # other java files |
||
93 | for a in WIMSchem ThreeD Clicktile Lattice zirkel Input; do \ |
||
94 | jarfile=$$(basename wims/src/Misc/applets/$$a/dist/*.jar); \ |
||
95 | cp wims/src/Misc/applets/$$a/dist/$${jarfile} $(JAVA_SHAREDIR); \ |
||
96 | mkdir -p $(DESTDIR)/var/lib/wims/public_html/java/$$a; \ |
||
97 | ln -s /usr/share/wims/java/$${jarfile} $(DESTDIR)/var/lib/wims/public_html/java/$$a/ ;\ |
||
98 | done |
||
99 | |||
100 | install-modules: |
||
101 | orig_dir=$$(pwd)/wims; \ |
||
102 | mkdir -p $(DESTDIR)/var/lib/wims/public_html; \ |
||
103 | cd $(DESTDIR)/var/lib/wims; \ |
||
104 | cp -Rd $${orig_dir}/public_html/modules public_html |
||
105 | # fix a few wrong executions flags for files begining by !exit |
||
106 | chmod -x $(DESTDIR)/var/lib/wims/public_html/modules/adm/light/getnew.sh |
||
107 | chmod -x $(DESTDIR)/var/lib/wims/public_html/modules/adm/light/getnewoef.sh |
||
108 | ## unnecessary copyright files |
||
109 | for f in $$(find $(DESTDIR)/var/lib/wims -name 'COPYING*' -o -name 'LICENSE'); do \ |
||
110 | grep -qE 'GENERAL PUBLIC LICENSE|LICENZA PUBBLICA GENERICA' $$f \ |
||
111 | && rm $$f; \ |
||
112 | done |
||
113 | |||
114 | install-apache-conf: |
||
115 | mkdir -p $(DESTDIR)/etc/apache2/conf-available |
||
116 | install -m 644 debian/wims.conf \ |
||
117 | $(DESTDIR)/etc/apache2/conf-available/wims.conf |
||
118 | |||
119 | install: install-arch install-indep |
||
120 | |||
121 | install-arch: install-flydraw adjust-wimshome install-apache-conf |
||
122 | # populate /var/lib/wims/public_html with PHTML_BINFILES |
||
123 | orig_dir=$$(pwd)/wims/public_html; \ |
||
124 | mkdir -p $(DESTDIR)/var/lib/wims/public_html; \ |
||
125 | cd $(DESTDIR)/var/lib/wims/public_html; \ |
||
126 | for f in $(PHTML_BINFILES); do \ |
||
127 | cp -Rd $${orig_dir}/$$f .; \ |
||
128 | done |
||
129 | # populate /var/lib/wims with binary files |
||
130 | orig_dir=$$(pwd)/wims; \ |
||
131 | mkdir -p $(DESTDIR)/var/lib/wims; \ |
||
132 | cd $(DESTDIR)/var/lib/wims; \ |
||
133 | for d in $(ADDBINDIRS); do \ |
||
134 | mkdir -p $$d; \ |
||
135 | done; \ |
||
136 | for f in $(BINFILES); do \ |
||
137 | cp -Rd $${orig_dir}/$$f .; \ |
||
138 | done; \ |
||
139 | cp $${orig_dir}/public_html/wims public_html; \ |
||
140 | ln -sf wims public_html/wims.cgi; \ |
||
141 | cp $${orig_dir}/src/Wimslogd/wimslogd bin/ |
||
142 | #remove source of java applets |
||
143 | find $(DESTDIR)/var/lib/wims/public_html/scripts/authors/ -name src | xargs rm -rf |
||
144 | # erase some data not relevant for the distribution, since they belong |
||
145 | # only to Gang XIAO, or are a static library (already linked) |
||
146 | rm -f $(DESTDIR)/var/lib/wims/lib/libwims.a |
||
147 | for f in $$(find $(DESTDIR)/var/lib/wims/log/classes/.connections/); do \ |
||
148 | mv $$f $$f.template; \ |
||
149 | done |
||
150 | ## erase unnecessary copyright files |
||
151 | for f in $$(find $(DESTDIR)/var/lib/wims -name 'COPYING' -o -name 'LICENSE'); do \ |
||
152 | grep -q 'GENERAL PUBLIC LICENSE' $$f && rm $$f; \ |
||
153 | done |
||
154 | # remove the file log/unsecure which is out of topic for debian |
||
155 | # installs |
||
156 | rm $(DESTDIR)/var/lib/wims/log/unsecure |
||
157 | # replace Gang's precompiled binaries |
||
158 | mkdir -p $(DESTDIR)/var/lib/wims/bin |
||
159 | for f in false true; do \ |
||
160 | ln -s /bin/$$f $(DESTDIR)/var/lib/wims/bin/; \ |
||
161 | done |
||
162 | # move architecture-dependent binaries to /usr/lib/wims |
||
163 | for d in other/bin; do \ |
||
164 | mkdir -p $(DESTDIR)/usr/lib/wims/$$d; \ |
||
165 | for f in $(DESTDIR)/var/lib/wims/$$d/*; do \ |
||
166 | if [ ! -L $$f ]; then \ |
||
167 | mv $$f $(DESTDIR)/usr/lib/wims/$$d; \ |
||
168 | ln -s /usr/lib/wims/$$d/$$(basename $$f) $$f; \ |
||
169 | fi; \ |
||
170 | done; \ |
||
171 | done |
||
172 | # remove useless commands |
||
173 | rm -f $(DESTDIR)/var/lib/wims/localwims |
||
174 | rm -f $(DESTDIR)/var/lib/wims/lib/libwims.a |
||
175 | # copy misc files |
||
176 | mkdir -p $(DESTDIR)/var/lib/wims/log |
||
177 | cp wims.conf $(DESTDIR)/var/lib/wims/log/wims.conf.distrib |
||
178 | mkdir -p $(DESTDIR)/var/lib/wims/src |
||
179 | for f in defaults.conf mathfonts mathfonts-synonyms; do \ |
||
180 | cp wims/src/$$f $(DESTDIR)/var/lib/wims/src; \ |
||
181 | done |
||
182 | ## exclude wimsd if it has been built, since this webserver may be |
||
183 | ## insecure. |
||
184 | rm -f $(DESTDIR)/var/lib/wims/bin/wimsd |
||
185 | # fix for using the default config with Gap |
||
186 | mkdir -p $(DESTDIR)/usr/bin |
||
187 | ln -s gap $(DESTDIR)/usr/bin/gap.sh |
||
188 | mkdir -p $(DESTDIR)/usr/share/man/man1 |
||
189 | ln -s gap.1.gz $(DESTDIR)/usr/share/man/man1/gap.sh.1.gz |
||
190 | # fix embedded javascript libraries |
||
191 | # create soft links to libraries |
||
192 | |||
193 | # move /var/lib/wims/bin to /usr/lib/wims/bin |
||
194 | mv $(DESTDIR)/var/lib/wims/bin $(DESTDIR)/usr/lib/wims |
||
195 | ln -s ../../../usr/lib/wims/bin $(DESTDIR)/var/lib/wims |
||
196 | |||
197 | # ensure executable flags for files in /bin directories |
||
198 | # except for dircptest, which must be sourced. |
||
199 | for d in $(DESTDIR)/var/lib/wims/public_html/bin \ |
||
200 | $(DESTDIR)/usr/lib/wims/bin \ |
||
201 | $(DESTDIR)/usr/lib/wims/other/bin; do \ |
||
202 | for f in $$d/*; do \ |
||
203 | [ "$$(basename $$f)" = dircptest ] || chmod +x $$f; \ |
||
204 | done; \ |
||
205 | done |
||
206 | ## fix an issue with the executable flag of tex..gif |
||
207 | ## which is removed by debhelper |
||
208 | b=$(DESTDIR)/var/lib/wims/public_html/bin; \ |
||
209 | mv $$b/tex..gif $$b/texGif; \ |
||
210 | ln -s texGif $$b/tex..gif; \ |
||
211 | chmod +x $$b/texGif |
||
212 | ############## end of install-arch ################ |
||
213 | |||
214 | install-indep: adjust-wimshome install-modules install-applets |
||
215 | # install INDEPFILES |
||
216 | orig_dir=$$(pwd)/wims/public_html; \ |
||
217 | mkdir -p $(DESTDIR)/var/lib/wims/public_html; \ |
||
218 | cd $(DESTDIR)/var/lib/wims/public_html; \ |
||
219 | for f in $(INDEPFILES); do \ |
||
220 | cp -Rd $${orig_dir}/$$f .; \ |
||
221 | done |
||
222 | # fixing some permissions for shell scripts |
||
223 | for f in $$(find $(DESTDIR)/var/lib/wims -type f -name '*.sh' -o -type f -name 'mkindex' -o -type f -name '*update' -o -type f -name 'mkclass' -o -type f -name 'Makeindex'); do \ |
||
224 | if (grep -q 'bin/sh' $$f); then chmod +x $$f; else chmod -x $$f; fi; \ |
||
225 | done |
||
226 | ## let a small message in places where sourceless SWF files were removed |
||
227 | for d in $(DESTDIR)/var/lib/wims/public_html/flash; \ |
||
228 | do \ |
||
229 | mkdir -p $$d; \ |
||
230 | echo $(SORRY_NO_SWF) > $$d/README; \ |
||
231 | done |
||
232 | ## let a small message in places where sourceless JAR files were removed |
||
233 | for d in $(DESTDIR)/var/lib/wims/public_html/java \ |
||
234 | $(DESTDIR)/var/lib/wims/public_html/java/geogebra \ |
||
235 | $(DESTDIR)/var/lib/wims/public_html/java/geogebra3 \ |
||
236 | $(DESTDIR)/var/lib/wims/public_html/java/jmol; \ |
||
237 | do \ |
||
238 | mkdir -p $$d; \ |
||
239 | echo $(SORRY_NO_JAR) > $$d/README; \ |
||
240 | done |
||
241 | # fix wrong permissions for non-executable files |
||
242 | for s in js gif css txt png ggb htm md; do \ |
||
243 | chmod -x $$(find $(DESTDIR)/var/lib/wims/public_html -type f -name "*.$$s"); \ |
||
244 | done |
||
245 | # distribute some theme files as templates |
||
246 | for f in themes/default/visitor.phtml \ |
||
247 | themes/default/supervisor.phtml \ |
||
248 | themes/standard/visitor.phtml \ |
||
249 | themes/standard/supervisor.phtml ; do \ |
||
250 | mv $(DESTDIR)/var/lib/wims/public_html/$$f $(DESTDIR)/var/lib/wims/public_html/$$f.tpl; \ |
||
251 | done |
||
252 | # embedded javascript library directories |
||
253 | for d in jquery ; do \ |
||
254 | rm -rf $(DESTDIR)/var/lib/wims/public_html/scripts/js/$$d; \ |
||
255 | ln -s /usr/share/javascript/$$d $(DESTDIR)/var/lib/wims/public_html/scripts/js/$$d; \ |
||
256 | done |
||
257 | # mootools javascript library |
||
258 | rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/mootools.js |
||
259 | ln -s /usr/share/javascript/mootools/mootools.js \ |
||
260 | $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/ |
||
261 | # prototype javascript library |
||
262 | rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/prototype.js |
||
263 | ln -s /usr/share/javascript/prototype/prototype.js \ |
||
264 | $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/ |
||
265 | # asciimathml javascript library |
||
266 | cd $(DESTDIR)/var/lib/wims/public_html/scripts/js; \ |
||
267 | for f in ASCIIMathML.js LaTeXMathML.js; do \ |
||
268 | rm -f $$f; \ |
||
269 | ln -s /usr/share/javascript/asciimathtml/$$f ./$$f; \ |
||
270 | done |
||
271 | ############################################################# |
||
272 | # jsxgraph javascript library |
||
273 | mkdir -p $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/ |
||
274 | for f in jsxgraphcore.js jsxgraph.css; do \ |
||
275 | ln -s /usr/share/javascript/jsxgraph/distrib/$$f $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/; \ |
||
276 | done |
||
277 | # geogebra-related jsxgraph library |
||
278 | ## GeogebraReader |
||
279 | rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeogebraReader.js |
||
280 | ln -s /usr/share/javascript/jsxgraph/distrib/geogebra.min.js $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeogebraReader.js |
||
281 | ## GeonextReader |
||
282 | rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeonextReader.js |
||
283 | ln -s /usr/share/javascript/jsxgraph/distrib/geonext.min.js $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeonextReader.js |
||
284 | ## normalize.css |
||
13570 | obado | 285 | rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/normalize.min.css |
13124 | georgesk | 286 | ln -s /usr/share/javascript/normalize.css/normalize.min.css \ |
13570 | obado | 287 | $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/ |
13124 | georgesk | 288 | ################################################### |
289 | # install third-party JS libraries with the scripts dfsg-scripts/* |
||
290 | ################################################### |
||
291 | # what-input javascript library |
||
292 | sh dfsg-scripts/what-input.sh --install $(DESTDIR) |
||
293 | # edit_area javascript library |
||
294 | sh dfsg-scripts/edit_area.sh --install $(DESTDIR) |
||
295 | |||
296 | install-flydraw: |
||
297 | mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/share/man/man1 |
||
298 | cp wims/src/Flydraw/flydraw $(DESTDIR)/usr/bin/flydraw |
||
299 | gzip -c9 debian/flydraw.1 > $(DESTDIR)/usr/share/man/man1/flydraw.1.gz |
||
300 | |||
301 | adjust-wimshome: |
||
302 | # adjust every existing .wimshome file |
||
303 | for f in $$(find wims -name .wimshome); do \ |
||
304 | echo /var/lib/wims > $$f; \ |
||
305 | done |
||
306 | |||
307 | doc: |
||
308 | |||
309 | .PHONY: all all-indep all-arch doc install install-indep install-arch \ |
||
310 | install-modules install-flydraw install-texgd compile \ |
||
311 | javabuild install-applets |