Debian Codegraph @

docs/en/reference/platforms/linux/flatpak.md

raw
1 # Flatpak
2
3 <table class="host-platform-support-table">
4 <colgroup>
5 <col style="width: 11%" />
6 <col style="width: 10%" />
7 <col style="width: 7%" />
8 <col style="width: 5%" />
9 <col style="width: 6%" />
10 <col style="width: 5%" />
11 <col style="width: 5%" />
12 <col style="width: 7%" />
13 <col style="width: 11%" />
14 <col style="width: 7%" />
15 <col style="width: 10%" />
16 </colgroup>
17 <thead>
18 <tr>
19 <th colspan="11"><a href="../../../../reference/platforms">Host Platform Support</a></th>
20 </tr>
21 <tr>
22 <th colspan="2">macOS</th>
23 <th colspan="5">Windows</th>
24 <th colspan="4">Linux</th>
25 </tr>
26 <tr>
27 <th>x86‑64</th>
28 <th>arm64</th>
29 <th>x86</th>
30 <th colspan="2">x86‑64</th>
31 <th colspan="2">arm64</th>
32 <th>x86</th>
33 <th>x86‑64</th>
34 <th>arm</th>
35 <th>arm64</th>
36 </tr>
37 </thead>
38 <tbody>
39 <tr>
40 <td></td>
41 <td></td>
42 <td></td>
43 <td colspan="2"></td>
44 <td colspan="2"></td>
45 <td>{{ not_tested }}</td>
46 <td>{{ ci_tested }}</td>
47 <td>{{ not_tested }}</td>
48 <td>{{ ci_tested }}</td>
49 </tr>
50 </tbody>
51 </table>
52
53 [Flatpak](https://flatpak.org) provides a way for developers to distribute apps to Linux users in a format that is independent of the specific distribution used by the end-user. It allow packaging applications for use on any common Linux distribution, including Ubuntu, Debian, Fedora, and more. There are some system packages needed to run and build Flatpaks; see the [Flatpak setup guide](https://flatpak.org/setup) for more details.
54
55 A Flatpak app is built by compiling against a `runtime`. Runtimes provide the basic dependencies that are used by applications. Each application must be built against a runtime, and this runtime must be installed on a host system in order for the application to run (Flatpak can automatically install the runtime required by an application).
56
57 The end user will install the Flatpak into their local app repository; this can be done by installing directly from a single file `.flatpak` bundle, or by installing from a package repository like [Flathub](https://flathub.org). Apps can be installed into user-space, or if the user has sufficient privileges, they can be installed into a system-wide app repository.
58
59 Briefcase currently supports creating `.flatpak` single file bundles; end users can install the app bundle by running:
60
61 ```console
62 $ flatpak install --user App_Name-1.2.3-x86_64.flatpak
63 ```
64
65 substituting the name of the flatpak file as appropriate. The `--user` option can be omitted if the user wants to install the app system-wide.
66
67 The app can then be run with:
68
69 ```console
70 $ flatpak run com.example.appname
71 ```
72
73 specifying the app bundle identifier as appropriate.
74
75 Briefcase *can* be published to Flathub or another Flatpak repository; but Briefcase does not currently support automated publication of apps.
76
77 ## Icon format
78
79 Flatpak uses `.png` format icons. An application must provide icons in the following sizes:
80
81 - 16px
82 - 32px
83 - 64px
84 - 128px
85 - 256px
86 - 512px
87
88 Flatpaks do not support splash screens or installer images.
89
90 ## Application configuration
91
92 The following options can be added to the `tool.briefcase.app.<appname>.linux.flatpak` section of your `pyproject.toml` file:
93
94 ### `finish_arg`
95
96 The arguments used to configure the Flatpak sandbox. `finish_arg` is an attribute that can have additional sub-attributes; each sub-attribute maps to a single property that will be added to the app's manifest. For example, to add `--allow=bluetooth` as a finish argument, you would specify:
97
98 ```python
99 finish_arg."allow=bluetooth" = true
100 ```
101
102 Briefcase adds the following finish arguments by default:
103
104 - `share=ipc`
105 - `socket=x11`
106 - `nosocket=wayland`
107 - `share=network`
108 - `device=dri`
109 - `socket=pulseaudio`
110 - `filesystem=xdg-cache`
111 - `filesystem=xdg-config`
112 - `filesystem=xdg-data`
113 - `filesystem=xdg-documents`
114 - `socket=session-bus`
115
116 These can be disabled by explicitly setting their value to `False`; for example, to disable audio access, you would specify:
117
118 ```python
119 finish_arg."socket=pulseaudio" = false
120 ```
121
122 ### `flatpak_runtime_repo_alias`
123
124 An alias to use when registering the Flatpak repository that will store the Flatpak runtime used to build the app. By default, Briefcase will use [Flathub](https://flathub.org) as its runtime repository, with an alias of `flathub`.
125
126 ### `flatpak_runtime_repo_url`
127
128 The repository URL hosting the runtime and SDK package that the Flatpak will use. By default, Briefcase will use [Flathub](https://flathub.org) as its runtime repository.
129
130 ### `flatpak_runtime`
131
132 A string, identifying the [runtime](https://docs.flatpak.org/en/latest/available-runtimes.html) to use as a base for the Flatpak app.
133
134 The Flatpak runtime and SDK are paired; so, both a [`flatpak_runtime`][] and a corresponding [`flatpak_sdk`][] must be defined.
135
136 ### `flatpak_runtime_version`
137
138 A string, identifying the version of the Flatpak runtime that should be used.
139
140 ### `flatpak_base`
141
142 An optional string, identifying the [base](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest) to use as a base for the Flatpak app. A base is a set of extensions layered on top of a runtime image, providing additional functionality for the packaged application. Some GUI frameworks (e.g., PyQt) provide a base image to ensure common required resources are available at runtime.
143
144 ### `flatpak_base_version`
145
146 An optional string (required if [`flatpak_base`][] is defined), identifying the version of the Flatpak base that should be used.
147
148 ### `flatpak_sdk`
149
150 A string, identifying the SDK associated with the platform that will be used to build the Flatpak app.
151
152 The Flatpak runtime and SDK are paired; so, both a [`flatpak_runtime`][] and a corresponding [`flatpak_sdk`][] must be defined.
153
154 ### `modules_extra_content`
155
156 Additional build instructions that will be inserted into the Flatpak manifest, *after* Python has been installed and `pip` is guaranteed to exist, but *before* any app code or app packages have been installed into the Flatpak.
157
158 ## Permissions
159
160 Permissions are not used for Flatpak packaging.
161
162 ## Compilation issues with Flatpak
163
164 Flatpak works by building a sandbox in which to compile the application bundle. This sandbox uses some low-level kernel and file system operations to provide the sandboxing behavior. As a result, Flatpaks cannot be built inside a Docker container, and they cannot be build on an NFS mounted drive.
165
166 If you get errors about `renameat` when building an app, similar to the following:
167
168 ```console
169 [helloworld] Building Flatpak...
170 Downloading sources
171 Initializing build dir
172 Committing stage init to cache
173 Error: Writing metadata object: renameat: Operation not permitted
174 Building...
175
176 Error while building app helloworld.
177
178 Log saved to ...
179 ```
180
181 you may be building on an NFS drive. Move your project to local storage, and retry the build.