diff --git a/contrib/build-flatpak.sh b/contrib/build-flatpak.sh new file mode 100755 index 0000000000..568ee6551c --- /dev/null +++ b/contrib/build-flatpak.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +export LC_ALL=C +set -e +SECONDS=0 + +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" + +# 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 + +# 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" diff --git a/contrib/flatpak-manifest.json b/contrib/flatpak-manifest.json new file mode 100644 index 0000000000..a113a9a059 --- /dev/null +++ b/contrib/flatpak-manifest.json @@ -0,0 +1,76 @@ +{ + "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=wayland", + "--socket=fallback-x11", + "--device=dri", + "--talk-name=org.kde.StatusNotifierWatcher", + "--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", + "*.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": ".." + }, + { + "type": "shell", + "commands": [ + "./autogen.sh" + ] + } + ] + } + ] +} \ No newline at end of file