Sign in Join
Wiki copytemporary

Flatpak

Instructions

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"/>
  </releases>

  <categories>
    <category>Games</category>
  </categories>

  <content_rating type="oars-1.1"/>
</component>
yaml
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
  - --filesystem=home
  - --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 -d -m 755 $FLATPAK_DEST/share/App
      - install -s -m 755 App $FLATPAK_DEST/share/App
      - install -d -m 755 $FLATPAK_DEST/bin
      - ln -s $FLATPAK_DEST/share/App/App $FLATPAK_DEST/bin/App
      - install -d -m 755 $FLATPAK_DEST/share/applications
      - install -m 755 ${FLATPAK_ID}.desktop $FLATPAK_DEST/share/applications
      - install -d -m 755 $FLATPAK_DEST/share/icons/hicolor/256x256/apps
      - install -m 644 App.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
      - install -d -m 755 $FLATPAK_DEST/share/metainfo
      - install -D com.domain.App.appdata.xml -t $FLATPAK_DEST/share/metainfo/com.domain.App.metainfo.xml
bash
[Desktop Entry]
Encoding=UTF-8
Name=App
Comment=Example application
Exec=App
Icon=com.domain.App.png
Terminal=false
Type=Application
Categories=GNOME;Application;Game;
StartupNotify=true
bash
#!/bin/bash

BUILD_DIR=build
REPO_DIR=repo
FLATPAK_ID=com.domain.App

# 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
flatpak install 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

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.

See also

External links


From the Free Pascal wiki, page "Flatpak", as it stood on 2024-05-21 after a change by Chronos, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.