bump product version to 6.4.0.3
[LibreOffice.git] / solenv / bin / assemble-flatpak.sh
blobb4bce2d4d17208dcf17866cb5c675d13f8d35be1
1 #! /bin/bash
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 # Assemble Flatpak app files and metadata under /app/, copying from the
11 # installation tree generated by 'make distro-pack-install' (at
12 # $PREFIXDIR):
14 set -e
16 cp -r "${PREFIXDIR?}"/lib/libreoffice /app/
18 ## libreoffice-*.desktop -> org.libreoffice.LibreOffice.*.desktop:
19 mkdir -p /app/share/applications
20 for i in "${PREFIXDIR?}"/share/applications/libreoffice-*.desktop
22 sed -e 's,^Exec=libreoffice,Exec=/app/libreoffice/program/soffice,' \
23 -e 's/^Icon=libreoffice-/Icon=org.libreoffice.LibreOffice./' "$i" \
24 >/app/share/applications/org.libreoffice.LibreOffice."${i#"${PREFIXDIR?}"/share/applications/libreoffice-}"
25 done
26 mv /app/share/applications/org.libreoffice.LibreOffice.startcenter.desktop \
27 /app/share/applications/org.libreoffice.LibreOffice.desktop
29 # Flatpak .desktop exports take precedence over system ones due to
30 # the order of XDG_DATA_DIRS - re-associating text/plain seems a bit much
31 sed -i "s/text\/plain;//" /app/share/applications/org.libreoffice.LibreOffice.writer.desktop
33 desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-startcenter \
34 --set-key=X-Flatpak-RenamedFrom --set-value='libreoffice-startcenter.desktop;' \
35 /app/share/applications/org.libreoffice.LibreOffice.desktop
36 for i in base calc draw impress math writer xsltfilter
38 desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-"$i" \
39 --set-key=X-Flatpak-RenamedFrom \
40 --set-value="libreoffice-$i.desktop;org.libreoffice.LibreOffice-$i.desktop;" \
41 /app/share/applications/org.libreoffice.LibreOffice."$i".desktop
42 done
44 ## icons/hicolor/*/apps/libreoffice-* ->
45 ## icons/hicolor/*/apps/org.libreoffice.LibreOffice-*:
46 mkdir -p /app/share/icons
47 for i in "${PREFIXDIR?}"/share/icons/hicolor/*/apps/libreoffice-*
49 mkdir -p \
50 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"
51 cp -a "$i" \
52 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/"$(basename "$i")"
53 cp -a "$i" \
54 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/org.libreoffice.LibreOffice."${i##*/apps/libreoffice-}"
55 done
57 mkdir -p /app/share/runtime/locale
58 for i in $(ls /app/libreoffice/program/resource)
60 lang="${i%[_@]*}"
61 mkdir -p /app/share/runtime/locale/"${lang}"/resource
62 mv /app/libreoffice/program/resource/"${i}" /app/share/runtime/locale/"${lang}"/resource
63 ln -s ../../../share/runtime/locale/"${lang}"/resource/"${i}" /app/libreoffice/program/resource
64 done
66 for i in /app/libreoffice/share/registry/Langpack-*.xcd /app/libreoffice/share/registry/res/{fcfg_langpack,registry}_*.xcd
68 basename="$(basename "${i}" .xcd)"
69 lang="${basename#Langpack-}"
70 lang="${lang#fcfg_langpack_}"
71 lang="${lang#registry_}"
73 # ship the base app with at least one Langpack/fcfg_langpack
74 if [ "${lang}" = "en-US" ]
75 then
76 continue
79 lang="${lang%-*}"
80 mkdir -p /app/share/runtime/locale/"${lang}"/registry
81 mv "${i}" /app/share/runtime/locale/"${lang}"/registry
82 ln -rs /app/share/runtime/locale/"${lang}"/registry/"${basename}".xcd "${i}"
83 done
85 ## org.libreoffice.LibreOffice.appdata.xml is manually derived from the various
86 ## inst/share/appdata/libreoffice-*.appdata.xml (at least recent GNOME Software
87 ## doesn't show more than five screenshots anyway, so restrict to one each from
88 ## the five libreoffice-*.appdata.xml: Writer, Calc, Impress, Draw, Base):
89 mkdir -p /app/share/appdata
90 cat <<EOF >/app/share/appdata/org.libreoffice.LibreOffice.appdata.xml
91 <?xml version="1.0" encoding="UTF-8"?>
92 <component type="desktop">
93 <id>org.libreoffice.LibreOffice.desktop</id>
94 <metadata_license>CC0-1.0</metadata_license>
95 <project_license>MPL-2.0</project_license>
96 <name>LibreOffice</name>
97 <summary>The LibreOffice productivity suite</summary>
98 <description>
99 <p>LibreOffice is a powerful office suite. Its clean interface and
100 feature-rich tools help you unleash your creativity and enhance your
101 productivity. LibreOffice includes several applications that make it the most
102 powerful Free and Open Source office suite on the market: Writer (word
103 processing), Calc (spreadsheets), Impress (presentations), Draw (vector
104 graphics and flowcharts), Base (databases), and Math (formula editing).</p>
105 <p>LibreOffice supports opening and saving into a wide variety of formats, so
106 you can easily share documents with users of other popular office suites
107 without worrying about compatibility.</p>
108 </description>
109 <url type="homepage">http://www.libreoffice.org/discover/libreoffice/</url>
110 <url type="bugtracker">https://bugs.documentfoundation.org/</url>
111 <url type="donation">https://donate.libreoffice.org/</url>
112 <url type="faq">https://wiki.documentfoundation.org/Faq</url>
113 <url type="help">http://www.libreoffice.org/get-help/documentation/</url>
114 <url type="translate">https://wiki.documentfoundation.org/Translating_LibreOffice</url>
115 <screenshots>
116 <screenshot type="default">
117 <image>https://hub.libreoffice.org/screenshots/writer-01.png</image>
118 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
119 </screenshot>
120 <screenshot>
121 <image>https://hub.libreoffice.org/screenshots/calc-02.png</image>
122 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
123 </screenshot>
124 <screenshot>
125 <image>https://hub.libreoffice.org/screenshots/impress-01.png</image>
126 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
127 </screenshot>
128 <screenshot>
129 <image>https://hub.libreoffice.org/screenshots/draw-02.png</image>
130 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
131 </screenshot>
132 <screenshot>
133 <image>https://hub.libreoffice.org/screenshots/base-02.png</image>
134 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
135 </screenshot>
136 </screenshots>
137 <developer_name>The Document Foundation</developer_name>
138 <update_contact>libreoffice_at_lists.freedesktop.org</update_contact>
139 <kudos>
140 <kudo>HiDpiIcon</kudo>
141 <kudo>HighContrast</kudo>
142 <kudo>ModernToolkit</kudo>
143 <kudo>UserDocs</kudo>
144 </kudos>
145 <content_rating type="oars-1.0"/>
146 <releases>
147 <release
148 version="${LIBO_VERSION_MAJOR?}.${LIBO_VERSION_MINOR?}.${LIBO_VERSION_MICRO?}.${LIBO_VERSION_PATCH?}"
149 date="$(date +%Y-%m-%d)"/>
150 </releases>
151 </component>
154 # append the appdata for the different components
155 for i in "${PREFIXDIR?}"/share/appdata/libreoffice-*.appdata.xml
157 sed "1 d; s/<id>libreoffice-/<id>org.libreoffice.LibreOffice./" "$i" \
158 >>/app/share/appdata/org.libreoffice.LibreOffice.appdata.xml
159 done
161 ## see <https://github.com/flatpak/flatpak/blob/master/app/
162 ## flatpak-builtins-build-finish.c> for further places where build-finish would
163 ## look for data:
164 ## cp ... /app/share/dbus-1/services/
165 ## cp ... /app/share/gnome-shell/search-providers/