Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / solenv / bin / assemble-flatpak.sh
blob802c61cd8f8618640c1704c6aa4c5699842a4b19
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 ## icons/hicolor/*/apps/libreoffice-* ->
34 ## icons/hicolor/*/apps/org.libreoffice.LibreOffice-*:
35 mkdir -p /app/share/icons
36 for i in "${PREFIXDIR?}"/share/icons/hicolor/*/apps/libreoffice-*
38 mkdir -p \
39 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"
40 cp -a "$i" \
41 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/"$(basename "$i")"
42 cp -a "$i" \
43 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/org.libreoffice.LibreOffice-"${i##*/apps/libreoffice-}"
44 done
46 mkdir -p /app/share/runtime/locale
47 for i in $(ls /app/libreoffice/program/resource)
49 lang="${i%[_@]*}"
50 mkdir -p /app/share/runtime/locale/"${lang}"/resource
51 mv /app/libreoffice/program/resource/"${i}" /app/share/runtime/locale/"${lang}"/resource
52 ln -s ../../../share/runtime/locale/"${lang}"/resource/"${i}" /app/libreoffice/program/resource
53 done
55 for i in /app/libreoffice/share/registry/Langpack-*.xcd /app/libreoffice/share/registry/res/{fcfg_langpack,registry}_*.xcd
57 basename="$(basename "${i}" .xcd)"
58 lang="${basename#Langpack-}"
59 lang="${lang#fcfg_langpack_}"
60 lang="${lang#registry_}"
62 # ship the base app with at least one Langpack/fcfg_langpack
63 if [ "${lang}" = "en-US" ]
64 then
65 continue
68 lang="${lang%-*}"
69 mkdir -p /app/share/runtime/locale/"${lang}"/registry
70 mv "${i}" /app/share/runtime/locale/"${lang}"/registry
71 ln -rs /app/share/runtime/locale/"${lang}"/registry/"${basename}".xcd "${i}"
72 done
74 ## org.libreoffice.LibreOffice.appdata.xml is manually derived from the various
75 ## inst/share/appdata/libreoffice-*.appdata.xml (at least recent GNOME Software
76 ## doesn't show more than five screenshots anyway, so restrict to one each from
77 ## the five libreoffice-*.appdata.xml: Writer, Calc, Impress, Draw, Base):
78 mkdir -p /app/share/appdata
79 cat <<EOF >/app/share/appdata/org.libreoffice.LibreOffice.appdata.xml
80 <?xml version="1.0" encoding="UTF-8"?>
81 <component type="desktop">
82 <id>org.libreoffice.LibreOffice.desktop</id>
83 <metadata_license>CC0-1.0</metadata_license>
84 <project_license>MPL-2.0</project_license>
85 <name>LibreOffice</name>
86 <summary>The LibreOffice productivity suite</summary>
87 <description>
88 <p>LibreOffice is a powerful office suite. Its clean interface and
89 feature-rich tools help you unleash your creativity and enhance your
90 productivity. LibreOffice includes several applications that make it the most
91 powerful Free and Open Source office suite on the market: Writer (word
92 processing), Calc (spreadsheets), Impress (presentations), Draw (vector
93 graphics and flowcharts), Base (databases), and Math (formula editing).</p>
94 <p>LibreOffice supports opening and saving into a wide variety of formats, so
95 you can easily share documents with users of other popular office suites
96 without worrying about compatibility.</p>
97 </description>
98 <url type="homepage">http://www.libreoffice.org/discover/libreoffice/</url>
99 <url type="bugtracker">https://bugs.documentfoundation.org/</url>
100 <url type="donation">https://donate.libreoffice.org/</url>
101 <url type="faq">https://wiki.documentfoundation.org/Faq</url>
102 <url type="help">http://www.libreoffice.org/get-help/documentation/</url>
103 <url type="translate">https://wiki.documentfoundation.org/Translating_LibreOffice</url>
104 <screenshots>
105 <screenshot type="default">
106 <image>https://hub.libreoffice.org/screenshots/writer-01.png</image>
107 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
108 </screenshot>
109 <screenshot>
110 <image>https://hub.libreoffice.org/screenshots/calc-02.png</image>
111 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
112 </screenshot>
113 <screenshot>
114 <image>https://hub.libreoffice.org/screenshots/impress-01.png</image>
115 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
116 </screenshot>
117 <screenshot>
118 <image>https://hub.libreoffice.org/screenshots/draw-02.png</image>
119 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
120 </screenshot>
121 <screenshot>
122 <image>https://hub.libreoffice.org/screenshots/base-02.png</image>
123 <caption><!-- Describe this screenshot in less than ~10 words --></caption>
124 </screenshot>
125 </screenshots>
126 <developer_name>The Document Foundation</developer_name>
127 <update_contact>libreoffice_at_lists.freedesktop.org</update_contact>
128 <kudos>
129 <kudo>HiDpiIcon</kudo>
130 <kudo>HighContrast</kudo>
131 <kudo>ModernToolkit</kudo>
132 <kudo>UserDocs</kudo>
133 </kudos>
134 <releases>
135 <release
136 version="${LIBO_VERSION_MAJOR?}.${LIBO_VERSION_MINOR?}.${LIBO_VERSION_MICRO?}.${LIBO_VERSION_PATCH?}"
137 date="$(date +%Y-%m-%d)"/>
138 </releases>
139 </component>
142 # append the appdata for the different components
143 for i in "${PREFIXDIR?}"/share/appdata/libreoffice-*.appdata.xml
145 sed "1 d; s/<id>libreoffice/<id>org.libreoffice.LibreOffice/" "$i" \
146 >>/app/share/appdata/org.libreoffice.LibreOffice.appdata.xml
147 done
149 ## see <https://github.com/flatpak/flatpak/blob/master/app/
150 ## flatpak-builtins-build-finish.c> for further places where build-finish would
151 ## look for data:
152 ## cp ... /app/share/dbus-1/services/
153 ## cp ... /app/share/gnome-shell/search-providers/