2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 # version and release passed by command-line
21 Summary: %productname desktop integration
22 Name: %pkgprefix-freedesktop
-menus
26 License: LGPLv3 with MPLv2
, ALv2 and others
27 Provides: collaboraoffice
-desktop
-integration
28 Provides: libreoffice
-desktop
-integration
29 Conflicts: %pkgprefix-suse
-menus
30 Conflicts: %pkgprefix-debian
-menus
31 Conflicts: %pkgprefix-redhat
-menus
32 Conflicts: %pkgprefix-mandriva
-menus
35 %define _binary_filedigest_algorithm
1
36 %define _binary_payload w1T.xzdio
38 %define gnome_dir
/usr
40 # only symlinks in the package that at the time of building point to non-existing files
41 %global dont_check_desktop_files
1
44 %productname desktop integration
for desktop
-environments that implement
45 the menu
- and mime
-related specifications from http
://www.freedesktop.org
46 These specifications are implemented by all current distributions.
49 rm -rf $RPM_BUILD_ROOT
51 # hack/workaround to make SuSE's brp-symlink-script happy. It wants the targets of all links
52 # to be present on the build-system/the buildroot. But the point is that we generate stale
53 # links intentionally (until we find a better solution) #46226
54 export NO_BRP_STALE_LINK_ERROR
=yes
56 mkdir -p $RPM_BUILD_ROOT
58 # set parameters for the create_tree script
59 export DESTDIR
=$RPM_BUILD_ROOT
60 export KDEMAINDIR
=/usr
62 export BINDIR
=/usr
/bin
68 # freedesktop-based desktop-environments don't need/use this.
69 rm -rf usr
/share
/applications.flag
70 rm -rf usr
/share
/applnk
-redhat
71 #find usr/share/icons -name '*.png' -exec chmod g+w {} \;
74 rm -rf $RPM_BUILD_ROOT
76 %triggerin -- %pkgprefix, %pkgprefix-writer
, %pkgprefix-calc
, %pkgprefix-draw
, %pkgprefix-impress
, %pkgprefix-math
77 # this is run when one of the above packages is already installed and the menu
78 # package gets installed OR when the menu-package is already installed and one
79 # of the above listed packages gets installed
81 # Due to a bug in rpm it is not possible to check why the script is triggered...
82 # This is how it should be: 1st arg: number of this package, 2nd arg: number of
83 # package that triggers - the bug is that rpm reports the same number for both
84 # (the value of the 2nd one), so just run this always...
85 # http://rhn.redhat.com/errata/RHBA-2004-098.html
86 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=100509
88 if [ -x
/opt
/gnome
/bin
/update
-desktop
-database
]; then
89 /opt
/gnome
/bin
/update
-desktop
-database
-q
90 elif (which update
-desktop
-database
); then
91 update
-desktop
-database
-q
/usr
/share
/applications
94 %triggerun -- %pkgprefix, %pkgprefix-writer
, %pkgprefix-calc
, %pkgprefix-draw
, %pkgprefix-impress
, %pkgprefix-math
95 if [ "$
1"
= "
0"
] ; then
96 # the menu-package gets uninstalled/updated - postun will run the command
99 if [ "$
2"
= "
0"
] ; then
100 # the triggering package gets removed
101 if [ -x
/opt
/gnome
/bin
/update
-desktop
-database
]; then
102 /opt
/gnome
/bin
/update
-desktop
-database
-q
103 elif (which update
-desktop
-database
); then
104 update
-desktop
-database
-q
/usr
/share
/applications
109 # no need to run it when updating, since %postun of the old package is run
112 if [ "$
1"
= "
1"
] ; then # first install
113 if [ -x
/opt
/gnome
/bin
/update
-desktop
-database
]; then
114 /opt
/gnome
/bin
/update
-desktop
-database
-q
115 elif (which update
-desktop
-database
); then
116 update
-desktop
-database
-q
/usr
/share
/applications
119 if (which update
-mime
-database
); then
120 update
-mime
-database
/usr
/share
/mime
124 # add symlinks so that nautilus can identify the mime-icons
125 # not strictly freedesktop-stuff but there is no common naming scheme yet.
126 # One proposal is "mime-application:vnd.oasis.opendocument.spreadsheet.png"
127 # for e.g. application/vnd.oasis.opendocument.spreadsheet
128 link_root
="
%{gnome_dir}/share
/icons
/hicolor"
130 for subdir
in `
cd $
{link_root
}; ls
--ignore
="
*theme
*"`
132 link_dir
="$
{link_root
}/$subdir
/mimetypes"
134 test -d "$
{link_dir
}" ||
mkdir -p "$
{link_dir
}"
136 icon
=$
{link_dir
}/%iconprefix-drawing.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.draw.png
137 icon
=$
{link_dir
}/%iconprefix-drawing
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.draw.template.png
138 icon
=$
{link_dir
}/%iconprefix-formula.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.math.png
139 icon
=$
{link_dir
}/%iconprefix-master
-document.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.writer.global.png
140 icon
=$
{link_dir
}/%iconprefix-oasis
-database.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.base.png
141 icon
=$
{link_dir
}/%iconprefix-oasis
-database.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.database.png
142 icon
=$
{link_dir
}/%iconprefix-oasis
-drawing.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.graphics.png
143 icon
=$
{link_dir
}/%iconprefix-oasis
-drawing
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.graphics
-template.png
144 icon
=$
{link_dir
}/%iconprefix-oasis
-formula.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.formula.png
145 icon
=$
{link_dir
}/%iconprefix-oasis
-master
-document.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.text
-master.png
146 icon
=$
{link_dir
}/%iconprefix-oasis
-master
-document
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.text
-master
-template.png
147 icon
=$
{link_dir
}/%iconprefix-oasis
-presentation.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.presentation.png
148 icon
=$
{link_dir
}/%iconprefix-oasis
-presentation
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.presentation
-template.png
149 icon
=$
{link_dir
}/%iconprefix-oasis
-spreadsheet.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.spreadsheet.png
150 icon
=$
{link_dir
}/%iconprefix-oasis
-spreadsheet
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.spreadsheet
-template.png
151 icon
=$
{link_dir
}/%iconprefix-oasis
-text.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.text.png
152 icon
=$
{link_dir
}/%iconprefix-oasis
-text
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.text
-template.png
153 icon
=$
{link_dir
}/%iconprefix-oasis
-web
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.oasis.opendocument.text
-web.png
154 icon
=$
{link_dir
}/%iconprefix-presentation.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.impress.png
155 icon
=$
{link_dir
}/%iconprefix-presentation
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.impress.template.png
156 icon
=$
{link_dir
}/%iconprefix-spreadsheet.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.calc.png
157 icon
=$
{link_dir
}/%iconprefix-spreadsheet
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.calc.template.png
158 icon
=$
{link_dir
}/%iconprefix-text.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.writer.png
159 icon
=$
{link_dir
}/%iconprefix-text
-template.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.sun.xml.writer.template.png
160 icon
=$
{link_dir
}/%iconprefix-extension.png
; test -f $
{icon
} && ln
-sf $
{icon
} $
{link_dir
}/gnome
-mime
-application
-vnd.openofficeorg.extension.png
164 if [ -e
/usr
/share
/icons
/hicolor
/icon
-theme.cache
] ; then
165 # touch it, just in case we cannot find the binary...
166 touch
/usr
/share
/icons
/hicolor
167 if [ -x
/opt
/gnome
/bin
/gtk
-update
-icon
-cache
]; then
168 /opt
/gnome
/bin
/gtk
-update
-icon
-cache
-q
/usr
/share
/icons
/hicolor
169 elif (which gtk
-update
-icon
-cache
); then
170 gtk
-update
-icon
-cache
-q
/usr
/share
/icons
/hicolor
172 # ignore errors (e.g. when there is a cache, but no index.theme)
177 # update /etc/mime.types
178 # backing out existing entries to avoid duplicates
180 /application\
/vnd\.oasis\.opendocument
/d
181 /application\
/vnd\.sun
/d
182 /application\
/vnd\.stardivision
/d
183 /application\
/vnd\.openofficeorg
/d
184 '
/etc
/mime.types
2>/dev
/null
>> /etc
/mime.types.tmp$$
186 # now append our stuff to the temporary file
187 cat
>> /etc
/mime.types.tmp$$
<< END
188 application
/vnd.oasis.opendocument.text odt
189 application
/vnd.oasis.opendocument.text
-flat
-xml fodt
190 application
/vnd.oasis.opendocument.text
-template ott
191 application
/vnd.oasis.opendocument.text
-web oth
192 application
/vnd.oasis.opendocument.text
-master odm
193 application
/vnd.oasis.opendocument.graphics odg
194 application
/vnd.oasis.opendocument.graphics
-flat
-xml fodg
195 application
/vnd.oasis.opendocument.graphics
-template otg
196 application
/vnd.oasis.opendocument.presentation odp
197 application
/vnd.oasis.opendocument.presentation
-flat
-xml fodp
198 application
/vnd.oasis.opendocument.presentation
-template otp
199 application
/vnd.oasis.opendocument.spreadsheet ods
200 application
/vnd.oasis.opendocument.spreadsheet
-flat
-xml fods
201 application
/vnd.oasis.opendocument.spreadsheet
-template ots
202 application
/vnd.oasis.opendocument.chart odc
203 application
/vnd.oasis.opendocument.formula odf
204 application
/vnd.oasis.opendocument.image odi
205 application
/vnd.sun.xml.writer sxw
206 application
/vnd.sun.xml.writer.template stw
207 application
/vnd.sun.xml.writer.global sxg
208 application
/vnd.stardivision.writer sdw vor
209 application
/vnd.stardivision.writer
-global sgl
210 application
/vnd.sun.xml.calc sxc
211 application
/vnd.sun.xml.calc.template stc
212 application
/vnd.stardivision.calc sdc
213 application
/vnd.stardivision.chart sds
214 application
/vnd.sun.xml.impress sxi
215 application
/vnd.sun.xml.impress.template sti
216 application
/vnd.stardivision.impress sdd sdp
217 application
/vnd.sun.xml.draw sxd
218 application
/vnd.sun.xml.draw.template std
219 application
/vnd.stardivision.draw sda
220 application
/vnd.sun.xml.math sxm
221 application
/vnd.sun.xml.base odb
222 application
/vnd.stardivision.math smf
223 application
/vnd.openofficeorg.extension oxt
224 application
/vnd.openxmlformats
-officedocument.wordprocessingml.document docx
225 application
/vnd.ms
-word.document.macroEnabled
.12 docm
226 application
/vnd.openxmlformats
-officedocument.wordprocessingml.template dotx
227 application
/vnd.ms
-word.template.macroEnabled
.12 dotm
228 application
/vnd.openxmlformats
-officedocument.spreadsheetml.sheet xlsx
229 application
/vnd.ms
-excel.sheet.macroEnabled
.12 xlsm
230 application
/vnd.openxmlformats
-officedocument.spreadsheetml.template xltx
231 application
/vnd.ms
-excel.template.macroEnabled
.12 xltm
232 application
/vnd.openxmlformats
-officedocument.presentationml.presentation pptx
233 application
/vnd.ms
-powerpoint.presentation.macroEnabled
.12 pptm
234 application
/vnd.openxmlformats
-officedocument.presentationml.template potx
235 application
/vnd.ms
-powerpoint.template.macroEnabled
.12 potm
238 # and replace the original file
239 mv
-f
/etc
/mime.types.tmp$$
/etc
/mime.types
2>/dev
/null
241 # update /etc/mailcap only at initial install
244 # backing out existing entries to avoid duplicates
247 /^application\
/vnd\.oasis\.opendocument
/d
248 /^application\
/vnd\.openofficeorg
/d
249 /^application\
/vnd\.sun
/d
250 /^application\
/vnd\.stardivision
/d
251 /^application\
/vnd\.ms
-word
/d
252 /^application\
/vnd\.ms
-excel
/d
253 /^application\
/vnd\.ms
-powerpoint
/d
254 /^application\
/x
-star
/d
258 '
/etc
/mailcap
2>/dev
/null
>> /etc
/mailcap.tmp$$
260 # now append our stuff to the temporary file
261 cat
>> /etc
/mailcap.tmp$$
<< END
263 application
/vnd.oasis.opendocument.text
; %unixfilename -view
%s
264 application
/vnd.oasis.opendocument.text
-flat
-xml
; %unixfilename -view
%s
265 application
/vnd.oasis.opendocument.text
-template
; %unixfilename -view
%s
266 application
/vnd.oasis.opendocument.text
-web
; %unixfilename -view
%s
267 application
/vnd.oasis.opendocument.text
-master
; %unixfilename -view
%s
268 application
/vnd.sun.xml.writer
; %unixfilename -view
%s
269 application
/vnd.sun.xml.writer.template
; %unixfilename -view
%s
270 application
/vnd.sun.xml.writer.global
; %unixfilename -view
%s
271 application
/vnd.stardivision.writer
; %unixfilename -view
%s
272 application
/vnd.stardivision.writer
-global
; %unixfilename -view
%s
273 application
/x
-starwriter
; %unixfilename -view
%s
274 application
/vnd.oasis.opendocument.formula
; %unixfilename -view
%s
275 application
/vnd.sun.xml.math
; %unixfilename -view
%s
276 application
/vnd.stardivision.math
; %unixfilename -view
%s
277 application
/x
-starmath
; %unixfilename -view
%s
278 application
/msword
; %unixfilename -view
%s
279 application
/vnd.oasis.opendocument.spreadsheet
; %unixfilename -view
%s
280 application
/vnd.oasis.opendocument.spreadsheet
-flat
-xml
; %unixfilename -view
%s
281 application
/vnd.oasis.opendocument.spreadsheet
-template
; %unixfilename -view
%s
282 application
/vnd.sun.xml.calc
; %unixfilename -view
%s
283 application
/vnd.sun.xml.calc.template
; %unixfilename -view
%s
284 application
/vnd.stardivision.calc
; %unixfilename -view
%s
285 application
/x
-starcalc
; %unixfilename -view
%s
286 application
/vnd.stardivision.chart
; %unixfilename -view
%s
287 application
/x
-starchart
; %unixfilename -view
%s
288 application
/excel
; %unixfilename -view
%s
289 application
/msexcel
; %unixfilename -view
%s
290 application
/vnd.ms
-excel
; %unixfilename -view
%s
291 application
/x
-msexcel
; %unixfilename -view
%s
292 application
/vnd.oasis.opendocument.presentation
; %unixfilename -view
%s
293 application
/vnd.oasis.opendocument.presentation
-flat
-xml
; %unixfilename -view
%s
294 application
/vnd.oasis.opendocument.presentation
-template
; %unixfilename -view
%s
295 application
/vnd.sun.xml.impress
; %unixfilename -view
%s
296 application
/vnd.sun.xml.impress.template
; %unixfilename -view
%s
297 application
/vnd.stardivision.impress
; %unixfilename -view
%s
298 application
/x
-starimpress
; %unixfilename -view
%s
299 application
/powerpoint
; %unixfilename -view
%s
300 application
/mspowerpoint
; %unixfilename -view
%s
301 application
/vnd.ms
-powerpoint
; %unixfilename -view
%s
302 application
/x
-mspowerpoint
; %unixfilename -view
%s
303 application
/vnd.oasis.opendocument.graphics
; %unixfilename -view
%s
304 application
/vnd.oasis.opendocument.graphics
-flat
-xml
; %unixfilename -view
%s
305 application
/vnd.oasis.opendocument.graphics
-template
; %unixfilename -view
%s
306 application
/vnd.sun.xml.draw
; %unixfilename -view
%s
307 application
/vnd.sun.xml.draw.template
; %unixfilename -view
%s
308 application
/vnd.stardivision.draw
; %unixfilename -view
%s
309 application
/x
-stardraw
; %unixfilename -view
%s
310 application
/vnd.oasis.opendocument.database
; %unixfilename -view
%s
311 application
/vnd.sun.xml.base
; %unixfilename -view
%s
312 application
/vnd.openofficeorg.extension
; %unixfilename %s
313 application
/vnd.openxmlformats
-officedocument.wordprocessingml.document
; %unixfilename -view
%s
314 application
/vnd.ms
-word.document.macroEnabled
.12;%unixfilename -view
%s
315 application
/vnd.openxmlformats
-officedocument.wordprocessingml.template
; %unixfilename -view
%s
316 application
/vnd.ms
-word.template.macroEnabled
.12; %unixfilename -view
%s
317 application
/vnd.openxmlformats
-officedocument.spreadsheetml.sheet
; %unixfilename -view
%s
318 application
/vnd.ms
-excel.sheet.macroEnabled
.12; %unixfilename -view
%s
319 application
/vnd.openxmlformats
-officedocument.spreadsheetml.template
; %unixfilename -view
%s
320 application
/vnd.ms
-excel.template.macroEnabled
.12; %unixfilename -view
%s
321 application
/vnd.openxmlformats
-officedocument.presentationml.presentation
; %unixfilename -view
%s
322 application
/vnd.ms
-powerpoint.presentation.macroEnabled
.12; %unixfilename -view
%s
323 application
/vnd.openxmlformats
-officedocument.presentationml.template
; %unixfilename -view
%s
324 application
/vnd.ms
-powerpoint.template.macroEnabled
.12; %unixfilename -view
%s
327 # and replace the original file
328 mv
-f
/etc
/mailcap.tmp$$
/etc
/mailcap
331 if [ -x
/opt
/gnome
/bin
/update
-desktop
-database
]; then
332 /opt
/gnome
/bin
/update
-desktop
-database
-q
333 elif (which update
-desktop
-database
); then
334 update
-desktop
-database
-q
/usr
/share
/applications
338 # remove from /etc/mailcap only on de-install
341 # backing all entries pointing to our binary
342 sed '
/%unixfilename/d'
/etc
/mailcap
2>/dev
/null
>> /etc
/mailcap.tmp$$
344 # and replace the original file
345 mv
-f
/etc
/mailcap.tmp$$
/etc
/mailcap
349 if [ "$
1"
= 0 ] ; then # only run when erasing the package - other cases handled by the triggers
350 if [ -x
/opt
/gnome
/bin
/update
-desktop
-database
]; then
351 /opt
/gnome
/bin
/update
-desktop
-database
-q
352 elif (which update
-desktop
-database
); then
353 update
-desktop
-database
-q
355 # run always - both when upgrading as well as when erasing the package
356 if (which update
-mime
-database
); then
357 update
-mime
-database
/usr
/share
/mime
362 if [ -e
/usr
/share
/icons
/hicolor
/icon
-theme.cache
] ; then
363 # touch it, just in case we cannot find the binary...
364 touch
/usr
/share
/icons
/hicolor
365 if [ -x
/opt
/gnome
/bin
/gtk
-update
-icon
-cache
]; then
366 /opt
/gnome
/bin
/gtk
-update
-icon
-cache
-q
/usr
/share
/icons
/hicolor
367 elif (which gtk
-update
-icon
-cache
); then
368 gtk
-update
-icon
-cache
-q
/usr
/share
/icons
/hicolor
370 # ignore errors (e.g. when there is a cache, but no index.theme)
375 # specify stale symlinks verbatim, not as glob - a change in recent versions of
376 # glibc breaks rpm unless rpm is build with internal glob-matching (issue 49374)
377 # https://bugzilla.redhat.com/beta/show_bug.cgi?id=134362
378 %defattr(-, root
, root
)
379 %if "
%unixfilename"
!= "collaboraoffice"
&& "
%unixfilename"
!= "collaboraofficedev"
381 %attr(0755,root
,root
) /opt
/%unixfilename
384 /usr
/share
/applications
/%unixfilename-base.desktop
385 /usr
/share
/applications
/%unixfilename-calc.desktop
386 /usr
/share
/applications
/%unixfilename-draw.desktop
387 /usr
/share
/applications
/%unixfilename-impress.desktop
388 /usr
/share
/applications
/%unixfilename-math.desktop
389 /usr
/share
/applications
/%unixfilename-writer.desktop
390 /usr
/share
/applications
/%unixfilename-startcenter.desktop
391 /usr
/share
/applications
/%unixfilename-xsltfilter.desktop
392 /usr
/share
/icons
/hicolor
/*/apps
/*png
393 /usr
/share
/icons
/hicolor
/*/apps
/*svg
394 /usr
/share
/icons
/hicolor
/*/mimetypes
/*png
395 /usr
/share
/metainfo
/*
396 /usr
/share
/mime
/packages
/*