File: Makefile.for.debian

package info (click to toggle)
wims 2%3A4.22~dfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 172,104 kB
  • sloc: xml: 366,651; javascript: 122,721; java: 61,466; ansic: 61,372; sh: 7,507; perl: 3,896; yacc: 3,174; lex: 1,804; cpp: 1,740; makefile: 1,307; lisp: 914; pascal: 593; php: 318; python: 191; asm: 7
file content (261 lines) | stat: -rw-r--r-- 10,632 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
DESTDIR =
WIMS_VERSION = $(shell basename $$(pwd) | sed 's/wims-\([.0-9a-z]*\).*/\1/')

BINFILES = bin download localwims other README sessions tmp \
	   lib log s2
PHTML_BINFILES = bases fdl.txt nogif.html opl.html \
		 webget.sites html interrupt.cgi msg \
		 bin
INDEPFILES = gifs mathfonts scripts themes
ADDBINDIRS = backup download/modules public_html/modules/contrib \
	     public_html/w/texgif public_html/modules/data/images
DATE = $(shell date '+%Y-%m-%d')

SORRY_NO_SWF=Sorry, sourceless SWF files are removed

all: all-arch all-indep

all-arch: wimsbuild

all-indep:
	echo "No longer building Java applets, which Wims does not use"

clean:
	find wims -name "*.o" | xargs rm -f
	rm -f wims/public_html/bases/sys/define.conf wims/src/configure
	for d in wims/public_html/scripts/authors/jm.evers/js; do \
	   [ ! -f $$d/Makefile ] || make -C $$d clean; \
	done
	rm -rf wims/public_html/gifs/themes/jalon/.DS_Store
	for d in jalon wimsedu wimsedu1 wimsedu2; do \
	  rm -rf wims/public_html/gifs/themes/$$d/.DS_Store; \
	  rm -rf wims/public_html/gifs/themes/$$d/.svn; \
	done
	rm -f wims/public_html/gifs/WIMSchem/*.png
	rm -f wims/bin/wims_mathml
	cd wims/src/Mathml; [ ! -f Makefile ] || make clean
	rm -f wims/public_html/scripts/js/edit_area/reg_syntax/flydraw.js
	# completly clean wims subdirectory
	[ ! -f wims/src/Makefile ] || $(MAKE) -C wims/src distclean
	# removes obsoleted gd library and links
	rm -rf wims/src/Flydraw/gd*
	# remove file which was not uninstalled
	rm -f wims/other/bin/canvasdraw

wimsbuild:
	#builds executables for wims
	$(MAKE) -C wims/src all-debianpkg

install-modules:
	orig_dir=$$(pwd)/wims; \
	mkdir -p $(DESTDIR)/var/lib/wims/public_html; \
	cd $(DESTDIR)/var/lib/wims; \
	cp -Rd $${orig_dir}/public_html/modules public_html
	# fix a few wrong executions flags for files begining by !exit
	chmod -x $(DESTDIR)/var/lib/wims/public_html/modules/adm/light/getnew.sh
	chmod -x $(DESTDIR)/var/lib/wims/public_html/modules/adm/light/getnewoef.sh
	## unnecessary copyright files
	for f in $$(find $(DESTDIR)/var/lib/wims -name 'COPYING*' -o -name 'LICENSE'); do \
	  grep -qE 'GENERAL PUBLIC LICENSE|LICENZA PUBBLICA GENERICA' $$f \
	    && rm $$f; \
	done

install-apache-conf:
	mkdir -p $(DESTDIR)/etc/apache2/conf-available
	install -m 644 debian/wims.conf \
	  $(DESTDIR)/etc/apache2/conf-available/wims.conf

install: install-arch install-indep

install-arch: install-flydraw adjust-wimshome install-apache-conf
	# populate /var/lib/wims/public_html with PHTML_BINFILES
	orig_dir=$$(pwd)/wims/public_html; \
	mkdir -p $(DESTDIR)/var/lib/wims/public_html; \
	cd $(DESTDIR)/var/lib/wims/public_html; \
	for f in $(PHTML_BINFILES); do \
	  cp -Rd $${orig_dir}/$$f .; \
	done
	# populate /var/lib/wims with binary files
	orig_dir=$$(pwd)/wims; \
	mkdir -p $(DESTDIR)/var/lib/wims; \
	cd $(DESTDIR)/var/lib/wims; \
	for d in $(ADDBINDIRS); do \
	  mkdir -p $$d; \
	done; \
	for f in $(BINFILES); do \
	  cp -Rd $${orig_dir}/$$f .; \
	done; \
	cp $${orig_dir}/public_html/wims public_html; \
	ln -sf wims public_html/wims.cgi; \
	cp $${orig_dir}/src/Wimslogd/wimslogd bin/
	# erase some data not relevant for the distribution, since they belong
	# only to Gang XIAO, or are a static library (already linked)
	rm -f $(DESTDIR)/var/lib/wims/lib/libwims.a
	for f in $$(find $(DESTDIR)/var/lib/wims/log/classes/.connections/); do \
	  mv $$f $$f.template; \
	done
	## erase unnecessary copyright files
	for f in $$(find $(DESTDIR)/var/lib/wims -name 'COPYING' -o -name 'LICENSE'); do \
	  grep -q 'GENERAL PUBLIC LICENSE' $$f && rm $$f; \
	done
	# remove the file log/unsecure which is out of topic for debian
	# installs
	rm  $(DESTDIR)/var/lib/wims/log/unsecure
	# replace Gang's precompiled binaries
	mkdir -p $(DESTDIR)/var/lib/wims/bin
	for f in false true; do \
	  ln -s /bin/$$f $(DESTDIR)/var/lib/wims/bin/; \
	done
	# move architecture-dependent binaries to /usr/lib/wims
	for d in other/bin; do \
	  mkdir -p $(DESTDIR)/usr/lib/wims/$$d; \
	  for f in  $(DESTDIR)/var/lib/wims/$$d/*; do \
	    if [ ! -L $$f ]; then \
	      mv $$f $(DESTDIR)/usr/lib/wims/$$d; \
	      ln -s /usr/lib/wims/$$d/$$(basename $$f) $$f; \
	    fi; \
	  done; \
	done
	# remove useless commands
	rm -f $(DESTDIR)/var/lib/wims/localwims
	rm -f $(DESTDIR)/var/lib/wims/lib/libwims.a
	# copy misc files
	mkdir -p $(DESTDIR)/var/lib/wims/log
	cp wims.conf $(DESTDIR)/var/lib/wims/log/wims.conf.distrib
	mkdir -p $(DESTDIR)/var/lib/wims/src
	for f in defaults.conf mathfonts mathfonts-synonyms; do \
	  cp wims/src/$$f $(DESTDIR)/var/lib/wims/src; \
	done
	## exclude wimsd if it has been built, since this webserver may be
	## insecure.
	rm -f $(DESTDIR)/var/lib/wims/bin/wimsd
	# fix for using the default config with Gap
	mkdir -p $(DESTDIR)/usr/bin
	ln -s gap $(DESTDIR)/usr/bin/gap.sh
	mkdir -p $(DESTDIR)/usr/share/man/man1
	ln -s gap.1.gz $(DESTDIR)/usr/share/man/man1/gap.sh.1.gz
	# fix embedded javascript libraries
	# create soft links to libraries

	# move /var/lib/wims/bin to /usr/lib/wims/bin
	mv $(DESTDIR)/var/lib/wims/bin $(DESTDIR)/usr/lib/wims
	ln -s ../../../usr/lib/wims/bin $(DESTDIR)/var/lib/wims

	# ensure executable flags for files in /bin directories
	# except for dircptest, which must be sourced.
	for d in $(DESTDIR)/var/lib/wims/public_html/bin \
		 $(DESTDIR)/usr/lib/wims/bin \
		 $(DESTDIR)/usr/lib/wims/other/bin; do  \
	  for f in $$d/*; do \
	    [ "$$(basename $$f)" = dircptest ] || chmod +x $$f; \
	  done; \
	done
	## fix an issue with the executable flag of tex..gif
	## which is removed by debhelper
	b=$(DESTDIR)/var/lib/wims/public_html/bin; \
	  mv $$b/tex..gif $$b/texGif; \
	  ln -s texGif $$b/tex..gif; \
	  chmod +x $$b/texGif
	############## end of install-arch ################

install-indep: adjust-wimshome install-modules
	# install INDEPFILES
	orig_dir=$$(pwd)/wims/public_html; \
	mkdir -p $(DESTDIR)/var/lib/wims/public_html; \
	cd $(DESTDIR)/var/lib/wims/public_html; \
	for f in $(INDEPFILES); do \
	  cp -Rd $${orig_dir}/$$f .; \
	done
	# fixing some permissions for shell scripts
	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 \
	  if (grep -q 'bin/sh' $$f); then chmod +x $$f; else chmod -x $$f; fi; \
	done
	## let a small message in places where sourceless SWF files were removed
	for d in $(DESTDIR)/var/lib/wims/public_html/flash; \
	do \
	  mkdir -p $$d; \
	  echo $(SORRY_NO_SWF) > $$d/README; \
	done
	# fix wrong permissions for non-executable files
	for s in js gif css txt png ggb htm md; do \
	  chmod -x $$(find $(DESTDIR)/var/lib/wims/public_html -type f -name "*.$$s"); \
	done
	# distribute some theme files as templates
	for f in themes/default/visitor.phtml \
	    themes/default/supervisor.phtml \
	    themes/standard/visitor.phtml \
	    themes/standard/supervisor.phtml ; do \
	  mv $(DESTDIR)/var/lib/wims/public_html/$$f $(DESTDIR)/var/lib/wims/public_html/$$f.tpl; \
	done
	# embedded javascript library directories
	for d in jquery ; do \
	  rm -rf $(DESTDIR)/var/lib/wims/public_html/scripts/js/$$d; \
	  ln -s /usr/share/javascript/$$d $(DESTDIR)/var/lib/wims/public_html/scripts/js/$$d; \
	done
	# jquery.min.js and jquery.slim.min.js in external JS area
	mkdir -p $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/jquery
	ln -s /usr/share/javascript/jquery/jquery.min.js \
	  $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/jquery/
	# jquery.min.js is replacing jquery.slim.min.js: it should not harm
	ln -s jquery.min.js \
	  $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/jquery/jquery.slim.min.js
	# jquery-ui in external JS area
	JQUI_DIR=$(DESTDIR)/var/lib/wims/public_html/scripts/js/external/jquery-ui; \
	mkdir -p $${JQUI_DIR}/themes/smoothness; \
	ln -s /usr/share/javascript/jquery-ui/jquery-ui.min.js $${JQUI_DIR}/; \
	ln -s /usr/share/javascript/jquery-ui-themes/smoothness/jquery-ui.min.css $${JQUI_DIR}/themes/smoothness/
	# mootools javascript library
	rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/mootools.js
	ln -s /usr/share/javascript/mootools/mootools.js \
	      $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/
	# prototype javascript library
	rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/prototype.js
	ln -s /usr/share/javascript/prototype/prototype.js \
	      $(DESTDIR)/var/lib/wims/public_html/scripts/js/editor/scripts_1/
	# asciimathml javascript library
	cd $(DESTDIR)/var/lib/wims/public_html/scripts/js; \
	for f in ASCIIMathML.js LaTeXMathML.js; do \
	  rm -f $$f; \
	  ln -s /usr/share/javascript/asciimathtml/$$f ./$$f; \
	done
	#############################################################
	# jsxgraph javascript library
	mkdir -p $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/
	for f in jsxgraphcore.js jsxgraph.css; do \
	  ln -s /usr/share/javascript/jsxgraph/distrib/$$f $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/; \
	done
	# geogebra-related jsxgraph library
	## GeogebraReader
	rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeogebraReader.js
	ln -s /usr/share/javascript/jsxgraph/distrib/geogebra.min.js $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeogebraReader.js
	## GeonextReader
	rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeonextReader.js
	ln -s /usr/share/javascript/jsxgraph/distrib/geonext.min.js $(DESTDIR)/var/lib/wims/public_html/scripts/js/jsxgraph/GeonextReader.js
	## normalize.css
	rm -f $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/normalize.min.css
	ln -s /usr/share/javascript/normalize.css/normalize.min.css \
	  $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/
	###################################################
	# install third-party JS libraries with the scripts dfsg-scripts/*
	###################################################
	# what-input javascript library
	sh dfsg-scripts/what-input.sh --install $(DESTDIR)
	# edit_area javascript library
	sh dfsg-scripts/edit_area.sh --install $(DESTDIR)
	# for ckeditor, the debian package is sufficient, so make a symlink
	ln -s /usr/share/javascript/ckeditor $(DESTDIR)/var/lib/wims/public_html/scripts/js/external/

install-flydraw:
	mkdir -p $(DESTDIR)/usr/bin
	cp wims/src/Flydraw/flydraw $(DESTDIR)/usr/bin/flydraw

adjust-wimshome:
	# adjust every existing .wimshome file
	for f in $$(find wims -name .wimshome); do \
	  echo /var/lib/wims > $$f; \
	done

doc:

.PHONY: all all-indep all-arch doc install install-indep install-arch \
	install-modules install-flydraw install-texgd compile