From 7263c5b91fd1aa6a7b7b3030c1f879c5f99f5661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Mon, 30 Sep 2019 17:42:38 +0200 Subject: [PATCH 1/4] Add a basic Snapcraft configuration (linux) --- snap/local/configuration/base_qt.conf | 3 + snap/local/configuration/webengine_qt.conf | 3 + snap/snapcraft.yaml | 139 +++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 snap/local/configuration/base_qt.conf create mode 100644 snap/local/configuration/webengine_qt.conf create mode 100644 snap/snapcraft.yaml diff --git a/snap/local/configuration/base_qt.conf b/snap/local/configuration/base_qt.conf new file mode 100644 index 0000000000..610e953cdf --- /dev/null +++ b/snap/local/configuration/base_qt.conf @@ -0,0 +1,3 @@ +[Paths] +Translations=../usr/share/qt5/translations +Data=../usr/share/qt5/ diff --git a/snap/local/configuration/webengine_qt.conf b/snap/local/configuration/webengine_qt.conf new file mode 100644 index 0000000000..a250fd756c --- /dev/null +++ b/snap/local/configuration/webengine_qt.conf @@ -0,0 +1,3 @@ +[Paths] +Translations=../../../../../usr/share/qt5/translations +Data=../../../../../usr/share/qt5/ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000000..0ef6d9a07c --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,139 @@ +name: toggldesktop # you probably want to 'snapcraft register ' +base: core18 # the base snap is the execution environment for this snap +version: 'git' # just for humans, typically '1.2+git' or '1.3.2' +summary: Simple and Intuitive Time Tracking Software +description: | + Toggl Desktop is a desktop app for leading time tracking tool Toggl. The Desktop app is a great companion for time tracking and productivity as it has advanced features like: + - Idle detection + - Tracking reminder + - Pomodoro timer + - Timeline + - Autotracker + +grade: stable +confinement: strict +adopt-info: toggldesktop + +architectures: + - build-on: [amd64, i386, armhf, arm64] + run-on: [amd64, i386, armhf, arm64] + +plugs: + browser-sandbox: + interface: browser-support + allow-sandbox: false + notifications: + interface: dbus + bus: session + name: org.freedesktop.Notifications + screensaver: + interface: dbus + bus: session + name: org.freedesktop.ScreenSaver + login1: + interface: dbus + bus: system + name: org.freedesktop.login1 + +apps: + toggldesktop: + desktop: usr/share/applications/com.toggl.TogglDesktop.desktop + command: bin/desktop-launch $SNAP/bin/TogglDesktop.sh + common-id: com.toggl.TogglDesktop + environment: + QTWEBENGINE_DISABLE_SANDBOX: 1 + plugs: + - desktop + - desktop-legacy + - x11 + - wayland + - unity7 + - opengl + - browser-sandbox + - network + - network-observe + - pulseaudio + - camera + - screen-inhibit-control + - notifications + - screensaver + - login1 + - network-manager + +parts: + desktopqt5: + source: https://github.com/ubuntu/snapcraft-desktop-helpers.git + source-subdir: qt + plugin: make + make-parameters: ["FLAVOR=qt5"] + build-packages: + - qtbase5-dev + - execstack + override-build: | + snapcraftctl build + mkdir -pv $SNAPCRAFT_PART_INSTALL/qt5-platform + + toggldesktop: + source-type: git + source: https://github.com/toggl/toggldesktop.git + source-branch: 'master' + source-depth: 1 + parse-info: [usr/share/metainfo/com.toggl.TogglDesktop.appdata.xml] + plugin: cmake + configflags: [ + '-DTOGGL_PRODUCTION_BUILD=ON', + '-DTOGGL_ALLOW_UPDATE_CHECK=ON', + '-DTOGGL_DATA_DIR=/bin' + ] + override-prime: | + set -eu + snapcraftctl prime + # Fix-up application icon lookup + sed --in-place 's|^Icon=.*|Icon=\${SNAP}/usr/share/icons/hicolor/256x256/apps/toggldesktop.png|' usr/share/applications/com.toggl.TogglDesktop.desktop + + build-attributes: [keep-execstack] + build-packages: + - g++ + - qtbase5-dev + - qtwebengine5-dev + - libqt5x11extras5-dev + - qtbase5-private-dev + - libssl-dev + - libpoco-dev + - libxss-dev + - libxmu-dev + - libjsoncpp-dev + - liblua50-dev + stage-packages: + - libqt5gui5 + - libqt5webengine5 + - libqt5webenginecore5 + - libqt5webenginewidgets5 + - libqt5printsupport5 + - libqt5quickwidgets5 + - libqt5x11extras5 + - libpococrypto50 + - libpocodata50 + - libpocodatasqlite50 + - libpocofoundation50 + - libpocojson50 + - libpoconet50 + - libpoconetssl50 + - libpocoutil50 + - libpocoxml50 + - libjsoncpp1 + - liblua50 + - libxss1 + organize: + 'usr/lib/x86_64-linux-gnu/qt5/libexec/QtWebEngineProcess': bin/QtWebEngineProcess + 'share/': usr/share + after: [desktopqt5] + + qtconf: + source: 'snap/local/configuration' + plugin: dump + organize: + 'webengine_qt.conf' : usr/lib/x86_64-linux-gnu/qt5/libexec/qt.conf + 'base_qt.conf' : bin/qt.conf + after: [toggldesktop] + From 71c1308242b1e3d61d65815a5bf9999e102739d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Mon, 30 Sep 2019 17:43:13 +0200 Subject: [PATCH 2/4] Check if dbus-launch exists before executing it (linux) Closes #3357 --- src/ui/linux/TogglDesktop.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/linux/TogglDesktop.sh b/src/ui/linux/TogglDesktop.sh index 00b795f51a..554b9935d6 100755 --- a/src/ui/linux/TogglDesktop.sh +++ b/src/ui/linux/TogglDesktop.sh @@ -19,9 +19,12 @@ export QTWEBENGINE_CHROMIUM_FLAGS="--disable-logging" # Xubuntu, i3 and Cinnamon tray icon fix XDG=$XDG_CURRENT_DESKTOP +# Check if dbus-launch actually exists +DBUS_LAUNCH=$(which dbus-launch 2>/dev/null) + if [[ "$XDG" = "X-Cinnamon" || "$XDG" = "XFCE" || "$XDG" = "Pantheon" || "$XDG" = "i3" || "$XDG" = "LXDE" || "$XDG" = "MATE" || "$XDG" = "Budgie:GNOME" ]]; then DBUS_SESSION_BUS_ADDRESS="" - dbus-launch $dirname/$appname "$@" & + $DBUS_LAUNCH $dirname/$appname "$@" & else $dirname/$appname "$@" & fi; From 2e66cddca97c40de7392e11ed265cdcb2af5806f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Mon, 30 Sep 2019 17:44:02 +0200 Subject: [PATCH 3/4] Try removing the execstack from QtWebEngine so Snapcraft doesn't complain (linux) --- snap/snapcraft.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0ef6d9a07c..8e40bb5f54 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -72,6 +72,10 @@ parts: override-build: | snapcraftctl build mkdir -pv $SNAPCRAFT_PART_INSTALL/qt5-platform + override-prime: | + ls /usr/lib/x86_64-linux-gnu/libQt5Web* + execstack --clear-execstack /usr/lib/x86_64-linux-gnu/libQt5WebEngineCore.so.5.9.5 + snapcraftctl prime toggldesktop: source-type: git From 29ea360663e36066a08e8320fecc7c9ddef5731c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Fri, 15 Nov 2019 13:47:01 +0100 Subject: [PATCH 4/4] Use SNAPCRAFT_ARCH_TRIPLET to avoid failing build on archs other than x64 --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8e40bb5f54..e6e649660e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -74,7 +74,7 @@ parts: mkdir -pv $SNAPCRAFT_PART_INSTALL/qt5-platform override-prime: | ls /usr/lib/x86_64-linux-gnu/libQt5Web* - execstack --clear-execstack /usr/lib/x86_64-linux-gnu/libQt5WebEngineCore.so.5.9.5 + execstack --clear-execstack /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libQt5WebEngineCore.so.5.9.5 snapcraftctl prime toggldesktop: