#!/bin/bash

BUILD_DIR=build
FLATPAK_ID=net.zdechov.app.C-evo

# Install dependencies
flatpak install flathub org.kde.Sdk//5.15-23.08
flatpak install flathub org.kde.Platform//5.15-23.08
flatpak install flathub org.freedesktop.Sdk.Extension.freepascal//23.08

# Build
flatpak-builder --force-clean $BUILD_DIR $FLATPAK_ID.yml

# Build bundle
flatpak build-export export build
flatpak build-bundle export C-evo.flatpak $FLATPAK_ID

# Install
flatpak-builder --user --install --force-clean $BUILD_DIR $FLATPAK_ID.yml

# Run
flatpak run $FLATPAK_ID
