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/.
12 # Handles creation of image galleries.
14 gb_Gallery_TRANSLATE
:= $(SRCDIR
)/solenv
/bin
/desktop-translate.pl
15 gb_Gallery_INSTDIR
:= $(LIBO_SHARE_FOLDER
)/gallery
17 # BRAND_BASE_DIR is for resource files
18 define gb_Gallery__make_env_args
19 "-env:BRAND_BASE_DIR=$(call gb_Helper_make_url,$(INSTROOT_FOR_BUILD))" \
20 "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_Helper_make_url,$(INSTROOT)/$(LIBO_SHARE_FOLDER)/registry)" \
21 "-env:UNO_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_target_for_build,ure/services)) \
22 $(foreach item,$(gb_Gallery__UNO_COMPONENTS),\
23 $(call gb_Helper_make_url,$(call gb_ComponentTarget_get_target_for_build,$(item))))" \
24 "-env:UNO_TYPES=$(foreach item,offapi udkapi,\
25 $(call gb_Helper_make_url,$(call gb_UnoApi_get_target,$(item))))" \
26 -env
:URE_INTERNAL_LIB_DIR
=$(call gb_Helper_make_url
,$(INSTROOT_FOR_BUILD
)/$(LIBO_URE_LIB_FOLDER_FOR_BUILD
)) \
27 -env
:LO_LIB_DIR
=$(call gb_Helper_make_url
,$(INSTROOT_FOR_BUILD
)/$(LIBO_LIB_FOLDER_FOR_BUILD
))
30 define gb_Gallery__command
31 $(call gb_Output_announce
,$(2),$(true
),GAL
,1)
32 $(call gb_Helper_abbreviate_dirs
,\
33 rm -f
$(call gb_Gallery_get_workdir
,$(2))/* && \
34 RESPONSEFILE
=$(call var2file
,$(shell $(call gb_MKTEMP
)),100,$(GALLERY_FILES
)) && \
35 $(call gb_Helper_print_on_error
,\
36 $(if
$(filter-out MACOSX WNT
,$(OS_FOR_BUILD
)),$(if
$(ENABLE_HEADLESS
),, \
37 SAL_USE_VCLPLUGIN
=svp \
39 $(call gb_Executable_get_command
,gengal
,$(ICECREAM_RUN
)) \
40 $(call gb_Gallery__make_env_args
) \
42 --destdir
$(GALLERY_BASEDIR
) \
43 --name
"$(GALLERY_NAME)" \
44 --path
$(call gb_Gallery_get_workdir
,$(2)) \
45 --filenames
$(call gb_Helper_make_url
,$$RESPONSEFILE),\
48 rm $$RESPONSEFILE && \
53 define gb_Gallery__command_str
54 $(call gb_Output_announce
,$(2),$(true
),STR
,1)
55 cp
-f
$(GALLERY_STRFILE
) $@
&& \
56 $(PERL
) $(gb_Gallery_TRANSLATE
) \
57 --ext
"str" --key
"name" \
58 -d
$(GALLERY_WORKDIR
) \
62 gb_Gallery__get_final_target
= $(WORKDIR
)/Gallery
/$(1).final
64 $(dir $(call gb_Gallery_get_target
,$(1))).
dir :
65 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
67 $(dir $(call gb_Gallery_get_target
,$(1)))%/.
dir :
68 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
70 $(call gb_Gallery_get_target
,%) : \
71 $(call gb_Executable_get_runtime_dependencies
,gengal
)
72 $(call gb_Gallery__command
,$@
,$*)
74 $(call gb_Gallery__get_final_target
,%) :
77 # difficult to determine source dep for this one...
78 $(call gb_Gallery_get_workdir
,%).ulf
: \
79 $(call gb_Executable_get_runtime_dependencies
,ulfex
)
80 $(call gb_CustomTarget_ulfex__command
,$@
,$(GALLERY_ULFFILE
),\
81 $(foreach lang
,$(gb_TRANS_LANGS
),\
82 $(gb_POLOCATION
)/$(lang
)/extras
/source
/gallery
/share.po
))
84 $(call gb_Gallery_get_workdir
,%).str
: $(gb_Gallery_TRANSLATE
)
85 $(call gb_Gallery__command_str
,$@
,$*)
87 # there must be a rule for these since they are targets due to Package
88 $(call gb_Gallery_get_workdir
,%).sdg
:
90 $(call gb_Gallery_get_workdir
,%).sdv
:
92 $(call gb_Gallery_get_workdir
,%).thm
:
95 .PHONY
: $(call gb_Gallery_get_clean_target
,%)
96 $(call gb_Gallery_get_clean_target
,%) :
97 $(call gb_Output_announce
,$*,$(false
),GAL
,1)
98 $(call gb_Helper_abbreviate_dirs
,\
100 $(call gb_Gallery__get_final_target
,$*) \
101 $(call gb_Gallery_get_target
,$*) \
102 $(call gb_Gallery_get_target
,$*).log \
103 $(call gb_Gallery_get_workdir
,$*) \
107 gb_Gallery_get_packagename
= Gallery
/$(1)
109 gb_Gallery_get_files_packagename
= Gallery
/Files
/$(1)
113 # basedir less one directory will be stripped from paths of the files when they are
114 # inserted into the gallery.
116 # gb_Gallery_Gallery gallery basedir name
117 define gb_Gallery_Gallery
118 $(call gb_Gallery__Gallery_impl
,$(1),$(call gb_Gallery_get_packagename
,$(1)),$(2),$(3))
120 # setup the files package - we install all of these too
121 $(call gb_Package_Package_internal
,$(call gb_Gallery_get_files_packagename
,$(1)),$(SRCDIR
)/$(2))
122 $(call gb_Gallery__get_final_target
,$(1)) : $(call gb_Package_get_target
,$(call gb_Gallery_get_files_packagename
,$(1)))
123 $(call gb_Gallery_get_clean_target
,$(1)) : $(call gb_Package_get_clean_target
,$(call gb_Gallery_get_files_packagename
,$(1)))
128 gb_Gallery_basedir
= $(patsubst %/,%,$(dir $(SRCDIR
)/$(1)))
130 # TODO: we process the same ulf file for every gallery. That does not
133 # gb_Gallery__Gallery_impl gallery package basedir name
134 define gb_Gallery__Gallery_impl
135 $(call gb_Package_Package_internal
,$(2),$(call gb_Gallery_get_workdir
,$(1)))
136 $(call gb_Package_add_file
,$(2),$(gb_Gallery_INSTDIR
)/$(1).sdg
,$(1).sdg
)
137 $(call gb_Package_add_file
,$(2),$(gb_Gallery_INSTDIR
)/$(1).sdv
,$(1).sdv
)
138 $(call gb_Package_add_file
,$(2),$(gb_Gallery_INSTDIR
)/$(1).thm
,$(1).thm
)
139 $(call gb_Package_add_file
,$(2),$(gb_Gallery_INSTDIR
)/$(1).str
,$(1).str
)
141 # strip URL, without / to help the internal gallery system
142 $(call gb_Gallery_get_target
,$(1)) : GALLERY_BASEDIR
:= $(call gb_Helper_make_url
,$(call gb_Gallery_basedir
,$(3)))
143 $(call gb_Gallery_get_target
,$(1)) : GALLERY_FILES
:=
144 $(call gb_Gallery_get_target
,$(1)) : GALLERY_NAME
:= $(1)
145 $(call gb_Gallery_get_workdir
,$(1))/$(1).str
: GALLERY_STRFILE
:= $(SRCDIR
)/$(3)/$(1).str
146 $(call gb_Gallery_get_workdir
,$(1))/$(1).str
: GALLERY_ULFFILE
:= $(call gb_Gallery_get_workdir
,$(1))/$(1).ulf
147 $(call gb_Gallery_get_workdir
,$(1))/$(1).str
: GALLERY_WORKDIR
:= $(call gb_Gallery_get_workdir
,$(1))
148 $(call gb_Gallery_get_workdir
,$(1))/$(1).ulf
: GALLERY_BASEDIR
:= $(3)
149 $(call gb_Gallery_get_workdir
,$(1))/$(1).ulf
: GALLERY_ULFFILE
:= $(call gb_Gallery_basedir
,$(3))/share
/gallery_names.ulf
151 $(call gb_Gallery_get_workdir
,$(1))/$(1).ulf
: \
152 $(call gb_Gallery_basedir
,$(3))/share
/gallery_names.ulf \
153 $(call gb_Gallery_get_target
,$(1)) # that rule pre-cleans our output directory
155 $(call gb_Gallery_get_workdir
,$(1))/$(1).str
: $(call gb_Gallery_get_workdir
,$(1))/$(1).ulf
157 $(call gb_Gallery_get_workdir
,$(1))/$(1).sdg \
158 $(call gb_Gallery_get_workdir
,$(1))/$(1).sdv \
159 $(call gb_Gallery_get_workdir
,$(1))/$(1).thm
: $(call gb_Gallery_get_target
,$(1))
160 $(call gb_Gallery__get_final_target
,$(1)) : $(call gb_Package_get_target
,$(2))
162 $(call gb_Gallery_get_clean_target
,$(1)) : $(call gb_Package_get_clean_target
,$(2))
163 $(call gb_Gallery_get_target
,$(1)) :|
$(dir $(call gb_Gallery_get_target
,$(1))).
dir \
164 $(call gb_Gallery_get_workdir
,$(1))/.
dir
166 $$(eval
$$(call gb_Module_register_target
,$(call gb_Gallery__get_final_target
,$(1)),$(call gb_Gallery_get_clean_target
,$(1))))
167 $(call gb_Helper_make_userfriendly_targets
,$(1),Gallery
,$(call gb_Gallery__get_final_target
,$(1)))
171 # Add a file to the gallery.
173 # The file is given by path relative to $(SRCDIR).
175 # gb_Gallery_add_file gallery file
176 define gb_Gallery_add_file
177 $(call gb_Gallery_get_target
,$(1)) : $(SRCDIR
)/$(3)
178 $(call gb_Gallery_get_target
,$(1)) : GALLERY_FILES
+= $(call gb_Helper_make_url
,$(SRCDIR
)/$(3))
179 $(call gb_Package_add_file
,$(call gb_Gallery_get_files_packagename
,$(1)),$(2)/$(notdir $(3)),$(notdir $(3)))
183 # Add several files to the gallery at once.
185 # The files are given by path relative to $(SRCDIR).
187 # gb_Gallery_add_files gallery file(s)
188 define gb_Gallery_add_files
189 $(foreach fname
,$(3),$(call gb_Gallery_add_file
,$(1),$(2),$(fname
)))
193 # vim: set noet sw=4 ts=4: