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
|
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# class UIMenubarTarget
# Handles platform-specific processing of menubar config files.
# defined by platform:
# gb_UIMenubarTarget_UIMenubarTarget_platform
# gb_UIMenubarTarget__command
$(dir $(call gb_UIMenubarTarget_get_target,%)).dir :
$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(dir $(call gb_UIMenubarTarget_get_target,%))%/.dir :
$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(call gb_UIMenubarTarget_get_target,%) :
$(call gb_UIMenubarTarget__command,$@,$*,$<)
.PHONY : $(call gb_UIMenubarTarget_get_clean_target,%)
$(call gb_UIMenubarTarget_get_clean_target,%) :
$(call gb_Output_announce,$(2),$(false),UIM,1)
rm -f $(call gb_UIMenubarTarget_get_target,$*)
# Process a menubar configuration file.
#
# gb_UIMenubarTarget_UIMenubarTarget target source
define gb_UIMenubarTarget_UIMenubarTarget
$(call gb_UIMenubarTarget_get_target,$(1)) : $(2)
$(call gb_UIMenubarTarget_get_target,$(1)) :| $(dir $(call gb_UIMenubarTarget_get_target,$(1))).dir
$(call gb_UIMenubarTarget_UIMenubarTarget_platform,$(1),$(2))
endef
# class UIImageListTarget
# Handles creation of image lists for .ui files.
gb_UIImageListTarget_COMMAND = $(call gb_ExternalExecutable_get_command,xsltproc)
gb_UIImageListTarget_DEPS = $(call gb_ExternalExecutable_get_dependencies,xsltproc)
gb_UIImageListTarget_XSLTFILE := $(SRCDIR)/solenv/bin/uiimagelist.xsl
# NOTE: for some reason xsltproc does not produce any file if there is
# no output, so we touch the target to make sure it exists.
define gb_UIImageListTarget__command
$(call gb_Helper_abbreviate_dirs,\
$(gb_UIImageListTarget_COMMAND) --nonet -o $@ $(gb_UIImageListTarget_XSLTFILE) $(UIFILE) && \
touch $@ \
)
endef
$(dir $(call gb_UIImageListTarget_get_target,%)).dir :
$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(dir $(call gb_UIImageListTarget_get_target,%))%/.dir :
$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(call gb_UIImageListTarget_get_target,%) : $(gb_UIImageListTarget_DEPS) $(gb_UIImageListTarget_XSLTFILE)
$(call gb_Output_announce,$*,$(true),UIL,1)
$(call gb_Trace_StartRange,$*,UIL)
$(call gb_UIImageListTarget__command,$@,$*)
$(call gb_Trace_EndRange,$*,UIL)
.PHONY : $(call gb_UIImageListTarget_get_clean_target,%)
$(call gb_UIImageListTarget_get_clean_target,%) :
$(call gb_Output_announce,$*,$(false),UIL,1)
rm -f $(call gb_UIImageListTarget_get_target,$*)
# Extract list of images referenced in a .ui file.
#
# gb_UIImageListTarget_UIImageListTarget uifile
define gb_UIImageListTarget_UIImageListTarget
$(call gb_UIImageListTarget_get_target,$(1)) : UIFILE := $(SRCDIR)/$(1).ui
$(call gb_UIImageListTarget_get_target,$(1)) : $(SRCDIR)/$(1).ui
$(call gb_UIImageListTarget_get_target,$(1)) :| $(dir $(call gb_UIImageListTarget_get_target,$(1))).dir
endef
# class UIConfig
# Handles UI configuration files.
#
# This mostly means UI description files (suffix .ui) for the new layouting
# mechanism.
#
# This class provides the following filelists:
# * UIConfig/<name> containing all nontranslatable files
gb_UIConfig_INSTDIR := $(LIBO_SHARE_FOLDER)/config/soffice.cfg
ifneq ($(filter LXML,$(BUILD_TYPE)),)
gb_UIConfig_LXML_PATH := PYTHONPATH=$${PYTHONPATH:+$$PYTHONPATH:}$(call gb_UnpackedTarball_get_dir,lxml)/install ;
gb_UIConfig_LXML_TARGET := $(call gb_ExternalProject_get_target,lxml)
endif
gb_UIConfig_gla11y_SCRIPT := $(SRCDIR)/bin/gla11y
$(dir $(call gb_UIConfig_get_target,%)).dir :
$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(dir $(call gb_UIConfig_get_target,%))%/.dir :
$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(call gb_UIConfig_get_target,%) : $(call gb_UIConfig_get_imagelist_target,%) $(call gb_UIConfig_get_a11yerrors_target,%)
$(call gb_Output_announce,$*,$(true),UIC,2)
$(call gb_Trace_StartRange,$*,UIC)
$(call gb_Helper_abbreviate_dirs,\
touch $@ \
)
$(call gb_Trace_EndRange,$*,UIC)
$(call gb_UIConfig_get_imagelist_target,%) :
$(call gb_UIConfig__command)
.PHONY : $(call gb_UIConfig_get_clean_target,%)
$(call gb_UIConfig_get_clean_target,%) :
$(call gb_Output_announce,$*,$(false),UIC,2)
$(call gb_Helper_abbreviate_dirs,\
rm -f $(call gb_UIConfig_get_target,$*) $(call gb_UIConfig_get_imagelist_target,$*) \
)
$(call gb_Output_announce,$*,$(false),UIA,2)
rm -f $(call gb_UIConfig_get_a11yerrors_target,$*)
gb_UIConfig_gla11y_PARAMETERS = -P $(SRCDIR)/ -f $(UI_A11YFALSE)
# Disable this to see suppressed warnings
ifeq (1,1)
gb_UIConfig_gla11y_PARAMETERS += -s $(UI_A11YSUPPRS)
endif
# Enable this to regenerate suppression files
ifeq (1,0)
gb_UIConfig_gla11y_PARAMETERS += -g $(UI_A11YSUPPRS)
endif
# Tell gla11y about LO-specific widgets
# These are storage, containers, or preview
gb_UIConfig_gla11y_PARAMETERS += --widgets-suffixignored +ValueSet,HBox,VBox,ToolBox,Preview,PreviewWin,PreviewWindow,PrevWindow
# These are buttons, thus already contain their label (but an image is not enough)
gb_UIConfig_gla11y_PARAMETERS += --widgets-button +svtlo-ManagedMenuButton
# All new warnings should be fatal except a few kinds which could be only doubtful
gb_UIConfig_gla11y_PARAMETERS += --fatal-all --not-fatal-type duplicate-mnemonic --not-fatal-type labelled-by-and-mnemonic --not-fatal-type orphan-label
define gb_UIConfig_a11yerrors__command
$(call gb_UIConfig__gla11y_command)
endef
$(call gb_UIConfig_get_a11yerrors_target,%) : $(gb_UIConfig_LXML_TARGET) $(call gb_ExternalExecutable_get_dependencies,python) $(gb_UIConfig_gla11y_SCRIPT)
$(call gb_Output_announce,$*,$(true),UIA,1)
$(call gb_Trace_StartRange,$*,UIA)
$(call gb_UIConfig_a11yerrors__command,$@,$*)
$(call gb_Trace_EndRange,$*,UIA)
gb_UIConfig_get_packagename = UIConfig/$(1)
gb_UIConfig_get_packagesetname = UIConfig/$(1)
# Processes and delivers a set of UI configuration files.
#
# gb_UIConfig_UIConfig modulename
define gb_UIConfig_UIConfig
ifeq (,$$(filter $(1),$$(gb_UIConfig_REGISTERED)))
$$(eval $$(call gb_Output_info,Currently known UI configs are: $(sort $(gb_UIConfig_REGISTERED)),ALL))
$$(eval $$(call gb_Output_error,UIConfig $(1) must be registered in Repository.mk))
endif
$(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS :=
$(call gb_PackageSet_PackageSet_internal,$(call gb_UIConfig_get_packagesetname,$(1)))
$(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)),$(SRCDIR))
$(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)_generated),$(WORKDIR))
$(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1)))
$(call gb_UIConfig_get_target,$(1)) :| $(dir $(call gb_UIConfig_get_target,$(1))).dir
$(call gb_UIConfig_get_imagelist_target,$(1)) :| $(dir $(call gb_UIConfig_get_imagelist_target,$(1))).dir
$(call gb_UIConfig_get_a11yerrors_target,$(1)) :| $(dir $(call gb_UIConfig_get_a11yerrors_target,$(1))).dir
$(call gb_UIConfig_get_a11yerrors_target,$(1)) : UI_A11YSUPPRS := $(SRCDIR)/solenv/sanitizers/ui/$(1).suppr
$(call gb_UIConfig_get_a11yerrors_target,$(1)) : UI_A11YFALSE := $(SRCDIR)/solenv/sanitizers/ui/$(1).false
$(call gb_UIConfig_get_target,$(1)) : $(call gb_PackageSet_get_target,$(call gb_UIConfig_get_packagesetname,$(1)))
$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_PackageSet_get_clean_target,$(call gb_UIConfig_get_packagesetname,$(1)))
$$(eval $$(call gb_Module_register_target,$(call gb_UIConfig_get_target,$(1)),$(call gb_UIConfig_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),UIConfig)
$(call gb_Postprocess_register_target,AllUIConfigs,UIConfig,$(1))
endef
# gb_UIConfig__package_file target package type destfile srcfile
define gb_UIConfig__package_file
$(call gb_Package_add_file,$(2),$(gb_UIConfig_INSTDIR)/$(1)/$(3)/$(4),$(5))
endef
# gb_UIConfig__package_uifile target package destfile srcfile
define gb_UIConfig__package_uifile
$(call gb_UIConfig__package_file,$(1),$(2),ui,$(3),$(4))
endef
define gb_UIConfig_add_a11yerrors_uifile
$(call gb_UIConfig_get_a11yerrors_target,$(1)) : UIFILES += $(SRCDIR)/$(2).ui
$(call gb_UIConfig_get_a11yerrors_target,$(1)) : $(SRCDIR)/$(2).ui
endef
# gb_UIConfig__add_uifile target file
define gb_UIConfig__add_uifile
$(call gb_UIConfig__package_uifile,$(1),$(call gb_UIConfig_get_packagename,$(1)),$(notdir $(2)).ui,$(2).ui)
$(call gb_UIImageListTarget_UIImageListTarget,$(2))
$(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS += $(call gb_UIImageListTarget_get_target,$(2))
$(call gb_UIConfig_get_imagelist_target,$(1)) : $(call gb_UIImageListTarget_get_target,$(2))
$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UIImageListTarget_get_clean_target,$(2))
$(call gb_UIConfig_add_a11yerrors_uifile,$(1),$(2))
endef
gb_UIConfig_ALLFILES:=
# Adds .ui file to the package
#
# The file is relative to $(SRCDIR) and without extension.
#
# gb_UIConfig_add_uifile target uifile
define gb_UIConfig_add_uifile
gb_UIConfig_ALLFILES+=$(1):$(notdir $(2))
$(call gb_UIConfig__add_uifile,$(1),$(2))
endef
# Adds multiple .ui files to the package
#
# gb_UIConfig_add_uifiles target uifile(s)
define gb_UIConfig_add_uifiles
$(foreach uifile,$(2),$(call gb_UIConfig_add_uifile,$(1),$(uifile)))
endef
# gb_UIConfig_add_uifiles target uifile(s) but only for running gla11y
define gb_UIConfig_add_a11yerrors_uifiles
$(foreach uifile,$(2),$(call gb_UIConfig_add_a11yerrors_uifile,$(1),$(uifile)))
endef
# gb_UIConfig__add_xmlfile target package-target type xmlfile
define gb_UIConfig__add_xmlfile
$(call gb_UIConfig__package_file,$(1),$(call gb_UIConfig_get_packagename,$(2)),$(3),$(notdir $(4)).xml,$(4).xml)
endef
define gb_UIConfig__add_menubarfile
$(call gb_UIMenubarTarget_UIMenubarTarget,$(2),$(3))
$(call gb_Package_add_file,$(call gb_UIConfig_get_packagename,$(1)_generated),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)).xml,$(subst $(WORKDIR)/,,$(call gb_UIMenubarTarget_get_target,$(2))))
$(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1)_generated))
$(call gb_Package_get_target,$(call gb_UIConfig_get_packagename,$(1)_generated)) : $(call gb_UIMenubarTarget_get_target,$(2))
$(call gb_Package_get_clean_target,$(call gb_UIConfig_get_packagename,$(1)_generated)) : $(call gb_UIMenubarTarget_get_clean_target,$(2))
endef
# Add menubar config file to the package.
#
# The file is relative to $(SRCDIR) and without extension.
#
# gb_UIConfig_add_menubarfile target file
define gb_UIConfig_add_menubarfile
$(call gb_UIConfig__add_menubarfile,$(1),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)),$(SRCDIR)/$(2).xml)
endef
# Adds multiple menubar config files to the package.
#
# gb_UIConfig_add_menubarfiles target file(s)
define gb_UIConfig_add_menubarfiles
$(foreach menubarfile,$(2),$(call gb_UIConfig_add_menubarfile,$(1),$(menubarfile)))
endef
# Add a generated menubar config file to the package.
#
# The file is relative to $(WORKDIR) and without extension.
#
# gb_UIConfig_add_generated_menubarfile target file
define gb_UIConfig_add_generated_menubarfile
$(call gb_UIConfig__add_menubarfile,$(1),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)),$(WORKDIR)/$(2).xml)
endef
# Adds multiple menubar config files to the package.
#
# gb_UIConfig_add_generated_menubarfiles target file(s)
define gb_UIConfig_add_generated_menubarfiles
$(foreach menubarfile,$(2),$(call gb_UIConfig_add_generated_menubarfile,$(1),$(menubarfile)))
endef
# Add statusbar config file to the package.
#
# The file is relative to $(SRCDIR) and without extension.
#
# gb_UIConfig_add_statusbarfile target file
define gb_UIConfig_add_statusbarfile
$(call gb_UIConfig__add_xmlfile,$(1),$(1),statusbar,$(2))
endef
# Adds multiple statusbar config files to the package.
#
# gb_UIConfig_add_statusbarfiles target file(s)
define gb_UIConfig_add_statusbarfiles
$(foreach statusbarfile,$(2),$(call gb_UIConfig_add_statusbarfile,$(1),$(statusbarfile)))
endef
# Add toolbar config file to the package.
#
# The file is relative to $(SRCDIR) and without extension.
#
# gb_UIConfig_add_toolbarfile target file
define gb_UIConfig_add_toolbarfile
$(call gb_UIConfig__add_xmlfile,$(1),$(1),toolbar,$(2))
endef
# Adds multiple toolbar config files to the package.
#
# gb_UIConfig_add_toolbarfiles target file(s)
define gb_UIConfig_add_toolbarfiles
$(foreach toolbarfile,$(2),$(call gb_UIConfig_add_toolbarfile,$(1),$(toolbarfile)))
endef
# Add popupmenu config file to the package.
#
# The file is relative to $(SRCDIR) and without extension.
#
# gb_UIConfig_add_popupmenufile target file
define gb_UIConfig_add_popupmenufile
$(call gb_UIConfig__add_xmlfile,$(1),$(1),popupmenu,$(2))
endef
# Adds multiple popupmenu config files to the package.
#
# gb_UIConfig_add_popupmenufiles target file(s)
define gb_UIConfig_add_popupmenufiles
$(foreach popupmenufile,$(2),$(call gb_UIConfig_add_popupmenufile,$(1),$(popupmenufile)))
endef
# vim: set noet sw=4 ts=4:
|