diff --git a/evolution.spec b/evolution.spec index b9d8624..5eb5a62 100644 --- a/evolution.spec +++ b/evolution.spec @@ -41,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.33/%{name}-%{version}.tar.xz +Source1: flatpak-evolution-fix-service-names.sh +Source2: flatpak-evolution-wrapper.sh.in ### Patches ### @@ -308,6 +310,13 @@ 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 "%{_datadir}/locale" evolution.lang > translations.lang @@ -348,6 +357,10 @@ grep -v "%{_datadir}/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: 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..678b771 --- /dev/null +++ b/flatpak-evolution-wrapper.sh.in @@ -0,0 +1,31 @@ +#!/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 "$@" +fi