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