forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.webui
396 lines (314 loc) · 12 KB
/
Makefile.webui
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#
# Tvheadend WEBUI interface
# Copyright (C) 2015 Jaroslav Kysela
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Configuration
#
IAM=$(lastword $(MAKEFILE_LIST))
WEBDIR ?= src/webui
LANGUAGES ?= bg cs da de en_US en_GB es et fa fi fr he hr hu it lv nl pl pt ru sv uk
ROOTPATH = static
ifneq ($(WEBUI),)
TOPDIR=$(dir $(IAM))
include $(TOPDIR)/.config.mk
EXTJSPATH = $(ROOTPATH)/extjs
CSS_PY = PYTHONIOENCODING=utf-8 $(PYTHON) support/css.py
RUN_JS = PYTHONIOENCODING=utf-8 $(PYTHON) vendor/rjsmin-1.0.10/rjsmin.py
RUN_CSS = PYTHONIOENCODING=utf-8 $(PYTHON) vendor/rcssmin-1.0.5/rcssmin.py
GZIPCMD += -n
XGETTEXT2 ?= $(XGETTEXT) --language=JavaScript --from-code=utf-8 --add-comments=/ -k_ -kN_ -s
MSGMERGE ?= msgmerge
POJS_PY = PYTHONIOENCODING=utf-8 $(PYTHON) support/pojs.py
ifeq ($(WEBUI),std)
DEBUG =
else
DEBUG = -debug
endif
JAVASCRIPT =
JAVASCRIPT2 =
JAVASCRIPT_TV =
CSS_INIT =
CSS_DONE =
CSS_BLUE =
CSS_GRAY =
CSS_ACCESS =
CSS_TV =
#
# base extjs files
#
JAVASCRIPT += $(EXTJSPATH)/adapter/ext/ext-base$(DEBUG).js
JAVASCRIPT += $(EXTJSPATH)/ext-all$(DEBUG).js
#
# CSS
#
CSS_INIT += $(EXTJSPATH)/resources/css/ext-all-notheme.css
CSS_DONE += $(ROOTPATH)/livegrid/resources/css/ext-ux-livegrid.css
CSS_DONE += $(EXTJSPATH)/examples/ux/gridfilters/css/GridFilters.css
CSS_DONE += $(EXTJSPATH)/examples/ux/gridfilters/css/RangeMenu.css
CSS_DONE += $(EXTJSPATH)/examples/ux/css/Spinner.css
CSS_DONE += static/xcheckbox/xcheckbox.css
CSS_DONE += static/app/ext.css
CSS_BLUE += $(EXTJSPATH)/resources/css/xtheme-blue.css
CSS_BLUE2 += static/app/ext-blue.css
CSS_GRAY += $(EXTJSPATH)/resources/css/xtheme-gray.css
CSS_GRAY2 += static/app/ext-gray.css
CSS_ACCESS += $(EXTJSPATH)/resources/css/xtheme-access.css
CSS_ACCESS2+= static/app/ext-access.css
#
# extjs extensions
#
MARKED = $(ROOTPATH)/app/marked.js
JAVASCRIPT += $(ROOTPATH)/app/i18n.js
JAVASCRIPT += $(ROOTPATH)/app/extensions.js
JAVASCRIPT += $(MARKED)
JAVASCRIPT += $(ROOTPATH)/livegrid/livegrid-all.js
JAVASCRIPT += $(ROOTPATH)/lovcombo/lovcombo-all.js
JAVASCRIPT += $(ROOTPATH)/multiselect/multiselect.js
JAVASCRIPT += $(ROOTPATH)/multiselect/ddview.js
JAVASCRIPT += $(ROOTPATH)/xcheckbox/xcheckbox.js
JAVASCRIPT += $(ROOTPATH)/checkcolumn/CheckColumn.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/GridFilters.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/Filter.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/BooleanFilter.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/DateFilter.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/ListFilter.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/NumericFilter.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/filter/StringFilter.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/menu/ListMenu.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/gridfilters/menu/RangeMenu.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/Spinner.js
JAVASCRIPT += $(EXTJSPATH)/examples/ux/SpinnerField.js
JAVASCRIPT += $(ROOTPATH)/app/i18n-post.js
#
# app itself
#
JAVASCRIPT += $(ROOTPATH)/app/namespace.js
JAVASCRIPT += $(ROOTPATH)/smoothie.js
JAVASCRIPT += $(ROOTPATH)/app/comet.js
JAVASCRIPT += $(ROOTPATH)/app/cteditor.js
JAVASCRIPT += $(ROOTPATH)/app/acleditor.js
CACLIENT-$(CONFIG_CWC) = yes
CACLIENT-$(CONFIG_CAPMT) = yes
ifeq ($(CACLIENT-yes), yes)
JAVASCRIPT += $(ROOTPATH)/app/caclient.js
endif
JAVASCRIPT += $(ROOTPATH)/app/tvadapters.js
JAVASCRIPT += $(ROOTPATH)/app/idnode.js
JAVASCRIPT += $(ROOTPATH)/app/esfilter.js
ifeq ($(CONFIG_MPEGTS), yes)
JAVASCRIPT += $(ROOTPATH)/app/mpegts.js
endif
ifeq ($(CONFIG_TIMESHIFT), yes)
JAVASCRIPT += $(ROOTPATH)/app/timeshift.js
endif
JAVASCRIPT += $(ROOTPATH)/app/chconf.js
JAVASCRIPT += $(ROOTPATH)/app/epg.js
JAVASCRIPT += $(ROOTPATH)/app/dvr.js
JAVASCRIPT += $(ROOTPATH)/app/epggrab.js
JAVASCRIPT += $(ROOTPATH)/app/config.js
JAVASCRIPT += $(ROOTPATH)/app/tvhlog.js
JAVASCRIPT += $(ROOTPATH)/app/status.js
JAVASCRIPT += $(ROOTPATH)/app/wizard.js
JAVASCRIPT += $(ROOTPATH)/tv.js
JAVASCRIPT += $(ROOTPATH)/app/servicemapper.js
JAVASCRIPT += $(ROOTPATH)/app/tvheadend.js
#
# tv
#
CSS_TV += $(ROOTPATH)/tv.css
JAVASCRIPT_TV += $(EXTJSPATH)/adapter/ext/ext-base$(DEBUG).js
JAVASCRIPT_TV += $(EXTJSPATH)/ext-all$(DEBUG).js
JAVASCRIPT_TV += $(ROOTPATH)/app/i18n.js
JAVASCRIPT_TV += $(ROOTPATH)/tv.js
#
# real source paths
#
JAVASCRIPT_SRC = $(foreach f,$(JAVASCRIPT),$(WEBDIR)/$(f))
CSS_BLUE_SRC = $(foreach f,$(CSS_INIT) $(CSS_BLUE) $(CSS_DONE) $(CSS_BLUE2),$(WEBDIR)/$(f))
CSS_GRAY_SRC = $(foreach f,$(CSS_INIT) $(CSS_GRAY) $(CSS_DONE) $(CSS_GRAY2),$(WEBDIR)/$(f))
CSS_ACCESS_SRC = $(foreach f,$(CSS_INIT) $(CSS_ACCESS) $(CSS_DONE) $(CSS_ACCESS2),$(WEBDIR)/$(f))
CSS_SRC = $(CSS_BLUE_SRC) $(CSS_GRAY_SRC) $(CSS_ACCESS_SRC)
JAVASCRIPT_TV_SRC = $(foreach f,$(JAVASCRIPT_TV),$(WEBDIR)/$(f))
CSS_TV_SRC = $(foreach f,$(CSS_TV),$(WEBDIR)/$(f))
#
# Internationalization
#
PO-FILES = $(foreach f,$(LANGUAGES),intl/js/tvheadend.js.$(f).po)
JSI-FILES = $(foreach f,$(LANGUAGES),src/webui/static/intl/tvh.$(f).js.gz)
endif # WEBUI defined
ifndef V
VV = @
endif
define GO_JS
$(VV)$(CSS_PY) --in="$^" utf-check
$(VV)cat $^ > $@.tmp
$(VV)$(RUN_JS) < $@.tmp > $@.tmp2
@stat --printf="%-35n %7s\n" $@.tmp $@.tmp2
$(VV)$(GZIPCMD) -c $@.tmp2 > $@.tmp
@rm $@.tmp2
@mv $@.tmp $@
@stat --printf="%-35n %7s\n" $@
endef
define GO_CSS
$(VV)$(CSS_PY) --in="$^" utf-check
$(VV)$(CSS_PY) --in="$^" > $@.tmp
$(VV)$(RUN_CSS) < $@.tmp > $@.tmp2
@stat --printf="%-35n %7s\n" $@.tmp $@.tmp2
$(VV)$(GZIPCMD) -c $@.tmp2 > $@.tmp
@rm $@.tmp2
@mv $@.tmp $@
@stat --printf="%-35n %7s\n" $@
endef
define merge-po
@if ! test -r "$(1)"; then \
sed -e 's/Content-Type: text\/plain; charset=CHARSET/Content-Type: text\/plain; charset=utf-8/' < "$(2)" > "$(1).new"; \
else \
$(MSGMERGE) -o $(1).new $(1) $(2); \
fi
@mv $(1).new $(1)
endef
define go-po
@printf "Building $(1)\n"
@mkdir -p $(dir $(1))
$(VV)$(POJS_PY) --in="$(2)" > $(1).new
@echo "tvh_locale_lang = '$(subst .,,$(suffix $(basename $(2))))';" >> $(1).new
$(VV)$(GZIPCMD) -c $(1).new > $@.new2
@rm $(1).new
@mv $(1).new2 $(1)
endef
all:
$(MAKE) -f $(IAM) WEBUI=std compile-std
$(MAKE) -f $(IAM) WEBUI=debug compile-debug
$(WEBDIR)/extjs-std.c: $(JAVASCRIPT_SRC) $(CSS_SRC)
$(VV)printf 'extjs_lcss(hq, "redir/theme.css");\n' > $@
$(VV)printf 'extjs_load(hq, "redir/locale.js");\n' >> $@
$(VV)printf 'extjs_load(hq, "static/tvh.js.gz");\n' >> $@
$(WEBDIR)/extjs-debug.c: $(JAVASCRIPT_SRC) $(CSS_SRC)
$(VV)printf '$(foreach f,$(CSS_INIT),extjs_lcss(hq, "$(f)");\n)' > $@
$(VV)printf 'extjs_lcss(hq, "redir/theme.debug.css");\n' >> $@
$(VV)printf '$(foreach f,$(CSS_DONE),extjs_lcss(hq, "$(f)");\n)' >> $@
$(VV)printf 'extjs_lcss(hq, "redir/theme.app.debug.css");\n' >> $@
$(VV)printf 'extjs_load(hq, "redir/locale.js");\n' >> $@
$(VV)printf '$(foreach f,$(JAVASCRIPT),extjs_load(hq, "$(f)");\n)' >> $@
$(WEBDIR)/extjs-tv-std.c: $(JAVASCRIPT_TV_SRC) $(CSS_TV_SRC)
$(VV)printf 'extjs_lcss(hq, "static/tvh-tv.css.gz");\n' > $@
$(VV)printf 'extjs_load(hq, "redir/locale.js");\n' >> $@
$(VV)printf 'extjs_load(hq, "static/tvh-tv.js.gz");\n' >> $@
$(WEBDIR)/extjs-tv-debug.c: $(JAVASCRIPT_TV_SRC) $(CSS_TV_SRC)
$(VV)printf '$(foreach f,$(CSS_TV),extjs_lcss(hq, "$(f)");\n)' > $@
$(VV)printf 'extjs_load(hq, "redir/locale.js");\n' >> $@
$(VV)printf '$(foreach f,$(JAVASCRIPT_TV),extjs_load(hq, "$(f)");\n)' >> $@
$(WEBDIR)/$(ROOTPATH)/tvh.js.gz: $(JAVASCRIPT_SRC)
$(call GO_JS)
$(WEBDIR)/$(ROOTPATH)/tvh.blue.css.gz: $(CSS_BLUE_SRC)
$(call GO_CSS)
$(WEBDIR)/$(ROOTPATH)/tvh.gray.css.gz: $(CSS_GRAY_SRC)
$(call GO_CSS)
$(WEBDIR)/$(ROOTPATH)/tvh.access.css.gz: $(CSS_ACCESS_SRC)
$(call GO_CSS)
$(WEBDIR)/$(ROOTPATH)/tvh-tv.js.gz: $(JAVASCRIPT_TV_SRC)
$(call GO_JS)
$(WEBDIR)/$(ROOTPATH)/tvh-tv.css.gz: $(CSS_TV_SRC)
$(call GO_CSS)
.PHONY: compile-std
compile-std: $(WEBDIR)/$(ROOTPATH)/tvh.js.gz $(WEBDIR)/$(ROOTPATH)/tvh.blue.css.gz \
$(WEBDIR)/$(ROOTPATH)/tvh.gray.css.gz $(WEBDIR)/$(ROOTPATH)/tvh.access.css.gz \
$(WEBDIR)/$(ROOTPATH)/tvh-tv.js.gz $(WEBDIR)/$(ROOTPATH)/tvh-tv.css.gz \
$(WEBDIR)/extjs-std.c $(WEBDIR)/extjs-tv-std.c $(JSI-FILES)
@echo "WEBUI std finished"
.PHONY: compile-debug
compile-debug: $(WEBDIR)/extjs-debug.c $(WEBDIR)/extjs-tv-debug.c
@echo "WEBUI debug finished"
# Internationalization
.PHONY: intl
intl:
@printf "Building intl/js/tvheadend.js.pot\n"
@$(XGETTEXT2) -o intl/js/tvheadend.js.pot.new $(filter-out $(WEBDIR)/$(MARKED),$(JAVASCRIPT_SRC))
@sed -e 's/^"Language: /"Language: en/' < intl/js/tvheadend.js.pot.new > intl/js/tvheadend.js.pot
intl/js/tvheadend.js.pot:
#intl/js/tvheadend.js.en_US.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.en_GB.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.de.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.fr.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.cs.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.pl.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.bg.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.he.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.hr.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
#intl/js/tvheadend.js.it.po: intl/js/tvheadend.js.pot
# $(call merge-po,$@,$<)
src/webui/static/intl/tvh.en_US.js.gz: intl/js/tvheadend.js.en_US.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.en_GB.js.gz: intl/js/tvheadend.js.en_GB.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.de.js.gz: intl/js/tvheadend.js.de.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.fr.js.gz: intl/js/tvheadend.js.fr.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.cs.js.gz: intl/js/tvheadend.js.cs.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.pl.js.gz: intl/js/tvheadend.js.pl.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.bg.js.gz: intl/js/tvheadend.js.bg.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.he.js.gz: intl/js/tvheadend.js.he.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.hr.js.gz: intl/js/tvheadend.js.hr.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.it.js.gz: intl/js/tvheadend.js.it.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.pt.js.gz: intl/js/tvheadend.js.pt.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.sv.js.gz: intl/js/tvheadend.js.sv.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.es.js.gz: intl/js/tvheadend.js.es.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.et.js.gz: intl/js/tvheadend.js.et.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.fa.js.gz: intl/js/tvheadend.js.fa.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.nl.js.gz: intl/js/tvheadend.js.nl.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.hu.js.gz: intl/js/tvheadend.js.hu.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.ru.js.gz: intl/js/tvheadend.js.ru.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.lv.js.gz: intl/js/tvheadend.js.lv.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.uk.js.gz: intl/js/tvheadend.js.uk.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.fi.js.gz: intl/js/tvheadend.js.fi.po
$(call go-po,$@,$<)
src/webui/static/intl/tvh.da.js.gz: intl/js/tvheadend.js.da.po
$(call go-po,$@,$<)
.PHONY:
clean:
rm -f $(foreach f,tvh.js tvh.css tvh-tv.js tvh-tv.css,\
$(WEBDIR)/$(ROOTPATH)/$(f).gz \
$(WEBDIR)/$(ROOTPATH)/$(f).tmp \
$(WEBDIR)/$(ROOTPATH)/$(f).tmp2) \
$(WEBDIR)/extjs-std.c $(WEBDIR)/extjs-tv-std.c \
$(WEBDIR)/extjs-debug.c $(WEBDIR)/extjs-tv-debug.c