Flatpak
From Lazarus wiki
(Redirected from Flatpack)
Jump to navigationJump to search
Instructions
- Assume an application called App with Flatpak ID: com.domain.App
- Create a file named com.domain.App.appdata.xml:
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.domain.App</id>
<name>App</name>
<summary>Example application</summary>
<developer_name>Developer</developer_name>
<url type="homepage">https://domain.com/App/</url>
<metadata_license>CC0-1.0</metadata_license>
<project_license>CC0-1.0</project_license>
<description>
<p>
A description of the App.
</p>
</description>
<launchable type="desktop-id">com.domain.App.desktop</launchable>
<screenshots>
<screenshot type="default">
<caption>Main screenshot</caption>
<image>https://domain.com/Screenshot.jpg</image>
</screenshot>
</screenshots>
<releases>
<release version="1.0.0" date="2024-01-01">
<url type="details">https://domain.com/Release_notes.txt</url>
<description>
<ul>
<li>Added new.</li>
<li>Changed existing.</li>
<li>Fixed bug.</li>
</ul>
</description>
</release>
</release>
</releases>
<categories>
<category>Games</category>
</categories>
<content_rating type="oars-1.1"/>
</component>
- Create a file named com.domain.App.yml:
app-id: com.domain.App
runtime: org.kde.Platform
runtime-version: '5.15-23.08'
sdk: org.kde.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.freepascal
command: App
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri
modules:
- name: qt5pas
buildsystem: qmake
config-opts:
- -after
- target.path=/app/lib
sources:
- type: shell
commands:
- cp -r /usr/lib/sdk/freepascal/share/lazarus/lcl/interfaces/qt5/cbindings/. .
- name: App
sources:
- type: svn
url: https://domain.com/App/trunk
revision: r1
buildsystem: simple
build-commands:
- |
. /usr/lib/sdk/freepascal/enable.sh
lazbuild --build-mode=Release --ws=qt5 App.lpi
- install -Dm755 App -t $FLATPAK_DEST/share/App
- install -d $FLATPAK_DEST/bin
- ln -s $FLATPAK_DEST/share/App/App $FLATPAK_DEST/bin/App
- install -Dm644 ${FLATPAK_ID}.desktop -t $FLATPAK_DEST/share/applications
- install -Dm644 App.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
- install -Dm644 ${FLATPAK_ID}.appdata.xml $FLATPAK_DEST/share/metainfo/${FLATPAK_ID}.metainfo.xml
- Create a file com.domain.App.desktop:
[Desktop Entry]
Encoding=UTF-8
Name=App
Comment=Example application
Exec=App
Icon=com.domain.App.png
Terminal=false
Type=Application
Categories=Application
StartupNotify=true
- Create a build script named build.sh:
#!/bin/bash
BUILD_DIR=build
REPO_DIR=repo
FLATPAK_ID=com.domain.App
# Install dependencies
flatpak install --system flathub org.kde.Sdk//5.15-23.08
flatpak install --system flathub org.kde.Platform//5.15-23.08
flatpak install --system flathub org.freedesktop.Sdk.Extension.freepascal//23.08
flatpak install --system flathub org.flatpak.Builder
# Build
flatpak run org.flatpak.Builder --force-clean --sandbox --user --install --ccache --mirror-screenshots-url=https://dl.flathub.org/media/ --repo=$REPO_DIR $BUILD_DIR $FLATPAK_ID.yml
# Run
flatpak run $FLATPAK_ID
# Linter
flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest $FLATPAK_ID.yml
flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo $REPO_DIR
- Run the build.sh script and test the application.
- Follow the submission process to submit your app to Flathub.
Notes
Flathub offers a very limited number of "platforms" that your application needs to fit into. It does not offer a GTK2 one but does have a QT5 one. However that platform does not contain all the libraries normally found on a Qt5 system so expect to have to bundle libraries into your Flatpack if your application makes use of other libraries.
Does not sound like a very FPC/Lazarus (as it stands now) friendly environment but there are some of "our" applications there.