Skip to content

Flatpak

Narta Xaymar Dirks edited this page Nov 14, 2026 · 1 revision

Flatpak

The Flatpak is the only Linux release format (there are no deb, rpm, Arch or snap packages). There are two parts, both built by the Build workflow (flatpak x86_64 and flatpak arm64, one pair per architecture, as a Flatpak holds only one):

  • com.xaymar.BlitzLLVM: the compiler and the tools (blitzcc, blitz-format, blitz-tidy), on the freedesktop SDK because blitzcc hands programs to clang (which comes from the SDK extension org.freedesktop.Sdk.Extension.llvm21).
  • com.xaymar.BlitzLLVM.Runtime: the shared libraries that programs load when they run (FFmpeg for movies, the AVIF, JPEG XL, TIFF and WebP codecs, Opus and Ogg), with their licenses. The compiler and every game ask for it as an extension, so Flatpak installs it once, however many games are installed.
flatpak install --user --bundle blitzllvm-<version>-flatpak-x64-runtime.flatpak
flatpak install --user --bundle blitzllvm-<version>-flatpak-x64.flatpak
flatpak run com.xaymar.BlitzLLVM hello.bb

Run the other tools with flatpak run --command=blitz-format com.xaymar.BlitzLLVM file.bb. The compiler gets your home folder (flatpak override --user --filesystem=host com.xaymar.BlitzLLVM for more), the network, sound, a window (Wayland or X11) and the GPU and controllers. Programs that blitzcc runs for you run inside the sandbox too.

Programs for the other architecture

Each compiler Flatpak holds the runtime of x86-64 and of arm64, but its clang does not: the one from org.freedesktop.Sdk.Extension.llvm21 only has the target of its own CPU. So the Flatpak makes programs for its own architecture. For the other one, give blitzcc a clang that has both targets (a distribution's clang, for instance) and the C library of the target as the sysroot, like with any cross compile:

flatpak run --env=BLITZLLVM_CC=/usr/bin/clang --filesystem=/usr:ro com.xaymar.BlitzLLVM --target aarch64-linux-gnu --llvm-flag --sysroot=/path/to/sysroot -o game-arm64 game.bb

The shared libraries of the other architecture are not in the extension: the program runs where the extension of its own architecture is installed, which is how a game Flatpak works on both. A game Flatpak for the other architecture is built with flatpak-builder --arch=aarch64 (it needs qemu-user binfmt on the build machine).

Shipping your game

packaging/flatpak/game-template is a template for releasing a compiled game as a Flatpak of its own, on org.freedesktop.Platform with the runtime extension. The game is only its executable and its media: the libraries are not copied next to it (the compiler Flatpak tells blitzcc that the extension provides them, see system-libraries.txt), and other games share the one copy of the extension.

./build.sh mygame.bb media/     # compiles inside the compiler Flatpak, packs com.example.MyGame.flatpak
  • /app is read-only, so launcher.sh runs the game with a writable working directory in the game's own data folder (~/.var/app/<id>/data) where the shipped files appear as links. Saves land there.
  • The game gets a window, sound, GPU and controllers, and the network only if it needs it (remove --share=network otherwise). It does not get the player's files.
  • The compile uses -static-libstdc++ -static-libgcc. SDL3 is still linked into each game (about the same size as one codec), and libblitzphysics.so is copied next to games that use collisions or picking; moving both into the extension is possible later.

How it is built

flatpak-builder does not build BlitzLLVM: the Build jobs build it once per architecture with every BLITZ_SYSTEM_* option OFF (the freedesktop runtime has none of the libraries that a distribution's package takes from the system) and install it with prefix /app. The flatpak job merges the installs of both architectures, and packaging/flatpak/split.sh moves the shared libraries of its own architecture into the extension, drops the others and marks them as provided by the system. Flathub is not possible with this: it builds from source without network access.

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally