PRODUCTNAME -> %PRODUCTNAME
[LibreOffice.git] / solenv / bin / assemble-flatpak.sh
blob9991a0d0d71cbb160621aea6998ff4cc173f7b43
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/
17 ln -s /app/libreoffice/program/soffice /app/bin/libreoffice
19 mkdir -p /app/share/applications
20 "${SRCDIR?}"/solenv/bin/assemble-flatpak-desktop.sh "${PREFIXDIR?}"/share/applications/ \
21 /app/share/applications/
23 ## icons/hicolor/*/apps/libreoffice-* ->
24 ## icons/hicolor/*/apps/org.libreoffice.LibreOffice-*:
25 mkdir -p /app/share/icons
26 for i in "${PREFIXDIR?}"/share/icons/hicolor/*/apps/libreoffice-*
28 mkdir -p \
29 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"
30 cp -a "$i" \
31 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/"$(basename "$i")"
32 cp -a "$i" \
33 "$(dirname /app/share/icons/hicolor/"${i#"${PREFIXDIR?}"/share/icons/hicolor/}")"/org.libreoffice.LibreOffice."${i##*/apps/libreoffice-}"
34 done
36 mkdir -p /app/share/runtime/locale
37 for i in $(ls /app/libreoffice/program/resource)
39 lang="${i%[_@]*}"
40 mkdir -p /app/share/runtime/locale/"${lang}"/resource
41 mv /app/libreoffice/program/resource/"${i}" /app/share/runtime/locale/"${lang}"/resource
42 ln -s ../../../share/runtime/locale/"${lang}"/resource/"${i}" /app/libreoffice/program/resource
43 done
45 for i in /app/libreoffice/share/registry/Langpack-*.xcd /app/libreoffice/share/registry/res/{fcfg_langpack,registry}_*.xcd
47 basename="$(basename "${i}" .xcd)"
48 lang="${basename#Langpack-}"
49 lang="${lang#fcfg_langpack_}"
50 lang="${lang#registry_}"
52 # ship the base app with at least one Langpack/fcfg_langpack
53 if [ "${lang}" = "en-US" ]
54 then
55 continue
58 lang="${lang%-*}"
59 mkdir -p /app/share/runtime/locale/"${lang}"/registry
60 mv "${i}" /app/share/runtime/locale/"${lang}"/registry
61 ln -rs /app/share/runtime/locale/"${lang}"/registry/"${basename}".xcd "${i}"
62 done
64 mkdir -p /app/share/appdata
65 "${SRCDIR?}"/solenv/bin/assemble-flatpak-appdata-step1.sh /app/share/appdata/ 1
66 "${SRCDIR?}"/solenv/bin/assemble-flatpak-appdata-step2.sh "${PREFIXDIR?}"/share/metainfo/ \
67 /app/share/appdata/
69 ## see <https://github.com/flatpak/flatpak/blob/master/app/
70 ## flatpak-builtins-build-finish.c> for further places where build-finish would
71 ## look for data:
72 ## cp ... /app/share/dbus-1/services/
73 ## cp ... /app/share/gnome-shell/search-providers/