Sign in Join
Wiki copytemporary

Flatpak: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Flatpak

OldNewLine
1+## Instructions
2+
3+- Assume an application called **App** with Flatpak ID: **com.domain.App**
4+
5+- Create a file named com.domain.App.appdata.xml:
6+
7+``` xml
8+<?xml version="1.0" encoding="UTF-8"?>
9+<component type="desktop-application">
10+ <id>com.domain.App</id>
11+
12+ <name>App</name>
13+ <summary>Example application</summary>
14+ <developer_name>Developer</developer_name>
15+
16+ <url type="homepage">https://domain.com/App/</url>
17+
18+ <metadata_license>CC0-1.0</metadata_license>
19+ <project_license>CC0-1.0</project_license>
20+
21+ <description>
22+ <p>
23+ A description of the App.
24+ </p>
25+ </description>
26+
27+ <launchable type="desktop-id">com.domain.App.desktop</launchable>
28+
29+ <screenshots>
30+ <screenshot type="default">
31+ <caption>Main screenshot</caption>
32+ <image>https://domain.com/Screenshot.jpg</image>
33+ </screenshot>
34+ </screenshots>
35+
36+ <releases>
37+ <release version="1.0.0" date="2024-01-01"/>
38+ </releases>
39+
40+ <categories>
41+ <category>Games</category>
42+ </categories>
43+
44+ <content_rating type="oars-1.1"/>
45+</component>
46+```
47+
48+- Create a file named com.domain.App.yml:
49+
50+``` yaml
51+app-id: com.domain.App
52+runtime: org.kde.Platform
53+runtime-version: '5.15-23.08'
54+sdk: org.kde.Sdk
55+sdk-extensions:
56+ - org.freedesktop.Sdk.Extension.freepascal
57+command: App
58+finish-args:
59+ - --share=ipc
60+ - --socket=fallback-x11
61+ - --socket=wayland
62+ - --filesystem=home
63+ - --device=dri
64+modules:
65+ - name: qt5pas
66+ buildsystem: qmake
67+ config-opts:
68+ - -after
69+ - target.path=/app/lib
70+ sources:
71+ - type: shell
72+ commands:
73+ - cp -r /usr/lib/sdk/freepascal/share/lazarus/lcl/interfaces/qt5/cbindings/. .
74+ - name: App
75+ sources:
76+ - type: svn
77+ url: https://domain.com/App/trunk
78+ revision: r1
79+ buildsystem: simple
80+ build-commands:
81+ - (. /usr/lib/sdk/freepascal/enable.sh && lazbuild --build-mode=Release --ws=qt5 App.lpi)
82+ - install -d -m 755 $FLATPAK_DEST/share/App
83+ - install -s -m 755 App $FLATPAK_DEST/share/App
84+ - install -d -m 755 $FLATPAK_DEST/bin
85+ - ln -s $FLATPAK_DEST/share/App/App $FLATPAK_DEST/bin/App
86+ - install -d -m 755 $FLATPAK_DEST/share/applications
87+ - install -m 755 ${FLATPAK_ID}.desktop $FLATPAK_DEST/share/applications
88+ - install -d -m 755 $FLATPAK_DEST/share/icons/hicolor/256x256/apps
89+ - install -m 644 App.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
90+ - install -d -m 755 $FLATPAK_DEST/share/metainfo
91+ - install -D com.domain.App.appdata.xml -t $FLATPAK_DEST/share/metainfo/com.domain.App.metainfo.xml
92+```
93+
94+- Create file com.domain.App.desktop:
95+
96+``` bash
97+[Desktop Entry]
98+Encoding=UTF-8
99+Name=App
100+Comment=Example application
101+Exec=App
102+Icon=com.domain.App.png
103+Terminal=false
104+Type=Application
105+Categories=GNOME;Application;Game;
106+StartupNotify=true
107+```
108+
109+- Create a build script named build.sh
110+
111+``` bash
112+#!/bin/bash
113+
114+BUILD_DIR=build
115+REPO_DIR=repo
116+FLATPAK_ID=com.domain.App
117+
118+# Install dependencies
119+flatpak install flathub org.kde.Sdk//5.15-23.08
120+flatpak install flathub org.kde.Platform//5.15-23.08
121+flatpak install flathub org.freedesktop.Sdk.Extension.freepascal//23.08
122+flatpak install flathub org.flatpak.Builder
123+
124+# Build
125+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
126+
127+# Run
128+flatpak run $FLATPAK_ID
129+
130+# Linter
131+flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest $FLATPAK_ID.yml
132+flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo $REPO_DIR
133+```
134+
135+- Run the build.sh script and test the application
136+- Follow the [submission process](https://docs.flathub.org/docs/for-app-authors/submission/) to submit your app to Flathub.
137+
138+## Notes
139+
140+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.
141+
142+Does not sound like a very FPC/Lazarus (as it stands now) friendly environment but there are some of "our" applications there.
143+
144+# See also
145+
146+- [[Deploying Your Application]]
147+
148+# External links
149+
150+- [Existing flatpack projects on GitHub built with Lazarus](https://github.com/search?q=org%3Aflathub+lazbuild&type=code)
151+- [flathub.org](https://flathub.org/)
152+- [A Flathub forum Post](https://discourse.flathub.org/t/questions-on-building/1975)
153+- [KDE Your first Flatpak](https://develop.kde.org/docs/packaging/flatpak/packaging/)
154+
155+---
156+*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](/wiki-contact).*
157+Category: Deployment
158+Category: Linux

Back to history