bump product version to 7.2.5.1
[LibreOffice.git] / solenv / gbuild / Gallery.mk
blobd4c2765ae2ddb3f2429418a8e9148da3d0a3d52d
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
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/.
10 # class Gallery
12 # Handles creation of image galleries.
14 gb_Gallery_TRANSLATE := $(SRCDIR)/solenv/bin/desktop-translate.py
15 gb_Gallery_INSTDIR := $(LIBO_SHARE_FOLDER)/gallery
17 define gb_Gallery__command
18 $(call gb_Helper_abbreviate_dirs,\
19 rm -f $(call gb_Gallery_get_workdir,$(2))/* && \
20 RESPONSEFILE=$(call var2file,$(shell $(call gb_MKTEMP)),100,$(GALLERY_FILES)) && \
21 $(call gb_Helper_print_on_error,\
22 $(call gb_Executable_get_command,gengal,$(ICECREAM_RUN)) \
23 --build-tree \
24 --destdir $(GALLERY_BASEDIR) \
25 --name "$(GALLERY_NAME)" \
26 --path $(call gb_Gallery_get_workdir,$(2)) \
27 --filenames $(call gb_Helper_make_url,$$RESPONSEFILE),\
28 $@.log \
29 ) && \
30 rm $$RESPONSEFILE && \
31 touch $@ \
33 endef
35 define gb_Gallery__command_str
36 cp -f $(GALLERY_STRFILE) $@ && \
37 $(call gb_ExternalExecutable_get_command,python) \
38 $(gb_Gallery_TRANSLATE) \
39 --ext "str" --key "name" \
40 -d $(GALLERY_WORKDIR) \
41 $(GALLERY_ULFFILE)
42 endef
44 gb_Gallery__get_final_target = $(WORKDIR)/Gallery/$(1).final
46 $(dir $(call gb_Gallery_get_target,$(1))).dir :
47 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
49 $(dir $(call gb_Gallery_get_target,$(1)))%/.dir :
50 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
52 $(call gb_Gallery_get_target,%) : \
53 $(call gb_Executable_get_runtime_dependencies,gengal)
54 $(call gb_Output_announce,$*,$(true),GAL,1)
55 $(call gb_Trace_StartRange,$*,GAL)
56 $(call gb_Gallery__command,$@,$*)
57 $(call gb_Trace_EndRange,$*,GAL)
59 $(call gb_Gallery__get_final_target,%) :
60 touch $@
62 # difficult to determine source dep for this one...
63 $(call gb_Gallery_get_workdir,%).ulf : \
64 $(call gb_Executable_get_runtime_dependencies,ulfex)
65 $(call gb_CustomTarget_ulfex__command,$@,$(GALLERY_ULFFILE),\
66 $(foreach lang,$(gb_TRANS_LANGS),\
67 $(gb_POLOCATION)/$(lang)/extras/source/gallery/share.po))
69 $(call gb_Gallery_get_workdir,%).str : $(gb_Gallery_TRANSLATE) \
70 $(call gb_ExternalExecutable_get_dependencies,python)
71 $(call gb_Output_announce,$*,$(true),STR,1)
72 $(call gb_Trace_StartRange,$*,STR)
73 $(call gb_Gallery__command_str,$@,$*)
74 $(call gb_Trace_EndRange,$*,STR)
76 # there must be a rule for these since they are targets due to Package
77 $(call gb_Gallery_get_workdir,%).sdg :
78 touch $@
79 $(call gb_Gallery_get_workdir,%).sdv :
80 touch $@
81 $(call gb_Gallery_get_workdir,%).thm :
82 touch $@
84 .PHONY : $(call gb_Gallery_get_clean_target,%)
85 $(call gb_Gallery_get_clean_target,%) :
86 $(call gb_Output_announce,$*,$(false),GAL,1)
87 $(call gb_Helper_abbreviate_dirs,\
88 rm -rf \
89 $(call gb_Gallery__get_final_target,$*) \
90 $(call gb_Gallery_get_target,$*) \
91 $(call gb_Gallery_get_target,$*).log \
92 $(call gb_Gallery_get_workdir,$*) \
95 # the theme package
96 gb_Gallery_get_packagename = Gallery/$(1)
97 # the files package
98 gb_Gallery_get_files_packagename = Gallery/Files/$(1)
100 # Create a gallery.
102 # basedir less one directory will be stripped from paths of the files when they are
103 # inserted into the gallery.
105 # gb_Gallery_Gallery gallery basedir name
106 define gb_Gallery_Gallery
107 $(call gb_Gallery__Gallery_impl,$(1),$(call gb_Gallery_get_packagename,$(1)),$(2),$(3))
109 # setup the files package - we install all of these too
110 $(call gb_Package_Package_internal,$(call gb_Gallery_get_files_packagename,$(1)),$(SRCDIR)/$(2))
111 $(call gb_Gallery__get_final_target,$(1)) : $(call gb_Package_get_target,$(call gb_Gallery_get_files_packagename,$(1)))
112 $(call gb_Gallery_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(call gb_Gallery_get_files_packagename,$(1)))
114 endef
117 gb_Gallery_basedir = $(patsubst %/,%,$(dir $(SRCDIR)/$(1)))
119 # TODO: we process the same ulf file for every gallery. That does not
120 # make sense.
122 # gb_Gallery__Gallery_impl gallery package basedir name
123 define gb_Gallery__Gallery_impl
124 $(call gb_Package_Package_internal,$(2),$(call gb_Gallery_get_workdir,$(1)))
125 $(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdg,$(1).sdg)
126 $(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdv,$(1).sdv)
127 $(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).thm,$(1).thm)
128 $(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).str,$(1).str)
130 # strip URL, without / to help the internal gallery system
131 $(call gb_Gallery_get_target,$(1)) : GALLERY_BASEDIR := $(call gb_Helper_make_url,$(call gb_Gallery_basedir,$(3)))
132 $(call gb_Gallery_get_target,$(1)) : GALLERY_FILES :=
133 $(call gb_Gallery_get_target,$(1)) : GALLERY_NAME := $(1)
134 $(call gb_Gallery_get_workdir,$(1))/$(1).str : GALLERY_STRFILE := $(SRCDIR)/$(3)/$(1).str
135 $(call gb_Gallery_get_workdir,$(1))/$(1).str : GALLERY_ULFFILE := $(call gb_Gallery_get_workdir,$(1))/$(1).ulf
136 $(call gb_Gallery_get_workdir,$(1))/$(1).str : GALLERY_WORKDIR := $(call gb_Gallery_get_workdir,$(1))
137 $(call gb_Gallery_get_workdir,$(1))/$(1).ulf : GALLERY_BASEDIR := $(3)
138 $(call gb_Gallery_get_workdir,$(1))/$(1).ulf : GALLERY_ULFFILE := $(call gb_Gallery_basedir,$(3))/share/gallery_names.ulf
140 $(call gb_Gallery_get_workdir,$(1))/$(1).ulf : \
141 $(call gb_Gallery_basedir,$(3))/share/gallery_names.ulf \
142 $(call gb_Gallery_get_target,$(1)) # that rule pre-cleans our output directory
144 $(call gb_Gallery_get_workdir,$(1))/$(1).str : $(call gb_Gallery_get_workdir,$(1))/$(1).ulf
146 $(call gb_Gallery_get_workdir,$(1))/$(1).sdg \
147 $(call gb_Gallery_get_workdir,$(1))/$(1).sdv \
148 $(call gb_Gallery_get_workdir,$(1))/$(1).thm : $(call gb_Gallery_get_target,$(1))
149 $(call gb_Gallery__get_final_target,$(1)) : $(call gb_Package_get_target,$(2))
151 $(call gb_Gallery_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(2))
152 $(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).dir \
153 $(call gb_Gallery_get_workdir,$(1))/.dir
155 $$(eval $$(call gb_Module_register_target,$(call gb_Gallery__get_final_target,$(1)),$(call gb_Gallery_get_clean_target,$(1))))
156 $(call gb_Helper_make_userfriendly_targets,$(1),Gallery,$(call gb_Gallery__get_final_target,$(1)))
158 endef
160 # Add a file to the gallery.
162 # The file is given by path relative to $(SRCDIR).
164 # gb_Gallery_add_file gallery file
165 define gb_Gallery_add_file
166 $(call gb_Gallery_get_target,$(1)) : $(SRCDIR)/$(3)
167 $(call gb_Gallery_get_target,$(1)) : GALLERY_FILES += $(call gb_Helper_make_url,$(SRCDIR)/$(3))
168 $(call gb_Package_add_file,$(call gb_Gallery_get_files_packagename,$(1)),$(2)/$(notdir $(3)),$(notdir $(3)))
170 endef
172 # Add several files to the gallery at once.
174 # The files are given by path relative to $(SRCDIR).
176 # gb_Gallery_add_files gallery file(s)
177 define gb_Gallery_add_files
178 $(foreach fname,$(3),$(call gb_Gallery_add_file,$(1),$(2),$(fname)))
180 endef
182 # vim: set noet sw=4 ts=4: