no need to dynamic_cast when using GetItemSurrogates
[LibreOffice.git] / postprocess / CustomTarget_images.mk
blob74ca91a4b3e687f750acfaa6e795d96700d0947f
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 $(eval $(call gb_CustomTarget_CustomTarget,postprocess/images))
13 packimages_DIR := $(gb_CustomTarget_workdir)/postprocess/images
15 $(eval $(call gb_CustomTarget_register_targets,postprocess/images,\
16 $(foreach theme,$(WITH_THEMES),images_$(theme).zip) \
17 $(foreach theme,$(WITH_THEMES),$(theme)_links.txt) \
18 commandimagelist.ilst \
19 sourceimagelist.ilst \
20 sorted.lst \
23 $(packimages_DIR)/images.zip : DEFAULT_THEME := $(true)
24 $(packimages_DIR)/images_%.zip : DEFAULT_THEME :=
26 # tdf#124023 make links.txt depend on phony sorted.lst depend
27 # so this is evaluated every time
28 $(packimages_DIR)/%_links.txt : $(packimages_DIR)/sorted.lst
29 @if test -f "$(SRCDIR)/icon-themes/$*/links.txt"; then \
30 cp "$(SRCDIR)/icon-themes/$*/links.txt" $@.tmp ; \
31 else \
32 THEME_FILE="$(SRCDIR)/icon-themes/$(subst _svg,,$*)/links.txt" ; \
33 if test -f "$${THEME_FILE}"; then \
34 sed 's/\.png/\.svg/g' "$${THEME_FILE}" > $@.tmp ; \
35 fi ; \
36 THEME_FILE="$(SRCDIR)/icon-themes/$(subst _dark,,$*)/links.txt" ; \
37 if test -f "$${THEME_FILE}"; then \
38 cp "$${THEME_FILE}" $@.tmp ; \
39 fi ; \
41 $(call gb_Helper_replace_if_different_and_touch,$@.tmp,$@)
43 $(packimages_DIR)/images_%.zip : \
44 $(packimages_DIR)/sorted.lst \
45 $(packimages_DIR)/commandimagelist.ilst \
46 $(packimages_DIR)/sourceimagelist.ilst \
47 $(SRCDIR)/wizards/source/imagelists/imagelists.ilst \
48 $(packimages_DIR)/%_links.txt \
49 $(call gb_Helper_get_imagelists) \
50 | $(call gb_ExternalExecutable_get_dependencies,python)
51 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
52 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
53 $(call gb_Helper_abbreviate_dirs, \
54 ILSTFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),$(filter %.ilst,$^)) && \
55 $(call gb_ExternalExecutable_get_command,python) \
56 $(SRCDIR)/solenv/bin/pack_images.py \
57 $(if $(DEFAULT_THEME),\
58 -g $(packimages_DIR) -m $(packimages_DIR) -c $(packimages_DIR),\
59 -g $(SRCDIR)/icon-themes/$* -m $(SRCDIR)/icon-themes/$* -c $(SRCDIR)/icon-themes/$* \
60 ) \
61 -l $${ILSTFILE} \
62 -L $(packimages_DIR)/$*_links.txt \
63 -s $< -o $@ \
64 $(if $(findstring s,$(MAKEFLAGS)),> /dev/null) && \
65 rm -rf $${ILSTFILE})
66 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
68 # turn the #defines foo "resource.png" of hlst into the final ilst format
69 $(packimages_DIR)/sourceimagelist.ilst : \
70 $(SRCDIR)/avmedia/inc/bitmaps.hlst \
71 $(SRCDIR)/basctl/inc/bitmaps.hlst \
72 $(SRCDIR)/connectivity/inc/bitmaps.hlst \
73 $(SRCDIR)/cui/inc/bitmaps.hlst \
74 $(SRCDIR)/chart2/inc/bitmaps.hlst \
75 $(SRCDIR)/dbaccess/inc/bitmaps.hlst \
76 $(SRCDIR)/desktop/inc/bitmaps.hlst \
77 $(SRCDIR)/extensions/inc/bitmaps.hlst \
78 $(SRCDIR)/formula/inc/bitmaps.hlst \
79 $(SRCDIR)/fpicker/inc/bitmaps.hlst \
80 $(SRCDIR)/framework/inc/bitmaps.hlst \
81 $(SRCDIR)/reportdesign/inc/bitmaps.hlst \
82 $(SRCDIR)/sc/inc/bitmaps.hlst \
83 $(SRCDIR)/sd/inc/bitmaps.hlst \
84 $(SRCDIR)/sdext/inc/bitmaps.hlst \
85 $(SRCDIR)/sfx2/inc/bitmaps.hlst \
86 $(SRCDIR)/svtools/inc/bitmaps.hlst \
87 $(SRCDIR)/svx/inc/bitmaps.hlst \
88 $(SRCDIR)/sw/inc/bitmaps.hlst \
89 $(SRCDIR)/vcl/inc/bitmaps.hlst \
90 $(SRCDIR)/xmlsecurity/inc/bitmaps.hlst
91 grep res $^ | cut -d'"' -f2 | sed "s/^/%MODULE%\//" | sed "s/%MODULE%.res/%GLOBALRES%/g" > $@.png
92 sed 's/\.png/\.svg/g' $@.png > $@.svg
93 cat $@.png $@.svg > $@
95 packimages_everything := $(shell $(FIND) $(SRCDIR)/icon-themes)
96 packimages_icon_themes := $(filter %/,$(wildcard $(SRCDIR)/icon-themes/*/))
97 # TODO: awkward workaround for windows - the filter call chokes for some reason
98 # on the full list, and similarly the recursive filtering call from the initial
99 # version of the patch also fails on windows for some reason
100 # so don't try to be clever and do it in this awkward/tedious way.
101 # all this does is filtering everything for png/svg files that have /cmd/ as
102 # part of their path and then replacing the path to the theme-directory with
103 # %MODULE% - the surrounding sort not only sorts the lists, but gets rid of
104 # duplicate filenames that are left after the %MODULE% replacement
105 packimages_cmd_images := $(sort $(foreach file,$(packimages_everything),\
106 $(if $(findstring /cmd/,$(filter %.png %.svg,$(file))),\
107 $(foreach theme,$(packimages_icon_themes),\
108 $(filter-out $(SRCDIR)/%,$(subst $(theme),%MODULE%/,$(file)))))))
110 # adding everything as dependencies here, so that file deletion (when only the directory timestamp
111 # gets updated) will also trigger regeneration of the list
112 $(packimages_DIR)/commandimagelist.ilst : $(packimages_everything)
113 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),LST,1)
114 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),LST)
115 $(file >$@,$(subst $(WHITESPACE),$(NEWLINE),$(packimages_cmd_images)))
116 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),LST)
118 $(packimages_DIR)/sorted.lst : $(packimages_DIR)/commandimagelist.ilst \
119 $(SRCDIR)/postprocess/packimages/image-sort.lst \
120 $(call gb_Postprocess_get_target,AllUIConfigs) \
121 $(call gb_ExternalExecutable_get_dependencies,python)
122 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
123 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
124 $(call gb_Helper_abbreviate_dirs, \
125 $(call gb_ExternalExecutable_get_command,python) \
126 $(SRCDIR)/solenv/bin/image-sort.py \
127 $(if $(filter build,$(gb_Side)),--quiet) \
128 $< $(INSTROOT)/$(gb_UIConfig_INSTDIR) $@)
129 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
131 # vim: set noet sw=4 ts=4: