JFLib

Packaging -- setup.exe, .deb, AppImage, RPM, Flatpak, MSIX and .dmg#

An app that only uses library widgets can be shipped in every style (STYLES.md). tools/package.py builds one variant per style and lets the user pick the look at install time; the installed program contains only that style. The setup and the .deb are the default; --formats adds AppImage, RPM, Flatpak and MSIX (below, "Other formats").

python tools/package.py Kritzel                          # build/dist/Kritzel_Setup.exe
                                                         # build/dist/kritzel_0.1.0_amd64.deb
python tools/package.py Kritzel --styles winui,classic   # a subset of the styles
python tools/package.py Kritzel --no-deb                 # Windows only (--no-win: .deb only)
python tools/package.py Kritzel --out build/pkg          # another output folder
python tools/package.py Kritzel --impl asm               # legacy: the assembly reference, build/dist_asm
python tools/package.py Kritzel --sign                   # every signature required (below)
python tools/package.py Kritzel --repo build/repo        # also a signed apt repository
python tools/package.py Kritzel --update build/channel   # also a signed update channel (UPDATES.md)
python tools/package.py template --formats all             # every format (--formats appimage,flatpak, ...)

What it does:

  1. Variants: one python build_rs.py app NAME --style S1,S2,.. --profile size --target both --out <out>/rs_size for every style and target (the libraries are built once, both targets side by side, the style variants linked in parallel into <out>/rs_size/<target>/<style>/); each exe is copied to <out>/<App>/<style>/<target>/. A package of PaintCraft (then in this repository) with four styles and both targets took about 7 minutes from scratch on 12 logical CPUs (one style after the other: 19.5), less when the libraries are built already; the eight LTO links then run at once and set the time. For a quick try, --styles winui --no-deb builds one variant. --profile size (the default) builds the UI and platform crates with opt-level z and the compute crates and the app with 2, fat LTO: 14-21 % smaller than the opt-level-3 release of R13, 4-15 % smaller than --release with opt-level 2 (PaintCraft 4-5 %, gallery / Kritzel 14-15 %); codecs, effects and rendering as fast, UI scripts about 4 % slower (rewrite/REPORT.md section 2). package.py --profile o2|release picks another variant.
  2. Windows: builds the setup stub apps/installer (lib/installer, same profile), renders a preview of every variant (--shot at 1100 x 700 DIP, light theme, scaled to 480 x 305) and writes <out>/<App>_Setup.exe = stub + payload + trailer.
  3. Linux: assembles the package tree and runs dpkg-deb in WSL (Ubuntu-24.04).
  4. Modules (jxl-module): the loadable modules of the app (build_rs.py APP_MODULES: codectest's JPEG XL writer jxlenc.dll / jxlenc.so, the same file for every style) are built with the variants and installed next to the exe: one extra-file entry (kind 5) of the setup -- installed into the program folder, listed in install.ini, removed by uninstall.exe -- and /usr/lib/<deb>/ in the .deb.

--impl asm does the same with legacy/build.py and the assembly setup stub (the frozen reference; it needs the assembly toolchain). Both modes produce the same payload format and the same .deb layout.

Inputs#

FileContent
apps/NAME/PACKAGEkey=value lines: display (shown name), version (the app's own MAJOR.MINOR.PATCH: the build checks it and every program of the app reads it as rt::app_version!(), VERSIONING.md), publisher, summary (one line, .deb / .desktop comment), description (one line), generic (.desktop GenericName), categories (.desktop), deb_name, default_win / default_linux (preselected style), styles (the variants, in order); optional filetypes and schemes (the file types and URL schemes the app opens, below), browser=1 (the app is a web browser: schemes= must list http and https; "Web browsers" below); for --update: update_app (the manifest's app id, default the folder name), update_notes, update_expires_days; for the other formats (below): app_id (reverse DNS, default org.jflib.<App>: the library's own demo, test and template apps keep it; the author's apps set org.jfreund.<App>, e.g. Kritzel and BackupCraft; an app of someone else sets a domain of its own), homepage (AppStream; Flathub wants it), license (SPDX, default LicenseRef-proprietary), appimage_update, flatpak_runtime, flatpak_args, flatpak_repo_url (the address of the Flatpak repository an installation updates from), msix_name, msix_publisher, msix_alias (an execution alias, name.exe), appinstaller_url (the folder the .appinstaller and the .msix are published in), appinstaller_hours (App Installer's HoursBetweenUpdateChecks, default 0: every start), language
apps/NAME/PERMISSIONSthe app's permissions (PERMISSIONS.md): the Flatpak finish-args, the MSIX capabilities and StartupTask follow them
apps/NAME/res/app.icoicon resource 1 of the Windows exe (build_rs.py compiles it with llvm-rc and links it: window, taskbar, Explorer, shortcuts)
apps/NAME/res/app_{48,128,256}.pngLinux icons (hicolor theme); the MSIX logos are scaled from them. Missing sizes are scaled down from the largest; an app without any gets a plain placeholder (and a note)
styles/S/INFOline 1: the style's name in the setup / debconf, line 2: a one-line description; further lines name.<lang>= and desc.<lang>= (<lang> a language code such as en, fr) give both in another language, and the setup shows them in the user's (--impl asm: legacy/ASMLIB/styles/S/INFO)

The texts of PACKAGE and the .deb's questions are German; the setup's own texts follow the user's language (below). Example, apps/Kritzel/PACKAGE:

display=Kritzel
version=0.1.0
publisher=JFLib
summary=Zeichnen und Skizzieren mit Ebenen
description=Zeichnen, Skizzieren und kleine Bildkorrekturen: Stift, Pinsel, Formen, Text, Auswahl und Ebenen in einer kompakten Oberfläche, geschrieben in Rust mit JFLib.
generic=Zeichenprogramm
categories=Graphics;2DGraphics;RasterGraphics;
deb_name=kritzel
app_id=org.jfreund.Kritzel
default_win=winui
default_linux=kde
styles=winui classic macos kde

A style of the app's own (cargo jflib package, an app outside this repository): styles=narsil names a crate of its dependencies whose Cargo.toml says

[package.metadata.jflib]
style = "narsil"

and whose INFO file holds the name and the description the setup shows. The app uses that style itself (ui::launch(&DESC, app, &narsil_style::STYLE)), so its variant is built without JFLIB_STYLE; the library's styles in the same list are built with it as before.

Icons: python tools/mkicon.py NAME --glyph EB7E --color D9822B renders a glyph of the icon font on a gradient square in every icon size (16..256 px), cuts anti-aliased rounded corners (tools/pngutil.py) and writes app.ico and the PNGs. The glyph comes from lib/style_assets/assets/icons.bin (Fluent UI System Icons, MIT; the styles that use it ship LICENSE-FluentSystemIcons.txt) and is drawn by tools/refrender.py, so no build is needed. The committed icons are installer --glyph E896 --color 2E9E5B and paint E790 D9822B.

Windows: setup.exe#

apps/installer (Windows only: apps/installer/TARGETS = win) is a normal library app in the winui style; its code is the crate jflib-installer (lib/installer), which cargo jflib package builds the same way for an app outside this repository (README.md of cargo-jflib). The packaged setup is that exe with a payload and a trailer appended.

  • Pages: style (list with the INFO names and descriptions, preview of the selection; only when the payload holds more than one style -- with styles= naming one, the default of cargo jflib package, the setup starts on the options page) -> options (who it is for, the folder, desktop shortcut, start menu entry, "installed apps" entry) -> progress -> done (start the program now; a web browser: make it the default browser; an error page on failures).

  • Who it is for: "just me" (the default): %LOCALAPPDATA%\Programs\<display>, the user's desktop and start menu, HKCU, no administrator rights. "All users of this computer": C:\Program Files\<display> (FOLDERID_ProgramFiles), the common desktop and start menu, HKLM for the uninstall entry, the file types and a browser's registration, scope=machine in install.ini. Without administrator rights the setup starts itself again with them (ShellExecuteEx "runas": the UAC prompt) as --quiet --all-users --dir ... --style ... --log <temp file> with the choices made, waits, and shows the done page, or the error from that log (a refused prompt: an error page whose "Zurück" leads back to the options). The program is started, and Settings opened, by the setup without the rights, in the user's session. The uninstaller of such an installation does the same. When the app is installed in Program Files and not for the user, running the setup again preselects all users.

  • Languages: the texts (lib/installer/setup.tsv, an i18n::Catalog) are German, English, French, Spanish, Italian, Dutch, Polish, Arabic and Hebrew, picked from the user's languages (--lang CODE chooses), otherwise English; the manifest's label_<style>.<lang> and desc_<style>.<lang> (from INFO) name and describe the styles in that language. Script runs are German, as every library app's.

  • Installs <app>.exe (the chosen variant), uninstall.exe (the setup without its payload), install.ini (what was created), .lnk files through COM IShellLinkW, and Software\Microsoft\Windows\CurrentVersion\Uninstall\<app> below HKCU or HKLM (DisplayName, DisplayIcon, UninstallString, QuietUninstallString, ...). ole32 / shell32 / advapi32 are loaded with LoadLibraryA inside plat::inst (the only place of the shell calls).

  • The app's AppUserModelID: the manifest carries PACKAGE's app_id; the shortcuts get it as System.AppUserModel.ID, the ProgIDs as AppUserModelID, and install.ini as app_id= -- the installed program finds that line beside itself and runs under the id (GUIDE.md section 21). The user's taskbar pins of the program without an id (made with an earlier version) get it too (User Pinned; test mode: DIR\Pinned). A payload of an older package.py has no app_id: then nothing changes.

  • uninstall.exe --uninstall removes everything listed in install.ini (files=: the extra files, one line of any length; the folders below the program folder that held them go too, deepest first, when nothing else is left in them); a hidden cmd deletes uninstall.exe and the folder once the uninstaller has ended: it tries once a second for up to five minutes, since Windows deletes no running program and the uninstaller's window stays open on its last page. (An older uninstaller tried once after two seconds; an older setup cut files= at 4096 bytes and left the rest behind -- installing over it with a newer setup writes the whole list.)

  • Running the setup again installs another style over the old one (the app's settings stay).

  • Options (they preset the pages): --dir PATH, --style ID, --all-users / --current-user, --no-desktop, --no-start-menu, --no-uninstall-entry, --launch, --log FILE (what the setup did, a line each; error: before a failure), --lang CODE.

  • Without questions (package managers, deployment tools, scripts): --quiet installs with those options and no window; uninstall.exe --uninstall --quiet removes, the uninstall entry carries it as QuietUninstallString. Exit codes: 0 done, 1 failed (the reason on standard output, or the console the setup was started from, and in the log), 2 a wrong command line (an unknown option, a missing value, a style the setup does not hold), 740 (ERROR_ELEVATION_REQUIRED) for all users without administrator rights. A web browser never opens Settings in this mode.

  • File types and URL schemes (PACKAGE filetypes= / schemes=, carried in the manifest; lib/installer/assoc.rs): for each type a ProgID <app>.<ext> under HKCU\Software\Classes (description, DefaultIcon, shell\open\command = "<exe>" "%1") and the app in .<ext>\OpenWithProgids ("Open with"). An own type also becomes the default of its extensions (.<ext> default value and Content Type). A scheme gets HKCU\Software\Classes\<scheme> (URL:<display>, URL Protocol, DefaultIcon, the open command "<exe>" -- "%1": the URL after -- reaches the program as one argument, and a quote in it adds no options). SHChangeNotify tells Explorer. install.ini assoc= lists what was added (T: key trees, V: values), and uninstall.exe removes exactly that. In test mode the values go to <ASMINST_SHELL_DIR>\assoc.txt (subkey|name=value lines).

  • A web browser (browser=1, "Web browsers" below): http and https get no keys of their own; the setup writes the ProgID <app>URL, HKCU\Software\Clients\StartMenuInternet\<app> with its Capabilities and the value <app> in HKCU\Software\RegisteredApplications, and uninstall.exe removes them with the rest (install.ini assoc=). The options page offers "Als Standardbrowser festlegen" on the done page (in English "Make <App> my default browser"), checked as in Firefox's setup: "Fertigstellen" then opens Settings at the app's page of the default apps (ms-settings:defaultapps?registeredAppUser=<app>, through plat::assoc::browser_request: the same page as the app's plat::default_browser_request()), after starting the program when that is chosen too. Windows lets no program take the default itself; the user picks there. Test mode and script runs never open Settings: they print setup_default_browser: ms-settings:...; --quiet skips it. An installation for all users registers the browser below HKLM, which plat::assoc::browser_request accepts as well.

  • Test mode: with ASMINST_SHELL_DIR=DIR the desktop, the start menu and the taskbar pins are DIR\Desktop, DIR\Programs and DIR\Pinned, and the registry values go to DIR\registry.txt -- for all users the same below DIR\machine -- so a test never touches the user's shell or registry. ASMINST_ADMIN=1 / 0 stands for the administrator rights; the setup then starts itself again without a UAC prompt (with ASMINST_ADMIN=1), and ASMINST_UAC=no acts as a refused prompt. Always run the setup with --script or --quiet (and --dir into a test folder):

    set ASMINST_SHELL_DIR=%CD%\build\dist\test\shell
    build\dist\Kritzel_Setup.exe --script build\dist\inst.uis --dir %CD%\build\dist\test\inst
    build\dist\test\inst\uninstall.exe --uninstall --script build\dist\un.uis

    with, for example,

    # inst.uis: the preselected style, default options (start after installing is off); a setup
    # of one style has no style page and starts at "Installieren"
    click "Weiter"
    click "Installieren"
    wait 500
    expect "Fertigstellen" exists
    # un.uis
    click "Deinstallieren"
    wait 500
    expect "Schließen" exists

    apps/installer/tests/nopayload.uis checks the bare stub (no payload: the error page); it runs in build_rs.py test and in parity. python tools/setup_check.py builds setups from the stub and a payload of its own and runs them in test mode -- on Windows directly, elsewhere under Wine (its own prefix in build/setup_check/wine): the pages in all nine languages, a payload of one style, the quiet mode with its exit codes and log, all users with and without the rights (the setup started again, a refused prompt), the uninstallers. Under Wine a running program can be deleted, so there the uninstaller's wait for its own end is not tested; Wine has no font for Arabic and Hebrew (--shots DIR brings DejaVu Sans along). Build the stub first: python build_rs.py app installer --target win (on Linux lld-link must be on PATH: LLVM's lld, or a link of that name to the toolchain's rust-lld).

Payload layout (written by tools/package.py and cargo jflib package, read by lib/installer/payload.rs; little endian, offsets relative to the payload start):

PartLayout
header"AIPK", u32 entry count (at most 65536; a setup of jflib 0.1.0 reads at most 256)
entry (128 bytes each)u32 kind, u32 stored size, u32 unpacked size, u32 flags (1 = zlib), u64 offset, u64 0, name[48], label[48] (UTF-8, NUL-padded)
kinds1 manifest (key=value lines: app, display, version, publisher, default, desc_<style>, label_<style>.<lang> and desc_<style>.<lang> (the INFO translations), filetypes, schemes, browser, app_id), 2 a style variant (the exe; name = style id, label = INFO name), 3 its preview PNG, 5 an extra file (name = its path in the program folder; e.g. codectest's jxlenc.dll or licenses/...)
trailer"ASMINST1", u64 stub size, u64 payload size (the last 24 bytes of the file; in a signed setup the last 24 bytes before the Authenticode certificate table and its padding to 8 bytes)

A signed setup (below) keeps this layout: signtool appends the certificate table after the trailer and points the PE security directory at it. The installer looks for the trailer before that table, and writes uninstall.exe (the stub) with the security directory cleared, since the setup's signature covers the payload too.

Linux: .deb#

Built in WSL (dpkg-deb --root-owner-group -Zxz, inside the Linux file system for the permissions). Every variant goes to /usr/lib/<deb>/<App>-<style>, the app's modules next to them (/usr/lib/<deb>/jxlenc.so: the program looks next to its real path); debconf asks for the look (<deb>/style, a select question), postinst registers every variant with update-alternatives and points /usr/bin/<deb> at the chosen one. Change it later with sudo dpkg-reconfigure <deb>. Also installed: /usr/share/applications/<deb>.desktop and the hicolor icons. Text files are written with LF line ends (maintainer scripts). With filetypes= / schemes= the .desktop file lists the MIME types and x-scheme-handler/<scheme> in MimeType=, and Exec passes %U (schemes) or %F. own types get a shared-mime-info package /usr/share/mime/packages/<deb>.xml (glob patterns, description), and postinst runs update-mime-database. A web browser's (browser=1) Categories get Network;WebBrowser;.

# an image editor's PACKAGE
filetypes=png|image/png|PNG-Bild; jpg,jpeg|image/jpeg|JPEG-Bild; pdn|image/x-paint.net|Paint.NET-Bild
# an app's own format and its links (myapp://...):
filetypes=myd|application/x-mydoc|MyApp-Dokument|own
schemes=myapp

The program receives a file or a URL as a command-line argument (for %U Linux file managers pass local files as file:// URIs: Request::paths() and the fs.user grant turn them into paths, plat::assoc::file_uri_path does it for an app's own parsing). With AF_SINGLE_INSTANCE (GUIDE.md section 7), a running instance receives it as UIC_OPEN instead.

Without a package (a developer build, a portable copy): every app built with ui::main! registers itself with --register (--register-replace also takes defaults of other programs, --unregister removes exactly that again; GUIDE.md section 21). build_rs.py builds display, app_id, categories, filetypes and schemes of PACKAGE into the program (JFGUI_PACKAGE, checked like here). Windows writes the setup's keys below HKCU\Software\Classes; Linux ~/.local/share/applications/<app_id>.desktop, the own types in ~/.local/share/mime/packages/<app_id>.xml and the defaults in ~/.config/mimeapps.list (no xdg-mime; update-mime-database when installed). An installed .deb and a registration live side by side (<deb>.desktop and <app_id>.desktop); on Windows a setup's ProgID with another command counts as another program's (asked, saved and put back).

sudo apt install ./build/dist/kritzel_0.1.0_amd64.deb
sudo dpkg-reconfigure kritzel             # pick another style

Tests never install the package on the real WSL system: check it with dpkg-deb --info / --contents and extract it with dpkg-deb -x into a test folder.

Signing#

tools/package.py signs what it can and reports the rest: every run ends with [sign] signiert: ... and one [sign] nicht signiert: <what is missing> line per gap. --sign turns a gap into an error (a release build). The keys come from the environment or from files outside the repository; *.pfx, *.p12, *.jks, *.keystore and *.updkey are ignored by git. The code is in tools/codesign.py.

WhatHowConfigurationWithout it
Windows (Authenticode)signtool sign /fd SHA256 for every program variant, its modules and further programs (before they go into the payload: the installed files are signed), then the finished <App>_Setup.exejfgui_SIGN_PFX + jfgui_SIGN_PFX_PASS (a .pfx), or jfgui_SIGN_THUMBPRINT (a certificate in the user's store, also tokens / HSM providers); jfgui_SIGN_TIMESTAMP (an RFC 3161 server, recommended); jfgui_SIGNTOOL (default: PATH, else the newest Windows Kit)"signtool.exe nicht gefunden" / "kein Zertifikat (...)"
Linux (apt repository)--repo DIR: a flat repository (pool/, Packages(.gz), Release by apt-ftparchive), InRelease and Release.gpg by gpg, the public key as repo.gpgjfgui_GPG_KEY (key id or fingerprint), jfgui_GPG_HOME (GnuPG home in Linux / WSL), jfgui_GPG_PASSPHRASE (batch signing)the repository is written unsigned, "jfgui_GPG_KEY setzen"
Updates (UPDATES.md)--update DIR: update.json + update.json.sig (Ed25519) per style--update-key FILE, jfgui_UPDATE_KEY_FILE or jfgui_UPDATE_KEY (python tools/update_manifest.py keygen FILE)no channel, "kein Signierschlüssel"
MSIXsigntool sign /fd SHA256 of the finished .msix (AppxSignature.p7x); the certificate's subject must be exactly the manifest's Publisher (signtool error 0x8007000B otherwise; package.py says so)as Authenticode; the Publisher from jfgui_MSIX_PUBLISHER or PACKAGE msix_publisheran unsigned package: fine for the Store (it signs), not installable with Add-AppxPackage
AppImagethe type-2 signature as appimagetool --sign writes it: an armored detached GPG signature of the file's SHA-256 (the two sections taken as zeros, 64 hex digits) in .sha256_sig, the armored public key in .sig_key (gpg in Linux / WSL)jfgui_GPG_KEY, jfgui_GPG_HOME, jfgui_GPG_PASSPHRASE (as the apt repository)unsigned, "jfgui_GPG_KEY setzen"
Flatpakthe commits and the summary of the repository flatpak/repo (flatpak-builder / build-update-repo --gpg-sign) and the bundle (build-bundle --gpg-sign), which carries the public key (--gpg-keys) and the repository's address (--repo-url, PACKAGE flatpak_repo_url=); the key as flatpak/<app id>.gpg and a <app id>.flatpakrepo beside itjfgui_GPG_KEY, jfgui_GPG_HOME (flatpak signs through gpg-agent: a key with a passphrase must be unlocked there)unsigned repository and bundle
RPMnot signed: rpmsign (and rpmbuild) are missing in the test system----
Androidbuild_rs.py app NAME --target android --release signs with the release key (apksigner reads the passwords from the environment)jfgui_ANDROID_KEYSTORE, jfgui_ANDROID_KEYSTORE_PASS, jfgui_ANDROID_KEY_ALIAS, optional jfgui_ANDROID_KEY_PASSthe build fails and names the variables; jfgui_ANDROID_DEBUG_SIGN=1 signs a release build with the debug key (tests only). Debug builds keep the local debug key. Only builds under the debug key are debuggable (aapt2 --debug-mode: the self-tests' jfgui_* extras, run-as); a manifest that sets android:debuggable stops a release-key build

A user adds the signed repository with:

sudo curl -o /usr/share/keyrings/kritzel.gpg https://example.org/repo/repo.gpg
echo "deb [signed-by=/usr/share/keyrings/kritzel.gpg] https://example.org/repo ./" | sudo tee /etc/apt/sources.list.d/kritzel.list

apt checks the repository's signature (InRelease), and through it the SHA-256 of every package. A signature inside the .deb itself (debsigs) is not made: apt does not check it.

What could not be tested here, and how it was covered instead (python tools/sign_check.py):

  • There is no real code-signing certificate. sign_check.py makes a self-signed one for the run with openssl in WSL (never installed into a store), signs a setup with codesign.Signer (real signtool), installs and uninstalls it, and checks that signtool verify reads the signature (and only refuses the untrusted test root). A setup with the certificate-table layout but without signtool is installed as well.
  • The apt repository is signed with a throwaway GnuPG key in /tmp; gpgv accepts InRelease and Release.gpg with repo.gpg and refuses a changed Release. An apt-get update against it was not run (no root in the test system).
  • Android: a keystore made with keytool for the run; without the variables --release fails with their names. sign_check.py --android builds androidGallery with --release and checks with apksigner verify --print-certs that the APK carries the test certificate. Uploading to Google Play (an AAB, Play App Signing) is not covered ("Android App Bundle" below).
  • Time stamps (jfgui_SIGN_TIMESTAMP) need a time-stamp server on the internet and were not tested.

Other formats: AppImage, RPM, Flatpak, MSIX#

--formats setup,deb,appimage,rpm,flatpak,msix (or all; default setup,deb) picks the packages; --no-win / --no-deb drop every Windows / Linux format. The code is in tools/pkg_linux.py, tools/pkg_msix.py and tools/pkgmeta.py (PACKAGE, PERMISSIONS, .desktop, AppStream, icons); the Linux tools run in Linux or WSL (tools/linux_task.py). A missing tool never stops the run: that package is skipped, and the run ends with [formats] gebaut: ..., one [formats] nicht gebaut: <format>: <what is missing, what was written instead> line per gap and [formats] Hinweis ... lines. Nothing is downloaded or installed.

FormatOutput (in --out, default build/dist)StylesTool (here)
AppImage<App>-<ver>-<style>-x86_64.AppImageone file per stylemksquashfs (squashfs-tools; present), or appimagetool (missing)
RPMrpm/SPECS/<deb>.spec, rpm/SOURCES/<deb>-<ver>-root.tar.gz, <deb>-<ver>-1.x86_64.rpmall, update-alternativesrpmbuild (missing: only the .spec and its tarball)
Flatpakflatpak/<app id>.json + flatpak/files/, <app id>.flatpak (a bundle), the repository flatpak/repo (with a key also flatpak/<app id>.gpg, .flatpakrepo)default_linuxflatpak-builder, the runtime and SDK (present: Platform / Sdk 26.08)
MSIX<App>-<ver>-x64.msix (folder: <App>/msix/<style>/), <App>.appinstaller (with appinstaller_url=)default_winMakeAppx.exe of the Windows SDK (present), signtool

What each format can and cannot do, compared with the setup and the .deb:

setup / .debAppImageRPMFlatpakMSIX
choice of styleat install timeone file per styleupdate-alternatives --configdefault_linux onlydefault_win only
file types, URL schemesregisteredin the .desktop file; registered by an integration tool (appimaged, AppImageLauncher) or the app's --register (the .desktop file then starts $APPIMAGE)registered (.desktop, shared-mime-info; the system's file triggers)exported .desktop and MIME package; files arrive through the document portal as file:// URIs (--file-forwarding), which the app takes as pathswindows.fileTypeAssociation, windows.protocol; an own type is offered, never made the default (Windows asks the user); each extension once
autostart (plat::autostart_set)Run key / XDG autostartXDG autostart with $APPIMAGEXDG autostartBackground portalthe manifest's StartupTask, switched through WinRT (HKCU is virtualized; arguments are not passed)
lib/update (UPDATES.md "Packages")exe, bundle, packagethe channel's appimage entry replaces the .AppImage file (trial, rollback; the GPG signature must follow the running file's key); also the update information for AppImageUpdatethe channel lists only the .debthrough the Flatpak portal (check, Update, Spawn of the new version) from the bundle's repository; without the portal "managed by Flatpak"Check::Managed: App Installer (.appinstaller, at the next start) or the Store
further programs (BINS)next to the program, linked into /usr/bininside, AppRun starts the main program/usr/bin linksin /app/lib/<deb>/, not in PATHnext to the program
signingAuthenticode, apt repositoryGPG in .sha256_sig / .sig_key (appimagetool's layout)not signed (rpmsign missing)GPG: repository and bundlesigntool (below)

Web browsers (browser=1)#

An app that shows web pages (BrowserGUI's Narsil) declares itself as one:

schemes=http https
filetypes=html,htm|text/html|HTML-Dokument; svg|image/svg+xml|SVG-Bild; pdf|application/pdf|PDF-Dokument
browser=1

The packages register it as a web browser; which browser opens links stays the user's choice, and the app asks for it at run time with plat::default_browser_status() and plat::default_browser_request() (GUIDE.md section 21). The Windows setup also asks once, at its end (its option "Als Standardbrowser festlegen", above); the .deb, RPM, AppImage, Flatpak and .dmg have no pages of their own (the system's package tools install them), so on Linux and macOS only the app offers it.

registrationthe user's choice
setup, --register (Windows)ProgID <app>URL (URL Protocol, the open command, Application with name and icon, the AppUserModelID); Software\Clients\StartMenuInternet\<app> (name, icon, the command, Capabilities: ApplicationName / Description / Icon, StartMenu, URLAssociations http / https -> <app>URL, FileAssociations .ext -> the file types' ProgIDs <app>.<ext>); Software\RegisteredApplications\<app>; all below HKCU, removed by uninstall.exe / --unregister. http and https get no Software\Classes\<scheme> key (it would stand in for the system's handler)Windows 10 and later let no program take the default itself: the request opens Settings at the app's page of the default apps (ms-settings:defaultapps?registeredAppUser=<app>); the status reads UserChoiceLatest / UserChoice of http and https
.deb, RPM, AppImage, Flatpak, --register (Linux)the .desktop file with Categories=...;Network;WebBrowser;, x-scheme-handler/http / https and the file types in MimeType=, Exec=... %Uthe request writes the app's .desktop id as the user's default of x-scheme-handler/http, https and text/html in ~/.config/mimeapps.list (and BrowserApplication in KDE's kdeglobals), as xdg-settings set default-web-browser does; the status reads the defaults from the mimeapps.list files. In a Flatpak: Unknown, the request is Unavailable (the host's settings are out of sight)
.dmg (macOS)Info.plist: http and https as a URL type of their own ("Web site URL", role Viewer); the file types as viewers with their system types (public.html and public.xhtml with LSHandlerRank Default, public.svg-image, com.adobe.pdf Alternate)the request sets Launch Services' handler of http and https (LSSetDefaultHandlerForURLScheme): macOS asks the user itself; the status asks Launch Services
MSIXrefused: Windows reserves http and https for packages (take the setup)--

macOS: .dmg#

--formats dmg (on a Mac only, alone: tools/package.py APP --formats dmg, cargo jflib package --formats dmg) builds the program per style for aarch64-apple-darwin and x86_64-apple-darwin and joins both into one program for every Mac (a universal program, lipo; INTEL_MAC.md), then puts NAME.app (Info.plist from PACKAGE, the icon, the entitlements of PERMISSIONS: APPLE.md AP7c; gamepad adds none, Apple documents no App Sandbox entitlement for GameController) on a compressed disk image beside a link to /Applications: <App>-<ver>-<style>-universal.dmg (one style: <App>-<ver>-universal.dmg). The Intel part needs Rust's target (rustup target add x86_64-apple-darwin); the program is about twice as large, fonts and images are in it once. all leaves it out (it names the formats of Windows and Linux). The signature is ad hoc unless jfgui_MAC_IDENTITY names a certificate of the keychain ("Developer ID Application: NAME (TEAM)"): then the bundle is signed with it, the hardened runtime and a secure time stamp, and the image is signed too. An ad-hoc signed app downloaded from the internet does not start on another Mac without the user's consent (Gatekeeper); that needs Developer ID and notarization. jfgui_MAC_NOTARY names a notarytool profile in the keychain: then the bundle and, after it, the image go to Apple's notary service, and both get their ticket stapled (a copy dragged out of the image starts offline too). With --update the channel gets the bundle (kind app) and the image (kind package), the same two files for macos-aarch64 and macos-x86_64, UPDATES.md "macOS app bundles". Signature and notarization cover both parts of the program.

Setting it up once, on the Mac (a membership of the Apple Developer Program; APPLE.md AP8c):

  1. Xcode → Settings → Accounts → the team (not "Personal Team") → Manage Certificates → "+" → Developer ID Application. (When Xcode refuses with "only the Account Holder": sign out and in again, or request the certificate on developer.apple.com with a signing request of Keychain Access.)
  2. An app-specific password on account.apple.com (Sign-In and Security), then in Terminal: xcrun notarytool store-credentials PROFILE --apple-id APPLE_ID --team-id TEAM (it asks for the password; an App Store Connect API key works too: --key, --key-id, --issuer).
  3. export jfgui_MAC_IDENTITY="Developer ID Application: NAME (TEAM)" jfgui_MAC_NOTARY=PROFILE, then tools/package.py APP --formats dmg.

The keychain is locked in an SSH session: tools/package.py (tools/apple.py keychain_run) runs codesign with the certificate and notarytool in the logged-in session of the Mac then; cargo jflib expects the session itself. Each notarization takes a few minutes.

Signing belongs to the app's own repository, not to the library: JFLib's test apps stay ad hoc (the Apple workflow of JFLib signs nothing). An app's workflow on GitHub's Mac runners imports the certificate into a keychain of its run, stores the notary profile there and packs:

- name: The certificate and the notary profile in a keychain of this run
  env:
    P12: ${{ secrets.MAC_DEVID_P12 }}            # Keychain Access: export the Developer ID Application
    P12_PASSWORD: ${{ secrets.MAC_DEVID_P12_PASSWORD }}   # certificate as .p12, then base64 -i it
    NOTARY_APPLE_ID: ${{ secrets.MAC_NOTARY_APPLE_ID }}
    NOTARY_PASSWORD: ${{ secrets.MAC_NOTARY_PASSWORD }}   # an app-specific password for the CI
    TEAM_ID: ${{ secrets.MAC_TEAM_ID }}
  run: |
    kc="$RUNNER_TEMP/signing.keychain-db"; kcpw=$(openssl rand -hex 24)
    security create-keychain -p "$kcpw" "$kc"; security set-keychain-settings -lut 21600 "$kc"
    security unlock-keychain -p "$kcpw" "$kc"
    echo "$P12" | base64 --decode > "$RUNNER_TEMP/devid.p12"
    security import "$RUNNER_TEMP/devid.p12" -k "$kc" -P "$P12_PASSWORD" -T /usr/bin/codesign; rm "$RUNNER_TEMP/devid.p12"
    security set-key-partition-list -S apple-tool:,apple: -s -k "$kcpw" "$kc" > /dev/null
    security list-keychains -d user -s "$kc" $(security list-keychains -d user | tr -d '"')
    security default-keychain -s "$kc"
    xcrun notarytool store-credentials ci --apple-id "$NOTARY_APPLE_ID" --team-id "$TEAM_ID" --password "$NOTARY_PASSWORD" --keychain "$kc"
    echo "jfgui_MAC_IDENTITY=$(security find-identity -v -p codesigning "$kc" | sed -n 's/.*"\(Developer ID Application: .*\)"$/\1/p' | head -1)" >> "$GITHUB_ENV"
    echo "jfgui_MAC_NOTARY=ci" >> "$GITHUB_ENV"
- run: cargo jflib package --formats dmg

Keep the secrets in an environment of that repository limited to its main branch, and delete the keychain at the end of the job (security delete-keychain, also when a step failed).

AppImage#

The AppDir: AppRun (a link to usr/lib/<deb>/<deb>, the program of the style), the <app id>.desktop file and <app id>.png at the top, .DirIcon, usr/bin/<deb>, the program's modules, further programs and notices in usr/lib/<deb>/ and usr/share/doc/<deb>/, the hicolor icons, usr/share/metainfo/<app id>.appdata.xml (AppStream) and the MIME package of own types. Built in the Linux file system (modes: 0755 for programs and folders, 0644 else), packed by mksquashfs -comp zstd -all-root (reproducible with SOURCE_DATE_EPOCH) and put behind the runtime. With appimagetool in PATH that tool makes the image instead, with the same runtime (--runtime-file); that path is not tested here. A program with a UI uses the glibc and the Vulkan driver of the system it runs on (an AppImage brings neither, a driver has to match the system's kernel anyway); tools/package.py APP --static makes one for systems without glibc, without the GPU.

The runtime is apps/appimagert (its code the crate jflib-appimagert, lib/appimagert, which cargo jflib package builds for an app outside this repository), a static Linux program of JFLib without libc (about 200 KB, built with --profile size); package.py makes it an AppImage type 2 runtime: the magic AI\x02 at byte 8 of the ELF header and a section .upd_info of 1024 bytes (PACKAGE appimage_update=, e.g. zsync|https://example.org/App-latest-x86_64.AppImage.zsync), added to the file by pkg_linux.runtime_image. The SquashFS image starts where the ELF data ends. The upstream runtime would mount the image with FUSE, and is downloaded by appimagetool; this one reads the image itself (sqfs.rs: SquashFS 4.0, zstd or lz4, fragments, sparse blocks, extended inodes) and needs no FUSE:

  • The first start extracts the image into $XDG_CACHE_HOME/appimage-run/<name>-<xxh64 of the image> (a part folder, renamed into place: parallel starts and broken runs never leave a half folder in use); later starts check the hash (a quick read of the file) and reuse the folder. Folders of other versions of the same file name that were not used for 7 days are removed. The first start of a large app therefore takes as long as unpacking it.
  • Then AppRun replaces the runtime (plat::process::exec, execve) with APPIMAGE, APPDIR, ARGV0 and OWD set. A relative AppRun link is followed first, so the program's argv[0] is its own name: JFLib uses it as the window class and the Wayland app id, and the .desktop files carry it as StartupWMClass (the desktop matches the window to the entry).
  • Options: --appimage-extract [PATTERN] (into ./squashfs-root), --appimage-extract-and-run, --appimage-offset, --appimage-updateinformation, --appimage-signature (the armored signature of .sha256_sig), --appimage-portable-home / -config (NAME.AppImage.home / .config: HOME / XDG_CONFIG_HOME of the app), --appimage-version, --appimage-help; --appimage-mount is refused. TARGET_APPIMAGE=FILE uses another file's image.
  • --appimage-runtime FILE or jfgui_APPIMAGE_RUNTIME packs another runtime (for example the upstream runtime-x86_64, which needs FUSE on the user's machine).

Signature. pkg_linux.runtime_image gives the runtime the sections of the upstream type-2 runtime for it: .sha256_sig (1024 bytes) and .sig_key (8192 bytes), zero. With jfgui_GPG_KEY (jfgui_GPG_HOME, jfgui_GPG_PASSPHRASE: as for the apt repository) the finished AppImage is signed as appimagetool --sign signs: the SHA-256 of the whole file with both sections read as zeros, as 64 lower-case hex digits, is signed by gpg in Linux / WSL (linux_task.py gpgsign: detached, armored), and the signature and the armored public key are written NUL-padded into the sections (pkg_linux.sign_appimage). AppImageUpdate's validate and lib/update check it (UPDATES.md "Packages": an update must be signed with a key of the running AppImage's block); gpgv does too (tools/pkg_check.py). Keep the key: a new key makes installed AppImages refuse the updates.

RPM#

A binary package from the prebuilt files: the .spec takes the tree as Source0 (<deb>-<ver>-root.tar.gz, written by Python with root as owner and the modes of the .deb) and lists every file in %files; the package owns /usr/lib/<deb> and /usr/share/doc/<deb>. The tree is the .deb's, except that systemd units go to /usr/lib/systemd/system (/lib is a link on RPM systems). There is no install-time question: every style is an alternative of /usr/bin/<deb> (default_linux with priority 50), sudo update-alternatives --config <deb> switches; %preun removes them (and the BINS links, the units) on removal, not on an upgrade. Desktop database, icon cache and MIME database are left to the file triggers of Fedora / openSUSE. AutoReqProv: no, no debuginfo, no strip, ExclusiveArch: x86_64. A program with a UI links against glibc and nothing else (GPU.md "Linux"), so the spec says Requires: glibc and Recommends: vulkan-loader, mesa-vulkan-drivers, the .deb Depends: libc6 and Recommends: libvulkan1, mesa-vulkan-drivers. Command-line programs are static and need nothing, and tools/package.py APP --static packages a program with a UI the same way (no GPU, for systems without glibc). The Version takes ~ for - (1.2.3-beta -> 1.2.3~beta).

Not tested here: rpmbuild is not installed in the test system (Ubuntu, no root), so only the .spec and its tarball are written, and no package is signed (rpmsign --addsign with a GPG key would follow rpmbuild; rpmsign is missing as well); tools/pkg_check.py compares %files with the tarball and runs sh -n on the scriptlets. With rpmbuild (dnf install rpm-build): rpmbuild -bb --define "_topdir $PWD" SPECS/<deb>.spec in build/dist/rpm, or simply run package.py --formats rpm there.

Flatpak#

The manifest flatpak/<app id>.json (flatpak-builder, JSON) builds one module from the prebuilt files in flatpak/files/ (a dir source; the programs installed with install -Dm755, /app/bin/<deb> a link to /app/lib/<deb>/<deb>, share/ copied): the program of default_linux, its modules, further programs and notices, <app id>.desktop (with StartupWMClass), the icons, <app id>.metainfo.xml and the MIME package. Runtime org.freedesktop.Platform//26.08 (PACKAGE flatpak_runtime=), SDK to match; a static program uses nothing of it, one with a UI its glibc and Vulkan driver, and gets --device=dri. flatpak-builder exports the build into a temporary repository and flatpak build-bundle writes <app id>.flatpak (flatpak install --user <file> installs it). The export goes into the repository flatpak/repo, which stays: every run adds a commit (copied into the Linux file system for the build and back), so publishing it (or syncing it to the server) offers the new version to every installation. Flathub builds from sources and would need a manifest that builds JFLib itself; this one is for own repositories and bundles.

finish-args from PERMISSIONS (pkg_linux.finish_args): always --share=ipc --socket=wayland --socket=fallback-x11; then

PERMISSIONSfinish-args
fs.read P / fs.write P--filesystem=LOCATION:ro / --filesystem=LOCATION: $HOME/x/** -> ~/x, $DOCUMENTS -> xdg-documents, $PICTURES, $DESKTOP, $DOWNLOADS, $MUSIC, $VIDEOS likewise, /abs/dir/*.x -> /abs/dir (the path up to the first pattern), ** -> host; $CONFIG, $APPCONFIG, $APPDATA, $APPCACHE, $APPLOG, $TEMP, $EXE, $FONTS need none (inside the sandbox); Windows paths are left out
plugins Pas fs.read
net.connect, net.listen--share=network
secrets--talk-name=org.freedesktop.secrets (the Secret Service; plat does not use the Secret portal)
audio.output--socket=pulseaudio (plat::audio speaks the PulseAudio protocol, also to pipewire-pulse; the socket allows recording too, so only apps that play sound list the right; noted)
recent--filesystem=xdg-data/recently-used.xbel (the host's list of recent files for plat::recent_add / ui.recent_add; it lists every program's recent files; noted)
gamepad--device=input (the evdev nodes below /dev/input for plat::pad_watch / ui.gamepads; it shows the nodes of every input device, keyboards too, and the app opens what the host lets the user open; noted). Flatpak 1.15.6 and newer: an older one refuses to build it ("Unknown device type input"), so the bundle is skipped and only the manifest written when the Flatpak in WSL / Linux is older (flatpak_version of the probe; WSL's Ubuntu 24.04 has 1.14.6); an installed app with it runs on an older Flatpak without /dev/input (no pads)
fs.user, url, print, autostartnone: the file dialog, OpenURI, Print and Background portals; files of "Open with" come through the document portal
location, sensorsnone yet, noted: plat has no Linux version (later the location portal, no hole; --system-talk-name=net.hadess.SensorProxy for iio-sensor-proxy)
processnone: programs outside the sandbox are not reachable (flatpak-spawn --host would need --talk-name=org.freedesktop.Flatpak, a full escape: not granted; noted)
no PERMISSIONS--share=network --filesystem=host --talk-name=org.freedesktop.secrets --socket=pulseaudio (the app may do everything; noted)

flatpak_args= adds more, for example --talk-name=org.kde.StatusNotifierWatcher for the tray (plat::tray) or --talk-name=org.freedesktop.Notifications; game pads come with the line gamepad of PERMISSIONS, not with flatpak_args= (an app without PERMISSIONS that reads pads adds --device=input here). Without recent in PERMISSIONS the list of recent files stays in the sandbox's own data folder. The exported .desktop file's Exec gets flatpak's file forwarding (@@u %U @@): opened files come as file:///run/user/<uid>/doc/... URIs that plat turns into paths and grants (fs.user). With fs.user every document of the portal's mount stays readable and writable without a new grant, so a file the user chose in the portal's file dialog (a lasting document) opens again from ui.recent_add's list after a restart; files of "Open with" are documents for the session only (flatpak forwards them so) and are gone after it (VFS.md, "Flatpak"). Signing and updates. With jfgui_GPG_KEY the commits and the repository's summary are signed (flatpak-builder --gpg-sign, flatpak build-update-repo --gpg-sign), and so is the bundle (build-bundle --gpg-sign), which also carries the public key (--gpg-keys) and, with PACKAGE flatpak_repo_url= (the address the repository is published at), the remote: flatpak install --user <bundle> then makes a GPG-checked remote <name>-origin from which flatpak update and the app itself (lib/update through the Flatpak portal, UPDATES.md "Packages") take new versions. Beside the repository package.py writes the public key (<app id>.gpg) and <app id>.flatpakrepo (flatpak remote-add --user NAME <app id>.flatpakrepo). Without flatpak_repo_url the bundle names no remote (noted): an installation from it gets no updates. flatpak signs through gpg-agent, so a key with a passphrase must be unlocked there (jfgui_GPG_PASSPHRASE is not handed to flatpak).

--register is Unavailable inside the sandbox (the export registers). Not covered: files dropped from other programs arrive as paths the sandbox may not see (no portal file transfer), and the library's own file dialog (used without a portal) sees only the sandbox.

MSIX#

AppxManifest.xml (pkg_msix.appx_manifest) for a full-trust desktop app (Windows.FullTrustApplication, runFullTrust): the identity (msix_name, default the app id with - for _; Publisher = the signing certificate's subject: jfgui_MSIX_PUBLISHER, PACKAGE msix_publisher, default CN=<publisher>; the version as a.b.c.0), display name, description, the logos Assets/{StoreLogo,Square44x44Logo,Square150x150Logo,Wide310x150Logo}.png (scaled from the app's icons), Resource Language (PACKAGE language, default de-DE); from PACKAGE the windows.fileTypeAssociation per file type and a windows.protocol per URL scheme (Windows' reserved schemes and an extension in two file types are refused; reserved types like .exe, .bat, .lnk and their content types MakeAppx names itself); a full-trust app gets the file or URL as its command-line argument; a desktop:StartupTask (Enabled="false") when PERMISSIONS allows autostart (or there is no PERMISSIONS); capabilities: internetClient for net.connect, internetClientServer and privateNetworkClientServer for net.listen (a full-trust app is not confined by them; they are shown in the Store, PERMISSIONS stays what plat enforces); audio.output needs none (playing sound is no MSIX capability, only recording is: microphone); location and sensors declare nothing while plat has no Windows version (noted; the former will be the device capability location); gamepad needs none (XInput in a full-trust app; the capability list has nothing for it, humaninterfacedevice is the HID API's; noted). An APK's android/AndroidManifest.xml stays the app's own file: with location in PERMISSIONS the build refuses a manifest without ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION, with net.connect or net.listen one without android.permission.INTERNET (tools/android.py, cargo jflib android). The manifest cargo jflib android writes for an app without one has INTERNET when the app has no PERMISSIONS or names net.connect or net.listen there; without it Android refuses the app every socket (NetError::no_internet, docs/ANDROID.md AN2). The package folder holds <App>.exe (signed like the setup's, when a certificate is set), modules, further programs and notices; MakeAppx pack checks the manifest against the schema.

In an MSIX package Windows virtualizes writes below HKCU and AppData: the app's config:// and data:// live in the package's private folder (removed with it), and --register (plat::assoc) is Unavailable: the manifest declares the types. plat::autostart_set switches the package's StartupTask (TaskId="Autostart", Enabled="false" until the app asks) through WinRT -- StartupTask.GetAsync, RequestEnableAsync / Disable, State, by raw COM on an MTA thread (win_winrt.rs, win_autostart.rs); a task the user switched off in Settings -> Apps -> Startup stays off (AutostartError::Dismissed), and the task starts the program without arguments. msix_alias= adds an execution alias (uap3:AppExecutionAlias): the program can be started by that name from a console, with arguments and the package identity. No resources.pri: the logos have no scale, targetsize or altform-unplated variants (Windows draws the small logo on a plate).

Updates through App Installer. With PACKAGE appinstaller_url= (the folder the files are published in, https://...) package.py writes <App>.appinstaller (http://schemas.microsoft.com/appx/appinstaller/2018): the package's identity and address, UpdateSettings with OnLaunch (HoursBetweenUpdateChecks from appinstaller_hours, default 0: at every start; ShowPrompt, the start not held up) and AutomaticBackgroundTask. Publish the new .msix and the new .appinstaller (its version is the package's) at that folder; users install from the .appinstaller, and App Installer brings the next version at a start. The app sees it through lib/update: Check::Managed(Manager::AppInstaller, ..). Without the URL there is no .appinstaller (noted).

Tested here: the package folder registered with Add-AppxPackage -Register (developer mode, which is on in the test system and not changed by the check) and started through its alias (pkg_check.py --install: the StartupTask on and off, Check::Managed), then removed. Not tested: installing a signed .msix (needs a trusted certificate), an update through App Installer from a web server, and a Store submission (the Store takes the identity reserved in Partner Center: set msix_name and msix_publisher to it).

Android App Bundle (not built)#

Google Play takes Android App Bundles (.aab), not APKs. tools/android.py builds a signed APK (aapt2 link, d8, zipalign, apksigner). An AAB would need, in build_apk's place:

  1. aapt2 link --proto-format (instead of the binary resource table; aapt2 of build-tools 36 has it),
  2. the base module as a ZIP: manifest/AndroidManifest.xml, resources.pb, res/, dex/classes.dex, lib/<abi>/libjfgui_android.so (both ABIs in one bundle: arm64-v8a and x86_64), assets/,
  3. java -jar bundletool.jar build-bundle --modules=base.zip --output=<App>.aab,
  4. signing with jarsigner (apksigner does not sign bundles) and the upload key; Play App Signing then signs the APKs Play makes.

bundletool is not part of the Android SDK; it is a JAR on GitHub (google/bundletool), and it is not on this machine, so the AAB is not built (no download without the user's consent). tools/pkg_check.py reports what is there (SDK, build-tools, aapt2, Java, bundletool).

ARM64: one package per processor (--arch aarch64)#

python tools/package.py Kritzel --arch aarch64                  # build/dist/Kritzel_Setup_arm64.exe
                                                                # build/dist/kritzel_0.1.0_arm64.deb
python tools/package.py template --arch aarch64 --formats all   # every format for ARM64

--arch aarch64 packages the ARM64 programs of Windows and Linux (ARM64.md; built on the x86-64 PC like the others, build_rs.py --arch aarch64) into files of their own, one per processor (ARM64.md decision 5: no setup for both). The x86-64 packages keep their names and their contents; a run without --arch is the same as before (checked byte for byte, or by content where a format stores times). The work files go to <out>/<App>-arm64/, the programs to <out>/rs_<profile>/win-arm64 and linux-arm64.

Formatx86-64 (as before)ARM64
setup<App>_Setup.exe<App>_Setup_arm64.exe: the ARM64 stub and the ARM64 programs
.deb<deb>_<ver>_amd64.deb<deb>_<ver>_arm64.deb (Architecture: arm64)
AppImage<App>-<ver>-<style>-x86_64.AppImage<App>-<ver>-<style>-aarch64.AppImage, behind apps/appimagert built for ARM64
RPMrpm/, <deb>-<ver>-1.x86_64.rpmrpm-aarch64/ (ExclusiveArch: aarch64), rpmbuild --target aarch64: <deb>-<ver>-1.aarch64.rpm
Flatpakflatpak/<app id>.json, <app id>.flatpakflatpak-aarch64/<app id>.json (the same manifest), flatpak-builder --arch=aarch64, <app id>-aarch64.flatpak; the same repository flatpak/repo
MSIX<App>-<ver>-x64.msix, <App>.appinstaller<App>-<ver>-arm64.msix (ProcessorArchitecture="arm64"), <App>-arm64.appinstaller
update channel (--update)windows-x86_64, linux-x86_64windows-aarch64 (the program named <App>-<ver>-<style>-arm64.exe), linux-aarch64 -- in the same update.json
  • One update channel for both processors: a run with --update DIR into a channel of the same app and version keeps the other processor's entries (their files must still be there as listed) and signs the whole manifest again, so update.json lists all four targets after one run of each; a new version starts afresh. lib/update picks the entry of update::target().
  • The setup's previews come from the program of the same style running on the PC; on an x86-64 PC that is the x86-64 program, which package.py builds as well (it looks the same).
  • cross_bins= (BackupCraft's agents): the ARM64 packages carry the other system's agents of both processors, agents/<os>-x86_64/ and agents/<os>-aarch64/; the x86-64 packages stay with agents/<os>-x86_64/. BackupCraft's server pushes agents/linux-x86_64/bc-agent to Linux hosts (also from an ARM64 server); choosing the ARM64 agent for an ARM64 host is not built yet.
  • Flatpak: flatpak-builder runs the build commands in the SDK of the target, so on an x86-64 PC an ARM64 bundle needs the aarch64 runtime and SDK (flatpak install --user --arch=aarch64 flathub org.freedesktop.Platform//26.08 org.freedesktop.Sdk//26.08) and QEMU's binfmt entry with flag F (qemu-user-static; WSL's qemu-user-binfmt has P and O only). Neither is installed here: the run writes the manifest and says so. On an ARM64 machine the bundle builds natively from that manifest. flatpak-builder strips the programs with eu-strip: elfutils must be installed (Ubuntu only recommends it with flatpak-builder).
  • RPM needs rpmbuild (missing here: only the .spec and its tarball); --target aarch64 lets an x86-64 rpmbuild make the ARM64 package, nothing in it runs on the build machine.
  • macOS (.dmg) is one program for both Mac processors anyway; --arch is for Windows and Linux.
  • Tested with template (ARM64.md ARM9, .github/workflows/arm64.yml): built on the x86-64 PC and on an x86-64 Linux runner (there with rpmbuild); installed, started with the app's script and removed on real ARM64 machines -- the setup (test mode) and the MSIX (Add-AppxPackage, a test certificate trusted on that machine) on windows-11-arm, the .deb (apt) and the .rpm (dnf in a Fedora container) and the Flatpak (built there from the manifest with the aarch64 runtime, flatpak install --user) on ubuntu-24.04-arm; the AppImage and the unpacked .deb there and in an ARM64 VM with 64 KB pages. lib/update ran through on all three (updatetest), targets windows-aarch64 and linux-aarch64. Not tested: a Windows on ARM device of its own, an ARM64 Flatpak built on an x86-64 PC (QEMU), packages signed with a real certificate on ARM64.

Checks#

tools/pkg_check.py: --quick runs in build_rs.py test (a few seconds, nothing built): the fixture app's metadata in every format (.desktop, AppStream, the finish-args of every PERMISSIONS key, the .spec and its tarball, the AppxManifest with file types, protocol, StartupTask and capabilities, escaping), every format with its tools taken away (skipped with what is missing, the AppDir / .spec / manifest / package folder still written), the .desktop entry, metainfo and AppxManifest of every apps/*/PACKAGE (validators, MakeAppx pack with a stand-in program; desktop-file-validate's hints are shown, not counted), the .appinstaller, the execution alias and the StartupTask id plat asks for, an update channel with a .deb and an AppImage entry, the AppImage signature sections (appimage_digest does not see them) and an AppImage signed the way package.py signs (a throwaway key in a temporary GNUPGHOME in WSL, removed with its agent), checked by gpgv over a digest computed on its own, the shipped notices (THIRD_PARTY_NOTICES.md names every file of licenses/, each style carries the notices of the styles whose fonts or icons it embeds), runtime_image on a small ELF file, desktop-file-validate, appstreamcli validate --no-net, sh -n on the scriptlets, MakeAppx pack of the fixture package, and the runtime against SquashFS images made by mksquashfs (zstd with 4 KiB blocks: fragments, several blocks, sparse and stored blocks; lz4 without fragments; links, a hard link, 300 entries in one folder): --appimage-extract gives the same tree, a start runs AppRun with the variables and reuses the cache, a cut image fails with a message.

Without --quick (by hand, a few minutes) it runs package.py template --formats all into build/pkg_check/dist and checks each package: the AppImage's header, .upd_info and image offset, its AppDir (validators, unsquashfs at --appimage-offset) and the template's tests/*.uis run through the AppImage; the .spec against its tarball; the Flatpak manifest, its files and validators, a second flatpak-builder run whose metadata holds the finish-args, the exported .desktop, and the scripts run in the build's sandbox (flatpak build); the MSIX package's files, its manifest read back, MakeAppx unpack, a signature with a certificate made for the run (the host's openssl when there is one: the WSL clock may run ahead of Windows' and make a fresh certificate "not yet valid"; never installed), signtool verify (the untrusted test root is expected), and a certificate of another subject refused with 0x8007000B. With jfgui_GPG_KEY set the AppImages are signed and gpgv checks each.

With --install (by hand, a few minutes; with --quick only these) the packages are installed for a moment where that needs no administrator and changes no setting: apps/updatetest as a Flatpak (versions 1.0.0 and 2.0.0 exported into a repository signed with a throwaway key, the signed bundle of 1.0.0 installed with flatpak --user into a temporary HOME -- the runtime is taken read-only from the real user installation through FLATPAK_SYSTEM_DIR -- and run in a private session bus with flatpak-portal --poll-timeout=2: the portal reports the update, it is installed through the portal and 2.0.0 is started by it; the update permission is granted in that bus's permission store first, so no dialog appears) and as an MSIX package (registered in developer mode, when it is already on; else SKIP), then everything is removed.

ARM64 (ARM64.md ARM9): --quick also checks the ARM64 names of every format beside the unchanged x86-64 ones, the .spec and the AppxManifest of both processors (they differ only in ExclusiveArch and ProcessorArchitecture), each processor's .appinstaller, the agents of cross_bins= per processor, a missing aarch64 Flatpak runtime and QEMU without flag F (skipped with the reason), and one update channel written by an x86-64 and an ARM64 run (all four entries, signed; a second run keeps the other's entries, a new version drops them). Without --quick, --arch aarch64 checks the ARM64 packages (--no-build: the ones in --out): the programs inside are ARM64, and on an ARM64 machine the AppImage and the unpacked .deb run the app's scripts (elsewhere SKIP). The .deb is unpacked for this on x86-64 as well (dpkg-deb -x, nothing installed). --install-packages (on a machine of the packages' processor, meant for the CI runners of .github/workflows/arm64.yml) installs the app's own packages for a moment, runs its scripts with the installed program and removes them again: the setup in test mode, the MSIX with Add-AppxPackage (its certificate must be trusted beforehand) and a start through shell:AppsFolder, the .deb with apt-get (only with sudo that asks for no password), the .rpm with dnf in a Fedora container (docker), the Flatpak built from its manifest on that machine and installed with flatpak --user.

Third-party notices#

THIRD_PARTY_NOTICES.md lists the third-party code, data, fonts, and artwork in JFLib; the license texts are in licenses/. build_rs.app_notices collects what an app ships: that file and licenses/ in the repository's layout, lib/text_shape/NOTICE.md with its crate licenses as licenses/text_shape/, and for each style the license files in styles/<style>/ and styles/<style>/assets/ (names with license, OFL, NOTICE, or COPYING) as licenses/<style>/, together with those of the styles whose fonts or icons it embeds (include_bytes!("../<other>/...")). Loose builds carry them next to the executable (style notices in licenses/<app>/<style>/), the setup, MSIX, .deb, .rpm, AppImage, and Flatpak packages in the installation folder or /usr/share/doc/<package>/, and APKs below assets/. In the setup's payload, notices whose path is longer than 47 bytes are combined into one ALL-LICENSES.txt per library folder. Preserve these files when distributing an app.

The Rust build uses pinned Cargo dependencies for OpenType/Unicode shaping. The first build needs Cargo and a populated cache or registry access. G'MIC, Paint.NET and third-party plugins are separate installations and are not bundled.

Source: docs/PACKAGING.md in the JFLib repository.