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