Packaging the Applications¶
Each of the subdirectories inside the
apps directory contains a manifest
file for use with Flatpak. This describes where the application source code can
be obtained from, how the application is built, the dependencies that need to
be built with it, and the permissions it needs when it is run.
Following the instructions in Cross-Building an Application, we use
flatpak-builder to build a flatpak for the application. To do this we need
to install the runtime and SDK that the application depends on. These are the
same as those mentioned in Setting up Flatpak for GNOME Development except that we need the
ones for the aarch64 architecture:
flatpak --user install flathub org.gnome.Platform/aarch64/3.34 org.gnome.Sdk/aarch64/3.34
After installing these, build the application with
example, here is how to build the Title Bar application from the
flatpak-builder --arch=aarch64 --repo=myrepo _flatpak com.example.title_bar.json
The result is stored in the
myrepo directory, which is a local repository.
Export a binary bundle from the repository by running
flatpak with the
flatpak build-bundle --arch=aarch64 myrepo app.flatpak com.example.title_bar
In this case the bundle is written to the
app.flatpak file. This can be
copied to the phone or development board for installation.
One way to install the application is to use the
flatpak tool on the
command line to install the binary bundle. Other more user-friendly ways are
First of all, copy the bundle to the target device and make it readable by the
purism user. Then, log in to the device and ensure that the
remote is registered for the user:
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Assuming that the
app.flatpak file is in the current directory, install it
for the user by running the
flatpak --user install app.flatpak
Flatpak will resolve the dependencies of the bundle using the remote we registered and ask you if you want to install them if they are not already present. It will then install the application itself.
You can run the application using
flatpak in the usual way:
flatpak run com.example.title_bar
When you are finished with the application and want to uninstall it, use the following command:
flatpak uninstall com.example.title_bar
You can also uninstall the runtime needed by the application, but it may be useful to keep it installed for future use.