Skip to content

Commit

Permalink
contrib: Add requested changes to build-flatpak.sh
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ikolomiko committed Feb 5, 2024
1 parent 4f8aaa2 commit 28be580
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions contrib/build-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 28be580

Please sign in to comment.