Files
pdfcraft/packaging/linux/flatpak/ai.storyteller.pdfcraft.bundle.yml
Brandon Thomas d90b3f897f Refs #103: ship the OCR models in the desktop release packages (#630)
Release builds said "Text recognition isn't installed: its models are
missing" because no packaging script or release job fetched the OCR
models: only `cargo xtask models` does, into the source tree.

- packaging/env.sh gains stage_models DEST, which runs
  `cargo xtask models DEST` (every ATTRIBUTION.toml kind = "model" file,
  SHA-256 verified, with its licence text). No model file is named, so
  the models PRs #433/#572 add ship without packaging changes.
- `cargo xtask models` also writes ATTRIBUTION.txt crediting each model
  (CC-BY-SA-4.0 requires attribution when redistributed).
- macOS: PdfCraft.app/Contents/Resources/models, before signing.
- Windows: models\ beside pdfcraft.exe in the MSI (WiX v5 <Files>
  harvest) and the portable zip; test-msi.ps1 checks the folder.
- Linux deb/rpm/tar.gz/AppImage, Flatpak bundle and FreeBSD tarball:
  share/pdfcraft/models beside bin/. Models::search_dirs now also looks
  in <exe dir>/../share/pdfcraft/models (Models::dirs_beside_exe); a
  test builds every package layout on disk and finds the models in each.
  release.yml and freebsd.yml check the packages contain them.
- The missing-models messages no longer tell end users to run cargo,
  and the 11 catalogs that keyed an old PRINTCRAFT_MODELS wording (or
  the previous one) now key the current English text; ATTRIBUTION
  hashes updated. A test checks the translations match.

The web (wasm) build, which the issue reports, still has no models; this
is the desktop half only.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 18:42:23 -04:00

55 lines
3.3 KiB
YAML

# Flatpak manifest for the single-file bundle attached to every GitHub release
# (pdfcraft-<version>-linux-<arch>.flatpak). Build it with packaging/linux/flatpak-bundle.sh.
#
# It repackages the release's own Linux tarball (pdfcraft-<version>-linux-<arch>.tar.gz, built on
# Ubuntu 22.04 by package.sh) instead of compiling Rust inside flatpak-builder: no network and no
# vendored crate sources during the build, a few seconds instead of 20+ minutes, and byte-for-byte
# the same binaries as the AppImage/deb/rpm. The script unpacks the tarball into `stage/` next to a
# copy of this file. The binaries need glibc >= 2.35 and load X11, Wayland, xkbcommon and Vulkan
# at runtime; the freedesktop runtime has all of them, and the GPU driver comes from its
# org.freedesktop.Platform.GL extension.
#
# ai.storyteller.pdfcraft.yml (same directory) is the from-source manifest for Flathub. Keep
# runtime-version and finish-args identical in both (packaging-lint checks this).
id: ai.storyteller.pdfcraft
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
command: pdfcraft
finish-args:
# Display: Wayland first; X11 only when no Wayland compositor is running.
- --socket=wayland
- --socket=fallback-x11
# X11 shared memory (MIT-SHM). Without it the X11 fallback is slow or fails.
- --share=ipc
# GPU access for the wgpu renderer (Vulkan, or GL as a fallback).
- --device=dri
# Open/Save dialogs go through the file-chooser portal (rfd's xdg-portal backend) and
# drag-and-drop through the document portal, so picked files work anywhere without broad
# filesystem access. Documents and Downloads, where PDFs usually live, are granted so files
# passed by path (the command line, Open Recent, "Save" next to the original) work there.
- --filesystem=xdg-documents
- --filesystem=xdg-download
# Deliberately not granted: network (Flatpak installs update through flatpak, so Help ▸ Check
# for updates reports that GitHub is unreachable; the optional --control channel listens on
# 127.0.0.1 inside the sandbox) and home/host filesystem access. No CUPS socket either: printing
# runs the `lp` command (crates/print), which the freedesktop runtime doesn't ship, so Print
# reports that the spooler is unavailable until it goes through the print portal.
modules:
- name: pdfcraft
buildsystem: simple
build-commands:
- install -Dm755 bin/pdfcraft /app/bin/pdfcraft
- install -Dm755 bin/pdfcraft-cli /app/bin/pdfcraft-cli
- install -Dm644 share/applications/ai.storyteller.pdfcraft.desktop /app/share/applications/ai.storyteller.pdfcraft.desktop
- install -Dm644 share/mime/packages/ai.storyteller.pdfcraft.xml /app/share/mime/packages/ai.storyteller.pdfcraft.xml
# Already has the release's version and date substituted by package.sh.
- install -Dm644 share/metainfo/ai.storyteller.pdfcraft.metainfo.xml /app/share/metainfo/ai.storyteller.pdfcraft.metainfo.xml
# OCR models (with their licences), found at /app/bin/../share/pdfcraft/models.
- mkdir -p /app/share/pdfcraft && cp -R share/pdfcraft/models /app/share/pdfcraft/
# Licences, including the embedded craft-fonts' OFL texts.
- mkdir -p /app/share/icons /app/share/doc && cp -R share/icons/hicolor /app/share/icons/ && cp -R share/doc/pdfcraft /app/share/doc/
sources:
- type: dir
path: stage