flatpak/build.sh | 81 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 17 deletions(-)
New commits: commit cb6ca493be62b59aa16c7ec6a051e594a1d92f18 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Nov 1 16:38:53 2016 +0100 Create a single-app LibreOffice.flatpak ...at least gnome-software in Fedora 25 doesn't handle .flatpak files containing multiple .appdata.xml and/or .desktop files, so just provide one each, for the "generic" LibreOffice application. The included org.libreoffice.LibreOffice.desktop is a mechincally generated copy of inst/share/applications/libreoffice-startcenter.desktop, with the MimeType= lines from all libreoffice-*.desktop files merged into one. The included org.libreoffice.LibreOffice.appdata.xml is manually derived from the various source inst/share/appdata/libreoffice-*.appdata.xml files. diff --git a/flatpak/build.sh b/flatpak/build.sh index 2b82313..2a663b2 100755 --- a/flatpak/build.sh +++ b/flatpak/build.sh @@ -90,7 +90,6 @@ flatpak build --build-dir="${my_dir?}"/build \ # 5 Assemble the app files and metadata: cp -r "${my_dir?}"/inst/lib/libreoffice "${my_dir?}"/app/files/ -mkdir "${my_dir?}"/app/files/bin ## Per "man gdbus" and <https://developer.gnome.org/glib/stable/ ## gvariant-text.html#gvariant-text-strings> (cf. ## <https://bugzilla.gnome.org/show_bug.cgi?id=768555#c1>, comment 1 to "'man @@ -107,35 +106,83 @@ mkdir "${my_dir?}"/app/files/bin ## not contain any double quotes or backslashes, nor should it contain single ## quotes as its first and last character (where the first character needs to be ## part of the URI scheme): +mkdir "${my_dir?}"/app/files/bin cat <<\EOF > "${my_dir?}"/app/files/bin/xdg-open gdbus call --session --dest org.freedesktop.portal.Desktop \ --object-path /org/freedesktop/portal/desktop \ --method org.freedesktop.portal.OpenURI.OpenURI -- '' "$1" {} EOF chmod +x "${my_dir?}"/app/files/bin/xdg-open +## libreoffice-startcenter.desktop -> org.libreoffice.LibreOffice.desktop, +## combining all libreoffice-*.desktop MimeType= lines: mkdir "${my_dir?}"/app/files/share mkdir "${my_dir?}"/app/files/share/applications -## libreoffice-*.desktop -> org.libreoffice.LibreOffice-*.desktop: -for i in "${my_dir?}"/inst/share/applications/libreoffice-*.desktop; do - sed -e 's,^Exec=libreoffice,Exec=/app/libreoffice/program/soffice,' \ - -e 's/^Icon=libreoffice-/Icon=org.libreoffice.LibreOffice-/' "$i" \ - > "${my_dir?}"/app/files/share/applications/org.libreoffice.LibreOffice-"${i##*/libreoffice-}" -done +my_mimetypes=$(awk -d 'BEGIN { FS="="; ORS=""; semi=0 }; \ + /^MimeType=/ && length($2) \ + { if (semi) print ";"; print $2; semi = match($2, ";$") == 0 }' \ + "${my_dir?}"/inst/share/applications/libreoffice-*.desktop) +sed -e 's,^Exec=libreoffice,Exec=/app/libreoffice/program/soffice,' \ + -e 's/^Icon=libreoffice-/Icon=org.libreoffice.LibreOffice-/' \ + -e 's|^MimeType=.*$|MimeType='"$my_mimetypes"'|' \ + "${my_dir?}"/inst/share/applications/libreoffice-startcenter.desktop \ + > "${my_dir?}"/app/files/share/applications/org.libreoffice.LibreOffice.desktop +## icons/hicolor/*/apps/libreoffice-startcenter.* -> +## icons/hicolor/*/apps/org.libreoffice.LibreOffice-startcenter.*: mkdir "${my_dir?}"/app/files/share/icons -## icons/hicolor/*/apps/libreoffice-* -> -## icons/hicolor/*/apps/org.libreoffice.LibreOffice-*: -for i in "${my_dir?}"/inst/share/icons/hicolor/*/apps/libreoffice-*; do +for i in "${my_dir?}"/inst/share/icons/hicolor/*/apps/libreoffice-startcenter.* +do mkdir -p \ "$(dirname "${my_dir?}"/app/files/share/icons/hicolor/"${i#"${my_dir?}"/inst/share/icons/hicolor/}")" cp -a "$i" \ - "$(dirname "${my_dir?}"/app/files/share/icons/hicolor/"${i#"${my_dir?}"/inst/share/icons/hicolor/}")"/org.libreoffice.LibreOffice-"${i##*/apps/libreoffice-}" + "$(dirname "${my_dir?}"/app/files/share/icons/hicolor/"${i#"${my_dir?}"/inst/share/icons/hicolor/}")"/org.libreoffice.LibreOffice-startcenter."${i##*/apps/libreoffice-startcenter.}" done -## libreoffice-*.appdata.xml -> org.libreoffice.LibreOffice-*.appdata.xml: +## org.libreoffice.LibreOffice.appdata.xml is manually derived from the various +## inst/share/appdata/libreoffice-*.appdata.xml (at least recent GNOME Software +## doesn't show more than five screenshots anyway, so restrict to one each from +## the five libreoffice-*.appdata.xml: Writer, Calc, Impress, Draw, Base): mkdir "${my_dir?}"/app/files/share/appdata -for i in "${my_dir?}"/inst/share/appdata/libreoffice-*.appdata.xml; do - sed -e 's/<id>libreoffice-/<id>org.libreoffice.LibreOffice-/' "$i" \ - > "${my_dir?}"/app/files/share/appdata/org.libreoffice.LibreOffice-"${i##*/libreoffice-}" -done +cat <<\EOF > \ + "${my_dir?}"/app/files/share/appdata/org.libreoffice.LibreOffice.appdata.xml +<?xml version="1.0" encoding="UTF-8"?> +<component type="desktop"> + <id>org.libreoffice.LibreOffice.desktop</id> + <metadata_license>CC0-1.0</metadata_license> + <project_license>MPL-2.0</project_license> + <name>LibreOffice</name> + <summary>The LibreOffice productivity suite</summary> + <description> + <p>LibreOffice is a powerful office suite. Its clean interface and + feature-rich tools help you unleash your creativity and enhance your + productivity. LibreOffice includes several applications that make it the most + powerful Free and Open Source office suite on the market: Writer (word + processing), Calc (spreadsheets), Impress (presentations), Draw (vector + graphics and flowcharts), Base (databases), and Math (formula editing).</p> + <p>LibreOffice supports opening and saving into a wide variety of formats, so + you can easily share documents with users of other popular office suites + without worrying about compatibility.</p> + </description> + <url type="homepage">http://www.libreoffice.org/discover/libreoffice/</url> + <url type="bugtracker">https://bugs.documentfoundation.org/</url> + <url type="donation">https://donate.libreoffice.org/</url> + <url type="faq">https://wiki.documentfoundation.org/Faq</url> + <url type="help">http://www.libreoffice.org/get-help/documentation/</url> + <screenshots> + <screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Writer-02-Table-of-Contents-Getting-Started-Guide-4-2.png</screenshot> + <screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Calc-02-exemple-ods.png</screenshot> + <screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Impress-01-Blank.png</screenshot> + <screenshot type="default">http://www.libreoffice.org/assets/Uploads/Discover/Screenshots/_resampled/ResizedImage400300-Draw-02-Tiger-fdo82219.png</screenshot> + <screenshot type="default">http://www.libreoffice.org/assets/Uploads/Screenshots/Base/Screenshot-78.png</screenshot> + </screenshots> + <developer_name>The Document Foundation</developer_name> + <updatecontact>libreoffice_at_lists.freedesktop.org</updatecontact> + <kudos> + <kudo>HiDpiIcon</kudo> + <kudo>HighContrast</kudo> + <kudo>ModernToolkit</kudo> + <kudo>UserDocs</kudo> + </kudos> +</component> +EOF ## see <https://github.com/flatpak/flatpak/blob/master/app/ ## flatpak-builtins-build-finish.c> for further places where build-finish would ## look for data: @@ -147,7 +194,7 @@ done ## for the appstream-compose command line: flatpak build --nofilesystem=host "${my_dir?}"/app appstream-compose \ --prefix=/app --origin=flatpak --basename=org.libreoffice.LibreOffice \ - org.libreoffice.LibreOffice-{base,calc,draw,impress,writer} + org.libreoffice.LibreOffice # 6 Generate repository, .flatpak bundle, and .flatpakref file _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits