From 60c74a472cd0fbd503e006120248cec668f4160e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Tue, 12 Dec 2023 00:32:04 +0300 Subject: [PATCH 01/14] contrib: Create initial Flatpak manifest --- contrib/flatpak-manifest.json | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 contrib/flatpak-manifest.json diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json new file mode 100644 index 0000000000..60ae4bcf6e --- /dev/null +++ b/contrib/flatpak-manifest.json @@ -0,0 +1,61 @@ +{ + "id": "us.gridcoin.Gridcoin-Research", + "branch": "main", + "runtime": "org.kde.Platform", + "runtime-version": "5.15-23.08", + "sdk": "org.kde.Sdk", + "command": "gridcoinresearch", + "rename-desktop-file": "gridcoinresearch.desktop", + "rename-icon": "gridcoinresearch", + "finish-args": [ + "--share=ipc", + "--share=network", + "--socket=x11", + "--socket=wayland", + "--device=dri" + ], + "cleanup": [ + "*.la", + "*.a" + ], + "modules": [ + { + "name": "libzip", + "cleanup": [ "/bin", "/share" ], + "sources": [ + { + "type": "archive", + "url": "https://nih.at/libzip/libzip-1.1.3.tar.xz", + "sha256": "729a295a59a9fd6e5b9fe9fd291d36ae391a9d2be0b0824510a214cfaa05ceee" + } + ] + }, + { + "name": "boost", + "buildsystem": "simple", + "build-commands": [ + "./bootstrap.sh --prefix=/app --with-libraries=system,filesystem,thread,iostreams,test", + "./b2 -j $FLATPAK_BUILDER_N_JOBS install" + ], + "sources": [ + { + "type": "archive", + "url": "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2", + "sha256": "8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc" + } + ] + }, + { + "name": "Gridcoin-Research", + "buildsystem": "autotools", + "config-opts": ["--with-boost-libdir=/app/lib"], + "sources": [ + { + "type": "dir", + "path": ".." + } + ] + } + ] +} + From 3805d21e0b8c14f994227c9e4ce609cc696d4d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Tue, 12 Dec 2023 00:32:45 +0300 Subject: [PATCH 02/14] contrib: Add script to build a Flatpak bundle --- contrib/build-flatpak.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 contrib/build-flatpak.sh diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh new file mode 100755 index 0000000000..9e9814ea24 --- /dev/null +++ b/contrib/build-flatpak.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +set -e +SECONDS=0 + +repo_root="$(realpath $(dirname "$0")/..)" +mkdir -p "$repo_root/build" +cd "$repo_root/build" + +echo $repo_root +flatpak-builder flatpak-build "$repo_root/contrib/flatpak-manifest.json" --force-clean +flatpak build-export gridcoin-flatpak flatpak-build +flatpak build-bundle gridcoin-flatpak Gridcoin-Research.flatpak us.gridcoin.Gridcoin-Research + +echo "Took $SECONDS seconds to build the Flatpak bundle." From a1f8e138682bc645d0b801cf9b9e5c1800fa4465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Tue, 12 Dec 2023 01:11:36 +0300 Subject: [PATCH 03/14] contrib: Convert sh to bash in build-flatpak Since $SECOND is undefined in POSIX sh, changed the shell in shebang from sh to bash. --- contrib/build-flatpak.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh index 9e9814ea24..9e5f4945fc 100755 --- a/contrib/build-flatpak.sh +++ b/contrib/build-flatpak.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash set -e SECONDS=0 From c525962f3377d4148dab671b28faa57a3dd14e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Tue, 26 Dec 2023 23:42:49 +0300 Subject: [PATCH 04/14] lint: Remove trailing space in flatpak manifest --- contrib/flatpak-manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index 60ae4bcf6e..463e77f303 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -48,7 +48,7 @@ { "name": "Gridcoin-Research", "buildsystem": "autotools", - "config-opts": ["--with-boost-libdir=/app/lib"], + "config-opts": ["--with-boost-libdir=/app/lib"], "sources": [ { "type": "dir", From a492d168c095e21657b2b6007f12fb71eb7f18ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Thu, 1 Feb 2024 14:56:20 +0300 Subject: [PATCH 05/14] contrib: Add LC_ALL=C to build-flatpak.sh --- contrib/build-flatpak.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh index 9e5f4945fc..a584a73459 100755 --- a/contrib/build-flatpak.sh +++ b/contrib/build-flatpak.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +export LC_ALL=C set -e SECONDS=0 From 3c24a751b64d51ac36cb944e52927d27989bf2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= <31849478+ikolomiko@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:28:07 +0300 Subject: [PATCH 06/14] Update contrib/build-flatpak.sh Surround the repo_root variable with double quotes Co-authored-by: div72 <60045611+div72@users.noreply.github.com> --- contrib/build-flatpak.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh index a584a73459..5dfc29d43f 100755 --- a/contrib/build-flatpak.sh +++ b/contrib/build-flatpak.sh @@ -7,7 +7,7 @@ repo_root="$(realpath $(dirname "$0")/..)" mkdir -p "$repo_root/build" cd "$repo_root/build" -echo $repo_root +echo "$repo_root" flatpak-builder flatpak-build "$repo_root/contrib/flatpak-manifest.json" --force-clean flatpak build-export gridcoin-flatpak flatpak-build flatpak build-bundle gridcoin-flatpak Gridcoin-Research.flatpak us.gridcoin.Gridcoin-Research From 712815f5a3716441ee62ea1118aa2d2664b01937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= <31849478+ikolomiko@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:28:30 +0300 Subject: [PATCH 07/14] Update contrib/build-flatpak.sh Co-authored-by: div72 <60045611+div72@users.noreply.github.com> --- contrib/build-flatpak.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh index 5dfc29d43f..e729478963 100755 --- a/contrib/build-flatpak.sh +++ b/contrib/build-flatpak.sh @@ -3,7 +3,7 @@ export LC_ALL=C set -e SECONDS=0 -repo_root="$(realpath $(dirname "$0")/..)" +repo_root="$(realpath "$(dirname "$0")/..")" mkdir -p "$repo_root/build" cd "$repo_root/build" From 16651c6878d150336b2f654dc0132016fff5ebb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= <31849478+ikolomiko@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:29:04 +0300 Subject: [PATCH 08/14] Update contrib/flatpak-manifest.json Run autogen.sh Co-authored-by: div72 <60045611+div72@users.noreply.github.com> --- contrib/flatpak-manifest.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index 463e77f303..039ca84bae 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -53,7 +53,11 @@ { "type": "dir", "path": ".." - } + }, + { + "type": "shell", + "commands": ["./autogen.sh"] + }, ] } ] From 96164394673517daa92adf89bc38069910d87b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Mon, 5 Feb 2024 23:36:18 +0300 Subject: [PATCH 09/14] formatting: auto-format flatpak-manifest.json --- contrib/flatpak-manifest.json | 36 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index 039ca84bae..4c919c6022 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -20,16 +20,19 @@ ], "modules": [ { - "name": "libzip", - "cleanup": [ "/bin", "/share" ], - "sources": [ - { - "type": "archive", - "url": "https://nih.at/libzip/libzip-1.1.3.tar.xz", - "sha256": "729a295a59a9fd6e5b9fe9fd291d36ae391a9d2be0b0824510a214cfaa05ceee" - } - ] - }, + "name": "libzip", + "cleanup": [ + "/bin", + "/share" + ], + "sources": [ + { + "type": "archive", + "url": "https://nih.at/libzip/libzip-1.1.3.tar.xz", + "sha256": "729a295a59a9fd6e5b9fe9fd291d36ae391a9d2be0b0824510a214cfaa05ceee" + } + ] + }, { "name": "boost", "buildsystem": "simple", @@ -48,7 +51,9 @@ { "name": "Gridcoin-Research", "buildsystem": "autotools", - "config-opts": ["--with-boost-libdir=/app/lib"], + "config-opts": [ + "--with-boost-libdir=/app/lib" + ], "sources": [ { "type": "dir", @@ -56,10 +61,11 @@ }, { "type": "shell", - "commands": ["./autogen.sh"] - }, + "commands": [ + "./autogen.sh" + ] + } ] } ] -} - +} \ No newline at end of file From 5471231f5e080b9ef94fff31b503ca3d9124738b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Tue, 6 Feb 2024 00:25:36 +0300 Subject: [PATCH 10/14] contrib: Add requested changes to build-flatpak.sh - Add the flathub.org remote if it doesn't exist - Download required SDK and runtimes if not downloaded - Display the path of the created bundle with the command to install it --- contrib/build-flatpak.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh index e729478963..568ee6551c 100755 --- a/contrib/build-flatpak.sh +++ b/contrib/build-flatpak.sh @@ -3,13 +3,28 @@ export LC_ALL=C set -e SECONDS=0 -repo_root="$(realpath "$(dirname "$0")/..")" -mkdir -p "$repo_root/build" -cd "$repo_root/build" +gc_platform="org.kde.Platform//5.15-23.08" +gc_sdk="org.kde.Sdk//5.15-23.08" +gc_id="us.gridcoin.Gridcoin-Research" +gc_output_file="Gridcoin-Research.flatpak" +gc_repo_root="$(realpath "$(dirname "$0")/..")" +gc_builddir="$gc_repo_root/build" -echo "$repo_root" -flatpak-builder flatpak-build "$repo_root/contrib/flatpak-manifest.json" --force-clean -flatpak build-export gridcoin-flatpak flatpak-build -flatpak build-bundle gridcoin-flatpak Gridcoin-Research.flatpak us.gridcoin.Gridcoin-Research +# Add the required flathub.org repo to the list of local repos, if it wasn't added earlier. +flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo -echo "Took $SECONDS seconds to build the Flatpak bundle." +# Check if the required SDK and runtime are installed. If not, install them. +flatpak info "$gc_platform" &>/dev/null || flatpak install --noninteractive -y flathub "$gc_platform" +flatpak info "$gc_sdk" &>/dev/null || flatpak install --noninteractive -y flathub "$gc_sdk" + +echo "Started building the Gridcoin-Research Flatpak bundle..." +mkdir -p "$gc_builddir" +flatpak-builder --state-dir="$gc_builddir/flatpak-cache" "$gc_builddir/flatpak-build" "$gc_repo_root/contrib/flatpak-manifest.json" --force-clean +flatpak build-export "$gc_builddir/gridcoin-flatpak" "$gc_builddir/flatpak-build" +flatpak build-bundle "$gc_builddir/gridcoin-flatpak" "$gc_builddir/$gc_output_file" "$gc_id" + +relative_output="$(realpath --relative-to="$PWD" "$gc_builddir/$gc_output_file")" +echo "" +echo "Took $SECONDS seconds to build the Flatpak bundle. You can find the output in $relative_output" +echo "To install it, run the command below:" +echo "flatpak install $relative_output" From 503eeaedbad5ca54a74d166bbb0a43646c78ac91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Fri, 9 Feb 2024 22:17:22 +0300 Subject: [PATCH 11/14] flatpak: make wayland default --- contrib/flatpak-manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index 4c919c6022..7a48a0f90a 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -10,8 +10,8 @@ "finish-args": [ "--share=ipc", "--share=network", - "--socket=x11", "--socket=wayland", + "--socket=fallback-x11", "--device=dri" ], "cleanup": [ From c3777281b241145bb8f96901148488c6315e7f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Fri, 9 Feb 2024 22:19:21 +0300 Subject: [PATCH 12/14] flatpak: add system tray permission --- contrib/flatpak-manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index 7a48a0f90a..b75e388e6a 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -12,7 +12,8 @@ "--share=network", "--socket=wayland", "--socket=fallback-x11", - "--device=dri" + "--device=dri", + "--talk-name=org.kde.StatusNotifierWatcher" ], "cleanup": [ "*.la", From bd966c27678b1ce1245b125a81b6d93724fb6fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Fri, 9 Feb 2024 22:20:36 +0300 Subject: [PATCH 13/14] flatpak: add dbus notification permission --- contrib/flatpak-manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index b75e388e6a..1d5ae35615 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -13,7 +13,8 @@ "--socket=wayland", "--socket=fallback-x11", "--device=dri", - "--talk-name=org.kde.StatusNotifierWatcher" + "--talk-name=org.kde.StatusNotifierWatcher", + "--talk-name=org.freedesktop.Notifications" ], "cleanup": [ "*.la", From b8239b007cf14d8f2b1407fcea477f3e2ca52203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20Avc=C4=B1?= Date: Fri, 9 Feb 2024 22:21:30 +0300 Subject: [PATCH 14/14] flatpak: give r/o access to BOINC data dirs --- contrib/flatpak-manifest.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json index 1d5ae35615..a113a9a059 100644 --- a/contrib/flatpak-manifest.json +++ b/contrib/flatpak-manifest.json @@ -14,7 +14,10 @@ "--socket=fallback-x11", "--device=dri", "--talk-name=org.kde.StatusNotifierWatcher", - "--talk-name=org.freedesktop.Notifications" + "--talk-name=org.freedesktop.Notifications", + "--filesystem=~/.var/app/edu.berkeley.BOINC:ro", + "--filesystem=/var/lib/boinc-client:ro", + "--filesystem=/var/lib/boinc:ro" ], "cleanup": [ "*.la",