PageRenderTime 58ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/solenv/gbuild/UIConfig.mk

https://repo.or.cz/LibreOffice.git
Makefile | 358 lines | 179 code | 85 blank | 94 comment | 1 complexity | 0b944d1864c1d9a467ebf900b3e47699 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause-No-Nuclear-License-2014, GPL-3.0, LGPL-2.1, LGPL-3.0, LGPL-2.0
  1. # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
  2. #
  3. # This file is part of the LibreOffice project.
  4. #
  5. # This Source Code Form is subject to the terms of the Mozilla Public
  6. # License, v. 2.0. If a copy of the MPL was not distributed with this
  7. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  8. #
  9. # class UIMenubarTarget
  10. # Handles platform-specific processing of menubar config files.
  11. # defined by platform:
  12. # gb_UIMenubarTarget_UIMenubarTarget_platform
  13. # gb_UIMenubarTarget__command
  14. $(dir $(call gb_UIMenubarTarget_get_target,%)).dir :
  15. $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
  16. $(dir $(call gb_UIMenubarTarget_get_target,%))%/.dir :
  17. $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
  18. $(call gb_UIMenubarTarget_get_target,%) :
  19. $(call gb_UIMenubarTarget__command,$@,$*,$<)
  20. .PHONY : $(call gb_UIMenubarTarget_get_clean_target,%)
  21. $(call gb_UIMenubarTarget_get_clean_target,%) :
  22. $(call gb_Output_announce,$(2),$(false),UIM,1)
  23. rm -f $(call gb_UIMenubarTarget_get_target,$*)
  24. # Process a menubar configuration file.
  25. #
  26. # gb_UIMenubarTarget_UIMenubarTarget target source
  27. define gb_UIMenubarTarget_UIMenubarTarget
  28. $(call gb_UIMenubarTarget_get_target,$(1)) : $(2)
  29. $(call gb_UIMenubarTarget_get_target,$(1)) :| $(dir $(call gb_UIMenubarTarget_get_target,$(1))).dir
  30. $(call gb_UIMenubarTarget_UIMenubarTarget_platform,$(1),$(2))
  31. endef
  32. # class UIImageListTarget
  33. # Handles creation of image lists for .ui files.
  34. gb_UIImageListTarget_COMMAND = $(call gb_ExternalExecutable_get_command,xsltproc)
  35. gb_UIImageListTarget_DEPS = $(call gb_ExternalExecutable_get_dependencies,xsltproc)
  36. gb_UIImageListTarget_XSLTFILE := $(SRCDIR)/solenv/bin/uiimagelist.xsl
  37. # NOTE: for some reason xsltproc does not produce any file if there is
  38. # no output, so we touch the target to make sure it exists.
  39. define gb_UIImageListTarget__command
  40. $(call gb_Helper_abbreviate_dirs,\
  41. $(gb_UIImageListTarget_COMMAND) --nonet -o $@ $(gb_UIImageListTarget_XSLTFILE) $(UIFILE) && \
  42. touch $@ \
  43. )
  44. endef
  45. $(dir $(call gb_UIImageListTarget_get_target,%)).dir :
  46. $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
  47. $(dir $(call gb_UIImageListTarget_get_target,%))%/.dir :
  48. $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
  49. $(call gb_UIImageListTarget_get_target,%) : $(gb_UIImageListTarget_DEPS) $(gb_UIImageListTarget_XSLTFILE)
  50. $(call gb_Output_announce,$*,$(true),UIL,1)
  51. $(call gb_Trace_StartRange,$*,UIL)
  52. $(call gb_UIImageListTarget__command,$@,$*)
  53. $(call gb_Trace_EndRange,$*,UIL)
  54. .PHONY : $(call gb_UIImageListTarget_get_clean_target,%)
  55. $(call gb_UIImageListTarget_get_clean_target,%) :
  56. $(call gb_Output_announce,$*,$(false),UIL,1)
  57. rm -f $(call gb_UIImageListTarget_get_target,$*)
  58. # Extract list of images referenced in a .ui file.
  59. #
  60. # gb_UIImageListTarget_UIImageListTarget uifile
  61. define gb_UIImageListTarget_UIImageListTarget
  62. $(call gb_UIImageListTarget_get_target,$(1)) : UIFILE := $(SRCDIR)/$(1).ui
  63. $(call gb_UIImageListTarget_get_target,$(1)) : $(SRCDIR)/$(1).ui
  64. $(call gb_UIImageListTarget_get_target,$(1)) :| $(dir $(call gb_UIImageListTarget_get_target,$(1))).dir
  65. endef
  66. # class UIConfig
  67. # Handles UI configuration files.
  68. #
  69. # This mostly means UI description files (suffix .ui) for the new layouting
  70. # mechanism.
  71. #
  72. # This class provides the following filelists:
  73. # * UIConfig/<name> containing all nontranslatable files
  74. gb_UIConfig_INSTDIR := $(LIBO_SHARE_FOLDER)/config/soffice.cfg
  75. ifneq ($(filter LXML,$(BUILD_TYPE)),)
  76. gb_UIConfig_LXML_PATH := PYTHONPATH=$${PYTHONPATH:+$$PYTHONPATH:}$(call gb_UnpackedTarball_get_dir,lxml)/install ;
  77. gb_UIConfig_LXML_TARGET := $(call gb_ExternalProject_get_target,lxml)
  78. endif
  79. gb_UIConfig_gla11y_SCRIPT := $(SRCDIR)/bin/gla11y
  80. $(dir $(call gb_UIConfig_get_target,%)).dir :
  81. $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
  82. $(dir $(call gb_UIConfig_get_target,%))%/.dir :
  83. $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
  84. $(call gb_UIConfig_get_target,%) : $(call gb_UIConfig_get_imagelist_target,%) $(call gb_UIConfig_get_a11yerrors_target,%)
  85. $(call gb_Output_announce,$*,$(true),UIC,2)
  86. $(call gb_Trace_StartRange,$*,UIC)
  87. $(call gb_Helper_abbreviate_dirs,\
  88. touch $@ \
  89. )
  90. $(call gb_Trace_EndRange,$*,UIC)
  91. $(call gb_UIConfig_get_imagelist_target,%) :
  92. $(call gb_UIConfig__command)
  93. .PHONY : $(call gb_UIConfig_get_clean_target,%)
  94. $(call gb_UIConfig_get_clean_target,%) :
  95. $(call gb_Output_announce,$*,$(false),UIC,2)
  96. $(call gb_Helper_abbreviate_dirs,\
  97. rm -f $(call gb_UIConfig_get_target,$*) $(call gb_UIConfig_get_imagelist_target,$*) \
  98. )
  99. $(call gb_Output_announce,$*,$(false),UIA,2)
  100. rm -f $(call gb_UIConfig_get_a11yerrors_target,$*)
  101. gb_UIConfig_gla11y_PARAMETERS = -P $(SRCDIR)/ -f $(UI_A11YFALSE)
  102. # Disable this to see suppressed warnings
  103. ifeq (1,1)
  104. gb_UIConfig_gla11y_PARAMETERS += -s $(UI_A11YSUPPRS)
  105. endif
  106. # Enable this to regenerate suppression files
  107. ifeq (1,0)
  108. gb_UIConfig_gla11y_PARAMETERS += -g $(UI_A11YSUPPRS)
  109. endif
  110. # Tell gla11y about LO-specific widgets
  111. # These are storage, containers, or preview
  112. gb_UIConfig_gla11y_PARAMETERS += --widgets-suffixignored +ValueSet,HBox,VBox,ToolBox,Preview,PreviewWin,PreviewWindow,PrevWindow
  113. # These are buttons, thus already contain their label (but an image is not enough)
  114. gb_UIConfig_gla11y_PARAMETERS += --widgets-button +svtlo-ManagedMenuButton
  115. # All new warnings should be fatal except a few kinds which could be only doubtful
  116. gb_UIConfig_gla11y_PARAMETERS += --fatal-all --not-fatal-type duplicate-mnemonic --not-fatal-type labelled-by-and-mnemonic --not-fatal-type orphan-label
  117. define gb_UIConfig_a11yerrors__command
  118. $(call gb_UIConfig__gla11y_command)
  119. endef
  120. $(call gb_UIConfig_get_a11yerrors_target,%) : $(gb_UIConfig_LXML_TARGET) $(call gb_ExternalExecutable_get_dependencies,python) $(gb_UIConfig_gla11y_SCRIPT)
  121. $(call gb_Output_announce,$*,$(true),UIA,1)
  122. $(call gb_Trace_StartRange,$*,UIA)
  123. $(call gb_UIConfig_a11yerrors__command,$@,$*)
  124. $(call gb_Trace_EndRange,$*,UIA)
  125. gb_UIConfig_get_packagename = UIConfig/$(1)
  126. gb_UIConfig_get_packagesetname = UIConfig/$(1)
  127. # Processes and delivers a set of UI configuration files.
  128. #
  129. # gb_UIConfig_UIConfig modulename
  130. define gb_UIConfig_UIConfig
  131. ifeq (,$$(filter $(1),$$(gb_UIConfig_REGISTERED)))
  132. $$(eval $$(call gb_Output_info,Currently known UI configs are: $(sort $(gb_UIConfig_REGISTERED)),ALL))
  133. $$(eval $$(call gb_Output_error,UIConfig $(1) must be registered in Repository.mk))
  134. endif
  135. $(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS :=
  136. $(call gb_PackageSet_PackageSet_internal,$(call gb_UIConfig_get_packagesetname,$(1)))
  137. $(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)),$(SRCDIR))
  138. $(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)_generated),$(WORKDIR))
  139. $(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1)))
  140. $(call gb_UIConfig_get_target,$(1)) :| $(dir $(call gb_UIConfig_get_target,$(1))).dir
  141. $(call gb_UIConfig_get_imagelist_target,$(1)) :| $(dir $(call gb_UIConfig_get_imagelist_target,$(1))).dir
  142. $(call gb_UIConfig_get_a11yerrors_target,$(1)) :| $(dir $(call gb_UIConfig_get_a11yerrors_target,$(1))).dir
  143. $(call gb_UIConfig_get_a11yerrors_target,$(1)) : UI_A11YSUPPRS := $(SRCDIR)/solenv/sanitizers/ui/$(1).suppr
  144. $(call gb_UIConfig_get_a11yerrors_target,$(1)) : UI_A11YFALSE := $(SRCDIR)/solenv/sanitizers/ui/$(1).false
  145. $(call gb_UIConfig_get_target,$(1)) : $(call gb_PackageSet_get_target,$(call gb_UIConfig_get_packagesetname,$(1)))
  146. $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_PackageSet_get_clean_target,$(call gb_UIConfig_get_packagesetname,$(1)))
  147. $$(eval $$(call gb_Module_register_target,$(call gb_UIConfig_get_target,$(1)),$(call gb_UIConfig_get_clean_target,$(1))))
  148. $(call gb_Helper_make_userfriendly_targets,$(1),UIConfig)
  149. $(call gb_Postprocess_register_target,AllUIConfigs,UIConfig,$(1))
  150. endef
  151. # gb_UIConfig__package_file target package type destfile srcfile
  152. define gb_UIConfig__package_file
  153. $(call gb_Package_add_file,$(2),$(gb_UIConfig_INSTDIR)/$(1)/$(3)/$(4),$(5))
  154. endef
  155. # gb_UIConfig__package_uifile target package destfile srcfile
  156. define gb_UIConfig__package_uifile
  157. $(call gb_UIConfig__package_file,$(1),$(2),ui,$(3),$(4))
  158. endef
  159. define gb_UIConfig_add_a11yerrors_uifile
  160. $(call gb_UIConfig_get_a11yerrors_target,$(1)) : UIFILES += $(SRCDIR)/$(2).ui
  161. $(call gb_UIConfig_get_a11yerrors_target,$(1)) : $(SRCDIR)/$(2).ui
  162. endef
  163. # gb_UIConfig__add_uifile target file
  164. define gb_UIConfig__add_uifile
  165. $(call gb_UIConfig__package_uifile,$(1),$(call gb_UIConfig_get_packagename,$(1)),$(notdir $(2)).ui,$(2).ui)
  166. $(call gb_UIImageListTarget_UIImageListTarget,$(2))
  167. $(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS += $(call gb_UIImageListTarget_get_target,$(2))
  168. $(call gb_UIConfig_get_imagelist_target,$(1)) : $(call gb_UIImageListTarget_get_target,$(2))
  169. $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UIImageListTarget_get_clean_target,$(2))
  170. $(call gb_UIConfig_add_a11yerrors_uifile,$(1),$(2))
  171. endef
  172. gb_UIConfig_ALLFILES:=
  173. # Adds .ui file to the package
  174. #
  175. # The file is relative to $(SRCDIR) and without extension.
  176. #
  177. # gb_UIConfig_add_uifile target uifile
  178. define gb_UIConfig_add_uifile
  179. gb_UIConfig_ALLFILES+=$(1):$(notdir $(2))
  180. $(call gb_UIConfig__add_uifile,$(1),$(2))
  181. endef
  182. # Adds multiple .ui files to the package
  183. #
  184. # gb_UIConfig_add_uifiles target uifile(s)
  185. define gb_UIConfig_add_uifiles
  186. $(foreach uifile,$(2),$(call gb_UIConfig_add_uifile,$(1),$(uifile)))
  187. endef
  188. # gb_UIConfig_add_uifiles target uifile(s) but only for running gla11y
  189. define gb_UIConfig_add_a11yerrors_uifiles
  190. $(foreach uifile,$(2),$(call gb_UIConfig_add_a11yerrors_uifile,$(1),$(uifile)))
  191. endef
  192. # gb_UIConfig__add_xmlfile target package-target type xmlfile
  193. define gb_UIConfig__add_xmlfile
  194. $(call gb_UIConfig__package_file,$(1),$(call gb_UIConfig_get_packagename,$(2)),$(3),$(notdir $(4)).xml,$(4).xml)
  195. endef
  196. define gb_UIConfig__add_menubarfile
  197. $(call gb_UIMenubarTarget_UIMenubarTarget,$(2),$(3))
  198. $(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))))
  199. $(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1)_generated))
  200. $(call gb_Package_get_target,$(call gb_UIConfig_get_packagename,$(1)_generated)) : $(call gb_UIMenubarTarget_get_target,$(2))
  201. $(call gb_Package_get_clean_target,$(call gb_UIConfig_get_packagename,$(1)_generated)) : $(call gb_UIMenubarTarget_get_clean_target,$(2))
  202. endef
  203. # Add menubar config file to the package.
  204. #
  205. # The file is relative to $(SRCDIR) and without extension.
  206. #
  207. # gb_UIConfig_add_menubarfile target file
  208. define gb_UIConfig_add_menubarfile
  209. $(call gb_UIConfig__add_menubarfile,$(1),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)),$(SRCDIR)/$(2).xml)
  210. endef
  211. # Adds multiple menubar config files to the package.
  212. #
  213. # gb_UIConfig_add_menubarfiles target file(s)
  214. define gb_UIConfig_add_menubarfiles
  215. $(foreach menubarfile,$(2),$(call gb_UIConfig_add_menubarfile,$(1),$(menubarfile)))
  216. endef
  217. # Add a generated menubar config file to the package.
  218. #
  219. # The file is relative to $(WORKDIR) and without extension.
  220. #
  221. # gb_UIConfig_add_generated_menubarfile target file
  222. define gb_UIConfig_add_generated_menubarfile
  223. $(call gb_UIConfig__add_menubarfile,$(1),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)),$(WORKDIR)/$(2).xml)
  224. endef
  225. # Adds multiple menubar config files to the package.
  226. #
  227. # gb_UIConfig_add_generated_menubarfiles target file(s)
  228. define gb_UIConfig_add_generated_menubarfiles
  229. $(foreach menubarfile,$(2),$(call gb_UIConfig_add_generated_menubarfile,$(1),$(menubarfile)))
  230. endef
  231. # Add statusbar config file to the package.
  232. #
  233. # The file is relative to $(SRCDIR) and without extension.
  234. #
  235. # gb_UIConfig_add_statusbarfile target file
  236. define gb_UIConfig_add_statusbarfile
  237. $(call gb_UIConfig__add_xmlfile,$(1),$(1),statusbar,$(2))
  238. endef
  239. # Adds multiple statusbar config files to the package.
  240. #
  241. # gb_UIConfig_add_statusbarfiles target file(s)
  242. define gb_UIConfig_add_statusbarfiles
  243. $(foreach statusbarfile,$(2),$(call gb_UIConfig_add_statusbarfile,$(1),$(statusbarfile)))
  244. endef
  245. # Add toolbar config file to the package.
  246. #
  247. # The file is relative to $(SRCDIR) and without extension.
  248. #
  249. # gb_UIConfig_add_toolbarfile target file
  250. define gb_UIConfig_add_toolbarfile
  251. $(call gb_UIConfig__add_xmlfile,$(1),$(1),toolbar,$(2))
  252. endef
  253. # Adds multiple toolbar config files to the package.
  254. #
  255. # gb_UIConfig_add_toolbarfiles target file(s)
  256. define gb_UIConfig_add_toolbarfiles
  257. $(foreach toolbarfile,$(2),$(call gb_UIConfig_add_toolbarfile,$(1),$(toolbarfile)))
  258. endef
  259. # Add popupmenu config file to the package.
  260. #
  261. # The file is relative to $(SRCDIR) and without extension.
  262. #
  263. # gb_UIConfig_add_popupmenufile target file
  264. define gb_UIConfig_add_popupmenufile
  265. $(call gb_UIConfig__add_xmlfile,$(1),$(1),popupmenu,$(2))
  266. endef
  267. # Adds multiple popupmenu config files to the package.
  268. #
  269. # gb_UIConfig_add_popupmenufiles target file(s)
  270. define gb_UIConfig_add_popupmenufiles
  271. $(foreach popupmenufile,$(2),$(call gb_UIConfig_add_popupmenufile,$(1),$(popupmenufile)))
  272. endef
  273. # vim: set noet sw=4 ts=4: