Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add Flatpak manifest file #2724

Draft
wants to merge 15 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions contrib/build-flatpak.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
export LC_ALL=C
set -e
SECONDS=0

ikolomiko marked this conversation as resolved.
Show resolved Hide resolved
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"
76 changes: 76 additions & 0 deletions contrib/flatpak-manifest.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}
]
}