packaging: the aarch64 flatpak

crafter-build cross-compiles the executable for aarch64, which on an
x86_64 machine needs no emulation, and flatpak's build commands assemble
the flatpak; there is no flatpak-builder manifest.

make-flatpak-sysroot.sh makes the sysroot: the aarch64 Freedesktop Sdk
26.08 with LLVM's libc++ of the release crafter-build carries (23.1.2,
the tarball and hash of Crafter.Build's manifest), built for aarch64.
build-flatpak.sh builds the executable against it for generic armv8-a
and assembles it on the Platform 26.08 with that libc++, libc++abi and
LLVM's libunwind in /app/lib: the Platform has no libc++, and its
libunwind is libunwind 8. It fails when the executable or a bundled
library needs a library neither the Platform nor /app/lib has, and when
one of them links libunwind 8, which libc++'s -lunwind found first until
the sysroot dropped its link name. The executable it packages is the
build it just ran: the output directory's name ends in a hash of the
configuration, so an older variant (another sysroot, --debug, --local)
left in bin/ is removed first. make-flatpak-sysroot.sh tries each
download five times, 30 s apart: Flathub's CDN answers 502 now and then.
The sandbox gets Wayland, the GPU, net.catcrafts.IMS1 on the system bus
and org.freedesktop.Notifications on the session bus. The metainfo's
content rating declares the app's chat (OARS social-chat intense:
uncontrolled texting between users), as the baseline Chatty's does, for
the software centres and parental controls that read it, and recommends
a display of 360 logical pixels or more — the phone screen the window is
drawn for; a recommendation, not a requirement. The metainfo's one
release is 0.0.0, and the app's version, 0.1.0 in the skeleton, is set
to it: the version's comment in Model.cppm says a release moves the two
together. AGENTS.md's SPDX rule says what the metainfo carries instead
of the two SPDX lines: AppStream's single CC0-1.0 line.

The flatpak carries the licences of what it ships under
/app/share/licenses/net.catcrafts.ImsdMessages: the app's and the font's,
those of the Crafter libraries it links statically and of the code they
bring along (packaging/licenses/, with a NOTICE naming what each text
covers), and LLVM's for its runtime libraries, which
make-flatpak-sysroot.sh keeps beside libc++.
This commit is contained in:
Jorijn van der Graaf 2026-10-21 23:59:17 +02:00
commit 411ed55660
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
11 changed files with 955 additions and 6 deletions

View file

@ -34,7 +34,7 @@ and §7.9 (Messaging) and §8.1 (the frozen one).
| `tests/<Name>/main.cpp` | One test per directory, declared in `project.cpp`. |
| `utilities/` | `fake-imsd.py`: imsd's Messaging interface on the session bus, for benches. |
| `assets/` | The bundled font (Noto Sans, OFL 1.1). |
| `packaging/` | The desktop entry and the icon. |
| `packaging/` | The desktop entry, metainfo and icon; the flatpak's sysroot and build scripts and licence texts it ships (`licenses/`; §4 has the whole set). |
## 3. Building and testing
@ -52,7 +52,47 @@ The build takes Crafter.DB and Crafter.Graphics from the forge at the
commits `project.cpp` pins; `crafter-build -- --local` builds them from
sibling checkouts in `../Crafter/` instead.
## 4. Making changes
## 4. The flatpak
The app ships as the aarch64 flatpak `net.catcrafts.ImsdMessages` on
org.freedesktop.Platform 26.08. crafter-build cross-compiles it; there is no
flatpak-builder manifest:
```sh
packaging/make-flatpak-sysroot.sh # the sysroot; kept until the Sdk or the recipe changes
packaging/build-flatpak.sh dist/repo # the executable, assembled into an OSTree repo (branch master)
flatpak build-bundle --arch=aarch64 dist/repo dist/imsd-messages.flatpak net.catcrafts.ImsdMessages master
```
The sysroot is the aarch64 Freedesktop Sdk with LLVM's libc++ of the
release crafter-build carries, whose std module source crafter-build
ships. The Platform has no libc++, so the flatpak
bundles libc++, libc++abi and libunwind in `/app/lib`; the build fails when
a library the executable needs is in neither the Platform nor `/app/lib`, or
when the executable or a library in `/app/lib` links the Platform's
libunwind 8 beside LLVM's. Both scripts
keep their state under `imsd-messages/flatpak` in `$XDG_CACHE_HOME`
(`~/.cache` when unset; `IMSD_MESSAGES_FLATPAK_CACHE` names another
directory) and run the crafter-build that `CRAFTER_REF` names
(`net.catcrafts.CrafterBuild//stable` by default).
The flatpak carries the licences of what it ships under
`/app/share/licenses/net.catcrafts.ImsdMessages/`: `LICENSE`,
`assets/OFL.txt`, the texts in `packaging/licenses/` (its `NOTICE` names
what each covers) and LLVM's runtime licences, which
make-flatpak-sysroot.sh keeps beside libc++. The texts in
`packaging/licenses/` follow what the pinned Crafter.Graphics carries and
compiles in: a new pin checks them again.
The sandbox has Wayland, the GPU, `net.catcrafts.IMS1` on the system bus
and `org.freedesktop.Notifications` on the session bus. When `FLATPAK_ID`
is the app's own id, as inside its flatpak, the instance asks the
Background portal when it starts (not for `--send` or `--headless`) to
start `imsd-messages --daemon` at login (`ImsdMessages.Bus:Background`);
the portal writes the login entry again at each request while the
background permission allows it.
## 5. Making changes
- Commit messages: subject `area: what changes`, the body says why; no AI
attribution trailers; every commit GPG-signed with the repository's
@ -61,4 +101,5 @@ sibling checkouts in `../Crafter/` instead.
the fp6 project's `/prepush` gates.
- Every source file starts with the two SPDX lines and a blank line — after
a shebang or an XML declaration where the file has one, as `#` comments in
a desktop entry.
a desktop entry; the metainfo carries AppStream's single CC0-1.0 line
instead.