Send various state changes to LOK
[LibreOffice.git] / sysui / CustomTarget_share.mk
blobf4c38f813a09883702c61140021600f5f39e450c
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_QT5),TRUE)
16 brand_URIPARAM := --urls
17 else
18 brand_URIPARAM :=
19 endif
21 share_WORKDIR := $(call gb_CustomTarget_get_workdir,sysui/share)
22 share_SRCDIR := $(SRCDIR)/sysui/desktop
24 share_TRANSLATE := $(SRCDIR)/solenv/bin/desktop-translate.py
26 LAUNCHERLIST_APPS := writer calc draw impress math base startcenter
27 LAUNCHERLIST := $(LAUNCHERLIST_APPS) xsltfilter
28 LAUNCHERS := $(foreach launcher,$(LAUNCHERLIST),$(share_SRCDIR)/menus/$(launcher).desktop)
30 MIMELIST := \
31 text \
32 text-template \
33 spreadsheet \
34 spreadsheet-template \
35 drawing \
36 drawing-template \
37 presentation \
38 presentation-template \
39 formula \
40 master-document \
41 oasis-text \
42 oasis-text-template \
43 oasis-text-flat-xml \
44 oasis-spreadsheet \
45 oasis-spreadsheet-template \
46 oasis-spreadsheet-flat-xml \
47 oasis-drawing \
48 oasis-drawing-template \
49 oasis-drawing-flat-xml \
50 oasis-presentation \
51 oasis-presentation-template \
52 oasis-presentation-flat-xml \
53 oasis-formula \
54 oasis-master-document \
55 oasis-master-document-template \
56 oasis-database \
57 oasis-web-template \
58 ms-excel-sheet-12 \
59 ms-excel-sheet \
60 ms-excel-template-12 \
61 ms-powerpoint-presentation-12 \
62 ms-powerpoint-presentation \
63 ms-powerpoint-template-12 \
64 ms-word-document-12 \
65 ms-word-document \
66 ms-word-document2 \
67 ms-word-template-12 \
68 openxmlformats-officedocument-presentationml-presentation \
69 openxmlformats-officedocument-presentationml-template \
70 openxmlformats-officedocument-spreadsheetml-sheet \
71 openxmlformats-officedocument-spreadsheetml-template \
72 openxmlformats-officedocument-wordprocessingml-document \
73 openxmlformats-officedocument-wordprocessingml-template \
74 ms-excel-sheet-binary-12 \
75 extension
77 MIMEICONLIST := \
78 oasis-text \
79 oasis-text-template \
80 oasis-spreadsheet \
81 oasis-spreadsheet-template \
82 oasis-drawing \
83 oasis-drawing-template \
84 oasis-presentation \
85 oasis-presentation-template \
86 oasis-formula \
87 oasis-master-document \
88 oasis-master-document-template \
89 oasis-database \
90 oasis-web-template \
91 text \
92 text-template \
93 spreadsheet \
94 spreadsheet-template \
95 drawing \
96 drawing-template \
97 presentation \
98 presentation-template \
99 formula \
100 master-document \
101 database \
102 extension
104 share_ICONS := $(foreach size,16x16 32x32 48x48,\
105 $(foreach contrast,hicolor locolor,\
106 $(foreach app,$(LAUNCHERLIST_APPS),\
107 $(share_SRCDIR)/icons/$(contrast)/$(size)/apps/$(app).png) \
108 $(foreach mime,$(MIMEICONLIST),\
109 $(share_SRCDIR)/icons/$(contrast)/$(size)/mimetypes/$(mime).png)))
111 MIMEKEYS := $(foreach mime,$(MIMELIST),$(share_SRCDIR)/mimetypes/$(mime).keys)
112 MIMEDESKTOPS := $(foreach mime,$(MIMELIST),$(share_SRCDIR)/mimetypes/$(mime).desktop)
113 ULFS := documents.ulf \
114 launcher_comment.ulf \
115 launcher_genericname.ulf \
116 launcher_unityquicklist.ulf
118 $(eval $(call gb_CustomTarget_CustomTarget,sysui/share))
120 $(eval $(call gb_CustomTarget_register_targets,sysui/share,\
121 $(ULFS) \
122 $(foreach product,$(PRODUCTLIST),\
123 $(product)/build.flag \
124 $(product)/openoffice.org.xml \
125 $(product)/openoffice.mime \
126 $(product)/openoffice.applications \
127 $(product)/openoffice.keys \
128 $(product)/openoffice.sh \
129 $(product)/create_tree.sh \
130 $(if $(INTROSPECTION_SCANNER),\
131 $(product)/LOKDocView-0.1.gir \
132 $(product)/LOKDocView-0.1.typelib) \
133 $(product)/launcherlist) \
136 $(share_WORKDIR)/%/openoffice.org.xml: $(share_WORKDIR)/documents.ulf $(MIMEDESKTOPS) $(share_SRCDIR)/share/create_mime_xml.pl
137 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
138 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
139 $(PERL) $(share_SRCDIR)/share/create_mime_xml.pl $< > $@
140 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
142 $(share_WORKDIR)/%/openoffice.keys: \
143 $(share_SRCDIR)/mimetypes/openoffice.mime $(MIMEKEYS) $(share_SRCDIR)/share/brand.pl \
144 $(share_TRANSLATE) $(share_WORKDIR)/documents.ulf \
145 $(call gb_ExternalExecutable_get_dependencies,python)
146 mkdir -p $(dir $@)
147 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
148 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
149 $(PERL) $(share_SRCDIR)/share/brand.pl -p $* -u $(UNIXFILENAME.$*) \
150 --iconprefix $(UNIXFILENAME.$*)- $(MIMEKEYS) $(share_WORKDIR)/$*
151 $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) \
152 -p $* -d $(share_WORKDIR)/$* \
153 --ext "keys" --key "description" $(share_WORKDIR)/documents.ulf
154 cat $(MIMEKEYS) > $@
155 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
157 $(share_WORKDIR)/%/openoffice.mime: $(share_SRCDIR)/mimetypes/openoffice.mime
158 mkdir -p $(dir $@)
159 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
160 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CAT)
161 cat $< | tr -d "\015" > $@
162 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),CAT)
164 $(share_WORKDIR)/%/openoffice.sh: $(share_SRCDIR)/share/openoffice.sh
165 mkdir -p $(dir $@)
166 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
167 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CAT)
168 cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$*)/g" > $@
169 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),CAT)
171 $(share_WORKDIR)/%/create_tree.sh: $(share_SRCDIR)/share/create_tree.sh \
172 $(share_WORKDIR)/%/openoffice.org.xml $(share_WORKDIR)/%/openoffice.applications $(share_WORKDIR)/%/openoffice.mime \
173 $(share_WORKDIR)/%/openoffice.keys $(share_WORKDIR)/%/launcherlist
174 mkdir -p $(dir $@)
175 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
176 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CAT)
177 echo "#!/bin/sh" > $@
178 echo "PREFIX=$(UNIXFILENAME.$*)" >> $@
179 echo "ICON_PREFIX=$(UNIXFILENAME.$*)" >> $@
180 echo "ICON_SOURCE_DIR=$(SRCDIR)/sysui/desktop/icons" >> $@
181 echo "APPDATA_SOURCE_DIR=$(SRCDIR)/sysui/desktop/appstream-appdata" >> $@
182 echo "PRODUCTVERSION=$(PRODUCTVERSION)" >> $@
183 cat $< >> $@
184 chmod 774 $@
185 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),CAT)
187 # Generate gobject-introspection files
188 # These are *not* packaged in rpms because there's no good place to put them
189 # where the system will actually find them and where it won't conflict with a
190 # distro packaged LO; on Fedora 30 at least there's no /opt path in
191 # $XDG_DATA_DIRS
192 ifneq ($(INTROSPECTION_SCANNER),)
194 $(share_WORKDIR)/%/LOKDocView-0.1.gir: \
195 $(call gb_Library_get_target,libreofficekitgtk)
196 mkdir -p $(dir $@)
197 g-ir-scanner "${SRCDIR}/include/LibreOfficeKit/LibreOfficeKitGtk.h" \
198 "${SRCDIR}/libreofficekit/source/gtk/lokdocview.cxx" \
199 `${PKG_CONFIG} --cflags gobject-introspection-1.0 gtk+-3.0` \
200 -I"${SRCDIR}/include/" \
201 --include=GLib-2.0 --include=GObject-2.0 --include=Gio-2.0 \
202 --library=libreofficekitgtk --library-path="${INSTDIR}/program" \
203 --include=Gdk-3.0 --include=GdkPixbuf-2.0 --include=Gtk-3.0 \
204 --namespace=LOKDocView --nsversion=0.1 --identifier-prefix=LOKDoc --symbol-prefix=lok_doc \
205 --c-include="LibreOfficeKit/LibreOfficeKitGtk.h" \
206 --output="$@" --warn-all --no-libtool
208 $(share_WORKDIR)/%/LOKDocView-0.1.typelib: $(share_WORKDIR)/%/LOKDocView-0.1.gir
209 g-ir-compiler "$<" --output="$@"
211 endif
213 $(share_WORKDIR)/%/launcherlist: $(LAUNCHERS)
214 mkdir -p $(dir $@)
215 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
216 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH)
217 echo "$(addsuffix .desktop,$(LAUNCHERLIST))" > $@
218 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH)
221 $(share_WORKDIR)/%/openoffice.applications: $(share_SRCDIR)/mimetypes/openoffice.applications
222 mkdir -p $(dir $@)
223 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,1)
224 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CAT)
225 cat $< | tr -d "\015" | sed -e "s/OFFICENAME/$(UNIXFILENAME.$*)/" -e "s/%PRODUCTNAME/$(PRODUCTNAME.$*) $(PRODUCTVERSION.$*)/" > $@
226 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),CAT)
228 # these .desktop files are written by brand.pl below
229 # need to have a rule for these because they are targets in Package_share
230 define sysui_Desktop_rule
231 $(share_WORKDIR)/%/$(1).desktop : $(share_WORKDIR)/%/build.flag
232 touch $$@
234 endef
236 $(foreach launcher,$(LAUNCHERLIST),$(eval $(call sysui_Desktop_rule,$(launcher))))
238 $(share_WORKDIR)/%/build.flag: $(share_SRCDIR)/share/brand.pl $(LAUNCHERS) \
239 $(share_TRANSLATE) $(addprefix $(share_WORKDIR)/,$(ULFS)) \
240 $(call gb_ExternalExecutable_get_dependencies,python)
241 mkdir -p $(dir $@)
242 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
243 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
244 $(PERL) $(share_SRCDIR)/share/brand.pl -p '$${PRODUCTNAME} $${PRODUCTVERSION}' -u $(UNIXFILENAME.$*) \
245 $(brand_URIPARAM) \
246 --iconprefix '$${UNIXBASISROOTNAME}-' $(LAUNCHERS) $(share_WORKDIR)/$*
247 $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
248 --ext "desktop" --key "Comment" $(share_WORKDIR)/launcher_comment.ulf
249 $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
250 --ext "desktop" --key "GenericName" $(share_WORKDIR)/launcher_genericname.ulf
251 $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
252 --ext "desktop" --key "UnityQuickList" $(share_WORKDIR)/launcher_unityquicklist.ulf
253 touch $@
254 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
256 $(eval $(call gb_CustomTarget_ulfex_rule,\
257 $(share_WORKDIR)/%.ulf,\
258 $(share_SRCDIR)/share/%.ulf,\
259 $(foreach lang,$(gb_TRANS_LANGS),\
260 $(gb_POLOCATION)/$(lang)/sysui/desktop/share.po)))
262 # vim: set noet sw=4 ts=4: