From c5e7e455a482412419bd348ad20b6337fd2ea08f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 6 Aug 2019 15:59:49 +0200 Subject: [PATCH] Add changes related to Flatpak build --- evolution.spec | 46 ++++++++++++++++++++++++-- flatpak-evolution-fix-service-names.sh | 10 ++++++ flatpak-evolution-wrapper.sh.in | 33 ++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100755 flatpak-evolution-fix-service-names.sh create mode 100644 flatpak-evolution-wrapper.sh.in diff --git a/evolution.spec b/evolution.spec index 1e9a37e..3a541b2 100644 --- a/evolution.spec +++ b/evolution.spec @@ -26,6 +26,10 @@ # Coverity scan can override this to 0, to skip checking in gtk-doc generated code %{!?with_docs: %global with_docs 1} +%if 0%{?flatpak} +%global with_docs 0 +%endif + %define evo_plugin_dir %{_libdir}/evolution/plugins ### Abstract ### @@ -37,6 +41,8 @@ Summary: Mail and calendar client for GNOME License: GPLv2+ and GFDL URL: https://wiki.gnome.org/Apps/Evolution Source: http://download.gnome.org/sources/%{name}/3.32/%{name}-%{version}.tar.xz +Source1: flatpak-evolution-fix-service-names.sh +Source2: flatpak-evolution-wrapper.sh.in ### Patches ### @@ -53,20 +59,26 @@ Obsoletes: evolution-tests <= 3.31.1 ## Dependencies ### +%if ! 0%{?flatpak} Requires: %{_bindir}/killall -Requires: evolution-data-server >= %{eds_version} Requires: gvfs +%endif +Requires: evolution-data-server >= %{eds_version} Requires: gtkspell3 Requires: highlight Requires: %{name}-langpacks = %{version}-%{release} ### Build Dependencies ### +%if ! 0%{?flatpak} BuildRequires: %{_bindir}/killall +%endif BuildRequires: cmake BuildRequires: gcc BuildRequires: gettext +%if %{with_docs} BuildRequires: gtk-doc +%endif BuildRequires: highlight BuildRequires: intltool >= %{intltool_version} BuildRequires: itstool @@ -76,7 +88,11 @@ BuildRequires: yelp-tools BuildRequires: pkgconfig(atk) BuildRequires: pkgconfig(cairo-gobject) BuildRequires: pkgconfig(camel-1.2) >= %{eds_version} +%if 0%{?flatpak} +BuildRequires: pkgconfig(enchant-2) +%else BuildRequires: pkgconfig(enchant) +%endif BuildRequires: pkgconfig(gail-3.0) >= %{gtk3_version} BuildRequires: pkgconfig(gcr-3) BuildRequires: pkgconfig(gdk-pixbuf-2.0) @@ -143,6 +159,8 @@ Obsoletes: libgal2-devel <= %{last_libgal2_version} %description devel Development files needed for building things which link against %{name}. +%if %{with_docs} + %package devel-docs Summary: Developer documentation for Evolution Requires: devhelp @@ -152,6 +170,8 @@ BuildArch: noarch %description devel-docs This package contains developer documentation for Evolution. +%endif + %package langpacks Summary: Translations for %{name} BuildArch: noarch @@ -217,6 +237,11 @@ for inbox in src/mail/default/*/Inbox; do echo -n "" > $inbox done +%if 0%{?flatpak} +mv data/org.gnome.Evolution.desktop.in.in data/org.gnome.Evolution.desktop.in.i +cat data/org.gnome.Evolution.desktop.in.i | sed -e "s/Icon=evolution/Icon=org.gnome.Evolution/" >data/org.gnome.Evolution.desktop.in.in +%endif + %build mkdir -p _build @@ -289,11 +314,18 @@ rm -rf $RPM_BUILD_ROOT cd _build make DESTDIR=$RPM_BUILD_ROOT install +%if 0%{?flatpak} +%{S:1} <%{S:2} >flatpak-evolution-wrapper.sh +chmod a+x flatpak-evolution-wrapper.sh +mv $RPM_BUILD_ROOT%{_bindir}/evolution $RPM_BUILD_ROOT%{_bindir}/evolution.bin +cp flatpak-evolution-wrapper.sh $RPM_BUILD_ROOT%{_bindir}/evolution +%endif + %find_lang evolution --all-name --with-gnome -grep "/usr/share/locale" evolution.lang > translations.lang +grep "%{_datadir}/locale" evolution.lang > translations.lang %if %{with_docs} -grep -v "/usr/share/locale" evolution.lang > help.lang +grep -v "%{_datadir}/locale" evolution.lang > help.lang %endif %ldconfig_scriptlets @@ -329,6 +361,10 @@ grep -v "/usr/share/locale" evolution.lang > help.lang # The main executable %{_bindir}/evolution +%if 0%{?flatpak} +%{_bindir}/evolution.bin +%endif + %{_datadir}/metainfo/org.gnome.Evolution.appdata.xml # Desktop files: @@ -474,6 +510,8 @@ grep -v "/usr/share/locale" evolution.lang > help.lang %{_libdir}/pkgconfig/evolution-shell-3.0.pc %{_libdir}/pkgconfig/libemail-engine.pc +%if %{with_docs} + %files devel-docs %doc %{_datadir}/gtk-doc/html/evolution-mail-composer %doc %{_datadir}/gtk-doc/html/evolution-mail-engine @@ -481,6 +519,8 @@ grep -v "/usr/share/locale" evolution.lang > help.lang %doc %{_datadir}/gtk-doc/html/evolution-shell %doc %{_datadir}/gtk-doc/html/evolution-util +%endif + %files langpacks -f _build/translations.lang %if %{with_docs} diff --git a/flatpak-evolution-fix-service-names.sh b/flatpak-evolution-fix-service-names.sh new file mode 100755 index 0000000..9454543 --- /dev/null +++ b/flatpak-evolution-fix-service-names.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# see https://gitlab.gnome.org/GNOME/glib/issues/1737 +# previous versions used milliseconds instead of seconds as the timeout argument", +(`pkg-config --atleast-version 2.60.1 gio-2.0` || `pkg-config --atleast-version 2.61.0 gio-2.0`) && TIMEOUTMULT= || TIMEOUTMULT=000 + +sed -e "s|\@SOURCES_SERVICE\@|$(pkg-config --variable=sourcesdbusservicename evolution-data-server-1.2)|" \ + -e "s|\@ADDRESSBOOK_SERVICE\@|$(pkg-config --variable=addressbookdbusservicename evolution-data-server-1.2)|" \ + -e "s|\@CALENDAR_SERVICE\@|$(pkg-config --variable=calendardbusservicename evolution-data-server-1.2)|" \ + -e "s|\@TIMEOUTMULT\@|${TIMEOUTMULT}|" diff --git a/flatpak-evolution-wrapper.sh.in b/flatpak-evolution-wrapper.sh.in new file mode 100644 index 0000000..c57bfbe --- /dev/null +++ b/flatpak-evolution-wrapper.sh.in @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ "$1" = "--quit" -o "$1" = "--force-shutdown" ]; then + /app/bin/evolution.bin "$@" +else + export BOGOFILTER_DIR="${XDG_DATA_HOME}/bogofilter/" + export GIO_USE_NETWORK_MONITOR=base + gsettings reset org.gnome.evolution-data-server network-monitor-gio-name + + gpg-agent --homedir ~/.gnupg --daemon --pinentry-program=/app/bin/pinentry + + LINES=$(gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep @SOURCES_SERVICE@ | wc -l) + if [ "${LINES}" = "0" ]; then + /app/libexec/evolution-source-registry & + gdbus wait --session --timeout=1@TIMEOUTMULT@ @SOURCES_SERVICE@ + fi + + LINES=$(gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep @ADDRESSBOOK_SERVICE@ | wc -l) + if [ "${LINES}" = "0" ]; then + /app/libexec/evolution-addressbook-factory -r & + gdbus wait --session --timeout=1@TIMEOUTMULT@ @ADDRESSBOOK_SERVICE@ + fi + + LINES=$(gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames | grep @CALENDAR_SERVICE@ | wc -l) + if [ "${LINES}" = "0" ]; then + /app/libexec/evolution-calendar-factory -r & + gdbus wait --session --timeout=1@TIMEOUTMULT@ @CALENDAR_SERVICE@ + fi + + /app/bin/evolution.bin "$@" + + pkill -TERM gpg-agent +fi