tdf#119856: thread-proof creating frames and setting menus
[LibreOffice.git] / sysui / CustomTarget_share.mk
blobd4f24b5f8e6004eedec33faf240a0af08e9000fc
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 include $(SRCDIR)/sysui/productlist.mk
13 ifeq ($(ENABLE_GIO),TRUE)
14 brand_URIPARAM := --urls
15 else ifeq ($(ENABLE_KDE4),TRUE)
16 brand_URIPARAM := --urls
17 else ifeq ($(ENABLE_QT5),TRUE)
18 brand_URIPARAM := --urls
19 else
20 brand_URIPARAM :=
21 endif
23 share_WORKDIR := $(call gb_CustomTarget_get_workdir,sysui/share)
24 share_SRCDIR := $(SRCDIR)/sysui/desktop
26 share_TRANSLATE := $(SRCDIR)/solenv/bin/desktop-translate.pl
28 LAUNCHERLIST_APPS := writer calc draw impress math base startcenter
29 LAUNCHERLIST := $(LAUNCHERLIST_APPS) xsltfilter
30 LAUNCHERS := $(foreach launcher,$(LAUNCHERLIST),$(share_SRCDIR)/menus/$(launcher).desktop)
32 MIMELIST := \
33 text \
34 text-template \
35 spreadsheet \
36 spreadsheet-template \
37 drawing \
38 drawing-template \
39 presentation \
40 presentation-template \
41 formula \
42 master-document \
43 oasis-text \
44 oasis-text-template \
45 oasis-text-flat-xml \
46 oasis-spreadsheet \
47 oasis-spreadsheet-template \
48 oasis-spreadsheet-flat-xml \
49 oasis-drawing \
50 oasis-drawing-template \
51 oasis-drawing-flat-xml \
52 oasis-presentation \
53 oasis-presentation-template \
54 oasis-presentation-flat-xml \
55 oasis-formula \
56 oasis-master-document \
57 oasis-master-document-template \
58 oasis-database \
59 oasis-web-template \
60 ms-excel-sheet-12 \
61 ms-excel-sheet \
62 ms-excel-template-12 \
63 ms-powerpoint-presentation-12 \
64 ms-powerpoint-presentation \
65 ms-powerpoint-template-12 \
66 ms-word-document-12 \
67 ms-word-document \
68 ms-word-document2 \
69 ms-word-template-12 \
70 openxmlformats-officedocument-presentationml-presentation \
71 openxmlformats-officedocument-presentationml-template \
72 openxmlformats-officedocument-spreadsheetml-sheet \
73 openxmlformats-officedocument-spreadsheetml-template \
74 openxmlformats-officedocument-wordprocessingml-document \
75 openxmlformats-officedocument-wordprocessingml-template \
76 ms-excel-sheet-binary-12 \
77 extension
79 MIMEICONLIST := \
80 oasis-text \
81 oasis-text-template \
82 oasis-spreadsheet \
83 oasis-spreadsheet-template \
84 oasis-drawing \
85 oasis-drawing-template \
86 oasis-presentation \
87 oasis-presentation-template \
88 oasis-formula \
89 oasis-master-document \
90 oasis-master-document-template \
91 oasis-database \
92 oasis-web-template \
93 text \
94 text-template \
95 spreadsheet \
96 spreadsheet-template \
97 drawing \
98 drawing-template \
99 presentation \
100 presentation-template \
101 formula \
102 master-document \
103 database \
104 extension
106 share_ICONS := $(foreach size,16x16 32x32 48x48,\
107 $(foreach contrast,hicolor locolor,\
108 $(foreach app,$(LAUNCHERLIST_APPS),\
109 $(share_SRCDIR)/icons/$(contrast)/$(size)/apps/$(app).png) \
110 $(foreach mime,$(MIMEICONLIST),\
111 $(share_SRCDIR)/icons/$(contrast)/$(size)/mimetypes/$(mime).png)))
113 MIMEKEYS := $(foreach mime,$(MIMELIST),$(share_SRCDIR)/mimetypes/$(mime).keys)
114 MIMEDESKTOPS := $(foreach mime,$(MIMELIST),$(share_SRCDIR)/mimetypes/$(mime).desktop)
115 ULFS := documents.ulf \
116 launcher_comment.ulf \
117 launcher_genericname.ulf \
118 launcher_unityquicklist.ulf
120 $(eval $(call gb_CustomTarget_CustomTarget,sysui/share))
122 $(eval $(call gb_CustomTarget_register_targets,sysui/share,\
123 $(ULFS) \
124 $(foreach product,$(PRODUCTLIST),\
125 $(product)/build.flag \
126 $(product)/openoffice.org.xml \
127 $(product)/openoffice.mime \
128 $(product)/openoffice.applications \
129 $(product)/openoffice.keys \
130 $(product)/openoffice.sh \
131 $(product)/create_tree.sh \
132 $(product)/launcherlist) \
135 $(share_WORKDIR)/%/openoffice.org.xml: $(share_WORKDIR)/documents.ulf $(MIMEDESKTOPS) $(share_SRCDIR)/share/create_mime_xml.pl
136 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
137 $(PERL) $(share_SRCDIR)/share/create_mime_xml.pl $< > $@
140 $(share_WORKDIR)/%/openoffice.keys: \
141 $(share_SRCDIR)/mimetypes/openoffice.mime $(MIMEKEYS) $(share_SRCDIR)/share/brand.pl \
142 $(share_TRANSLATE) $(share_WORKDIR)/documents.ulf
143 mkdir -p $(dir $@)
144 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
145 $(PERL) $(share_SRCDIR)/share/brand.pl -p $* -u $(UNIXFILENAME.$*) \
146 --iconprefix $(UNIXFILENAME.$*)- $^ $(share_WORKDIR)/$*
147 $(PERL) $(share_TRANSLATE) -p $* -d $(share_WORKDIR)/$* \
148 --ext "keys" --key "description" $(share_WORKDIR)/documents.ulf
149 cat $(MIMEKEYS) > $@
151 $(share_WORKDIR)/%/openoffice.mime: $(share_SRCDIR)/mimetypes/openoffice.mime
152 mkdir -p $(dir $@)
153 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
154 cat $< | tr -d "\015" > $@
156 $(share_WORKDIR)/%/openoffice.sh: $(share_SRCDIR)/share/openoffice.sh
157 mkdir -p $(dir $@)
158 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
159 cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$*)/g" > $@
161 $(share_WORKDIR)/%/create_tree.sh: $(share_SRCDIR)/share/create_tree.sh \
162 $(share_WORKDIR)/%/openoffice.org.xml $(share_WORKDIR)/%/openoffice.applications $(share_WORKDIR)/%/openoffice.mime \
163 $(share_WORKDIR)/%/openoffice.keys $(share_WORKDIR)/%/launcherlist $(if $(INTROSPECTION_SCANNER),$(call gb_Library_get_target,libreofficekitgtk))
164 mkdir -p $(dir $@)
165 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
166 echo "#!/bin/sh" > $@
167 echo "PREFIX=$(UNIXFILENAME.$*)" >> $@
168 echo "ICON_PREFIX=$(UNIXFILENAME.$*)" >> $@
169 echo "ICON_SOURCE_DIR=$(SRCDIR)/sysui/desktop/icons" >> $@
170 echo "APPDATA_SOURCE_DIR=$(SRCDIR)/sysui/desktop/appstream-appdata" >> $@
171 echo "PRODUCTVERSION=$(PRODUCTVERSION)" >> $@
172 echo "INTROSPECTION_SCANNER=$(INTROSPECTION_SCANNER)" >> $@
173 cat $< >> $@
174 chmod 774 $@
177 $(share_WORKDIR)/%/launcherlist: $(LAUNCHERS)
178 mkdir -p $(dir $@)
179 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
180 echo "$(addsuffix .desktop,$(LAUNCHERLIST))" > $@
183 $(share_WORKDIR)/%/openoffice.applications: $(share_SRCDIR)/mimetypes/openoffice.applications
184 mkdir -p $(dir $@)
185 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
186 cat $< | tr -d "\015" | sed -e "s/OFFICENAME/$(UNIXFILENAME.$*)/" -e "s/%PRODUCTNAME/$(PRODUCTNAME.$*) $(PRODUCTVERSION.$*)/" > $@
188 # these .desktop files are written by brand.pl below
189 # need to have a rule for these because they are targets in Package_share
190 define sysui_Desktop_rule
191 $(share_WORKDIR)/%/$(1).desktop : $(share_WORKDIR)/%/build.flag
192 touch $$@
194 endef
196 $(foreach launcher,$(LAUNCHERLIST),$(eval $(call sysui_Desktop_rule,$(launcher))))
198 $(share_WORKDIR)/%/build.flag: $(share_SRCDIR)/share/brand.pl $(LAUNCHERS) \
199 $(share_TRANSLATE) $(addprefix $(share_WORKDIR)/,$(ULFS))
200 mkdir -p $(dir $@)
201 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
202 $(PERL) $(share_SRCDIR)/share/brand.pl -p '$${PRODUCTNAME} $${PRODUCTVERSION}' -u $(UNIXFILENAME.$*) \
203 $(brand_URIPARAM) \
204 --iconprefix '$${UNIXBASISROOTNAME}-' $^ $(share_WORKDIR)/$*
205 $(PERL) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
206 --ext "desktop" --key "Comment" $(share_WORKDIR)/launcher_comment.ulf
207 $(PERL) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
208 --ext "desktop" --key "GenericName" $(share_WORKDIR)/launcher_genericname.ulf
209 $(PERL) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
210 --ext "desktop" --key "UnityQuickList" $(share_WORKDIR)/launcher_unityquicklist.ulf
211 touch $@
213 $(eval $(call gb_CustomTarget_ulfex_rule,\
214 $(share_WORKDIR)/%.ulf,\
215 $(share_SRCDIR)/share/%.ulf,\
216 $(foreach lang,$(gb_TRANS_LANGS),\
217 $(gb_POLOCATION)/$(lang)/sysui/desktop/share.po)))
219 # vim: set noet sw=4 ts=4: