Skip to content

Latest commit

 

History

History
492 lines (376 loc) · 22 KB

PACKAGING.md

File metadata and controls

492 lines (376 loc) · 22 KB

Packaging and distribution

Build a macOS app and disk image for the current architecture.

./scripts/bundle-macos.sh --dmg --features engine-downloads,media

GitHub Actions builds Apple Silicon and Intel disk images on every push to main. A tagged release adds the source archive and SHA256SUMS. Linux and Windows packaging is paused. Their scripts and workflow definitions are retained for resuming support.

macOS

Two disk images, one per architecture

CI builds both architectures natively with the macOS 26 runner images and includes the layered Icon Composer asset catalog.

./scripts/bundle-macos.sh --dmg                # this machine's architecture
./scripts/bundle-macos.sh --dmg --target x86_64-apple-darwin
./scripts/bundle-macos.sh --universal --dmg    # both, fused with lipo

--universal still works and is cheap: mozjs downloads a prebuilt SpiderMonkey per target rather than compiling it, so the second cargo build --target is minutes rather than hours, and every dylib in the GStreamer framework Servo pins is already fat — which leaves exactly one file for lipo to merge. It is not what a release ships, because two named downloads beat one that runs on both, and because each of these is about 80 MB smaller: a single-architecture bundle has its GStreamer libraries thinned to match, and a universal one cannot be.

Cross-compiling with --features media needs one extra thing, and the script sets it: glib-sys and gstreamer-sys refuse to run pkg-config for a target that is not the host. PKG_CONFIG_ALLOW_CROSS=1 is normally a loaded gun, because one set of .pc files usually describes one architecture; here it does not, because the framework is universal.

The minimum macOS version

.cargo/config.toml sets MACOSX_DEPLOYMENT_TARGET = "11.0", with force = true, and LSMinimumSystemVersion in the bundle is derived from it.

Both halves of a universal binary have to claim the same floor — lipo will fuse two that disagree without a word — and 11.0 is the honest number rather than a chosen one: it is what the arm64 binary already recorded before anyone set the variable, and it is the floor of the arm64 slice of the GStreamer framework. The plist used to say 13.0, typed in beside the compiler rather than derived from it, which turned away macOS 11 and 12 at launch from a binary that would have run.

Updater-enabled bundles require macOS 12 or later and a Heion Ed25519 public key. The workflow can publish ad-hoc or notarized update-enabled releases. See macOS updates for release setup.

Unsigned builds — what your users will see

Preview builds and releases made without signing credentials use ad-hoc signatures. A signing certificate costs $99/year, and notarization requires uploading each build to Apple.

The bundler applies an ad-hoc signature (codesign -s -), signing the nested libraries first and the bundle last. That is not optional: since Apple Silicon, all executable code has to carry a signature, and a broken one is worse than none. It is also not a Developer ID signature, and does not satisfy Gatekeeper.

The bundler signs nested code explicitly with the right options for each component. It verifies the resulting signatures recursively.

Gatekeeper's verdict turns entirely on one thing: whether the app carries com.apple.quarantine. Apple's own gktool scan Zervo.app says "Scan completed and software is allowed by system policy" for an unquarantined build of Heion, and "failed because the software is not signed by a distributor that meets the system Gatekeeper requirements" once the flag is on. The bundle is fine either way; the flag is the whole story.

Do not use spctl -a -t exec to check this. It reports rejected for an ad-hoc signed app whether or not it is quarantined, so it tells you nothing about what a user will actually see.

The flag does not live on the app inside the disk image. The download stamps it on the .dmg, the mounted volume then carries a quarantine mount flag, and the attribute is written onto the copy when the app is dragged out. So the two places worth clearing it are the .dmg before mounting, or the installed app afterwards:

xattr -dr com.apple.quarantine /Applications/Zervo.app

Without that, macOS can report that the app is damaged and cannot be opened, which reads like a corrupt download and is not what has happened.

That command is now the only way. Do not tell users to Control-click → Open: Apple removed that bypass for improperly signed apps in macOS Sequoia (Updates to runtime protection in macOS Sequoia). And on macOS 26 and later, a quarantined ad-hoc-signed app does not get an Open Anyway button in System Settings either — it is offered to the Trash instead. The instruction in the disk image's READ ME FIRST says so.

Building from source has no such problem: a locally built app is never quarantined.

Signing and notarizing, if you ever want to

The script already does it; it needs an identity.

./scripts/bundle-macos.sh --universal --dmg \
    --sign "Developer ID Application: NAME (TEAMID)" --notarize

--sign switches on the hardened runtime and a secure timestamp, both of which notarization requires. Two things about that are easy to get wrong and give no sign that they went wrong.

The argument order: codesign --sign … --options runtime, never the reverse. --options before --sign is silently ignored, and the signature comes out without the hardened runtime — which notarization then rejects with an error that says nothing about argument order.

And the entitlements. The hardened runtime forbids writing to memory and then executing it, which is precisely what a JavaScript JIT does, so a Developer ID build without com.apple.security.cs.allow-jit crashes on the first page that runs a script — which is every page. assets/macos/entitlements.plist carries that and allow-unsigned-executable-memory, and the bundler passes it when signing the bundle. The nested libraries do not get it: they are libraries and they JIT nothing.

--notarize wants APPLE_ID, APPLE_TEAM_ID and APPLE_APP_PASSWORD in the environment, submits the disk image with notarytool and staples the ticket, so the result opens with no quarantine step at all.

CI picks this up on its own: .github/workflows/macos.yml imports a certificate into a temporary keychain when the repository has these secrets, and falls back to an ad-hoc signature when it does not.

Secret What it is
MACOS_CERTIFICATE the .p12, base64-encoded
MACOS_CERTIFICATE_PASSWORD its export password
MACOS_SIGN_IDENTITY Developer ID Application: NAME (TEAMID)
APPLE_ID, APPLE_TEAM_ID, APPLE_APP_PASSWORD notarization, optional

If a build will not start: @rpath/libz.1.dylib

dyld: Library not loaded: @rpath/libz.1.dylib … no LC_RPATH's found

This happens only on machines with the GStreamer framework installed, and only to cargo build --release — the bundler handles it. GStreamer's -sys build scripts put the framework's lib directory on the link path whether or not --features media asked for it, so -lz finds the zlib in there before the system one. That copy's install name is @rpath/libz.1.dylib, and nothing adds an rpath.

./scripts/bundle-macos.sh repoints it at /usr/lib/libz.1.dylib before signing. To fix a binary you built yourself:

install_name_tool -change @rpath/libz.1.dylib /usr/lib/libz.1.dylib target/release/zervo

The obvious fix — a linker flag in .cargo/config.toml — is not used, for two reasons: setting rustflags there is silently dropped when RUSTFLAGS is set in the environment, which is what CI does, and changing it invalidates every crate's fingerprint, so it costs a full rebuild of Servo.

Audio and video

--features media needs the official GStreamer distribution installed at /Library/Frameworks/GStreamer.framework. Servo supports no other source for it on macOS, and pins 1.22.3. Both packages are needed — the runtime and the headers:

BASE=https://github.com/servo/servo-build-deps/releases/download/macOS
curl -L -o /tmp/gstreamer.pkg       $BASE/gstreamer-1.0-1.22.3-universal.pkg
curl -L -o /tmp/gstreamer-devel.pkg $BASE/gstreamer-1.0-devel-1.22.3-universal.pkg
sudo installer -pkg /tmp/gstreamer.pkg -target /
sudo installer -pkg /tmp/gstreamer-devel.pkg -target /

scripts/bundle-gstreamer.py then copies the libraries and plugins into Zervo.app/Contents/MacOS/lib and rewrites their install names, so the bundle runs on machines that have never heard of GStreamer. bundle-macos.sh calls it for you. The plugins are loaded by name at runtime and never show up in otool output, so they are listed explicitly in that script; if playback breaks after a Servo update, check the list against gstreamer_plugin_lists/ in the servo crate.

Expect the bundle to grow by roughly 100 MB — 150 MB before thinning.

That pin is old. Servo has not moved off 1.22.3, released in June 2023, and the release it downloads from has not been touched since August 2023, while upstream GStreamer is on 1.28. Heion cannot get ahead of the engine here.


Linux

./scripts/package-linux.sh --deb        # on Ubuntu or Debian
./scripts/package-linux.sh --rpm        # on Fedora
./scripts/package-linux.sh --tarball    # anywhere
./scripts/package-linux.sh --appimage   # with the host graphics and media libraries
./scripts/package-linux.sh --flatpak    # with flatpak-builder and the Flathub remote
./scripts/package-linux.sh --pkgbuild   # PKGBUILDs for the AUR
./scripts/package-linux.sh --all        # every format this machine can produce

--pkgbuild on its own renders two text files and builds nothing — no engine, no staging tree. Every other format needs the binary.

One staging tree feeds all of them, so a file added for one format appears in every format. It holds the binary, the desktop entry, a scalable and a 256×256 icon, the AppStream metainfo, a gzipped man page, the licence and the readme.

Build each package on the distribution it targets. A binary linked against Ubuntu's libraries will not reliably run on Fedora, and both dpkg-shlibdeps and rpmbuild derive the package's requirements from the binary itself, which means those requirements have to be that distribution's sonames.

Neither package carries a hand-written library list. What they do carry, and did not before, is the list of programs Heion shells out to — zenity for the file chooser, xdg-utils for opening a download, libsecret for the keyring. None of those are linked, so no dependency generator finds them, and without them the feature silently does nothing.

Neither carries a %post scriptlet either: the desktop database, the icon cache and the MIME cache are all refreshed by triggers that desktop-file-utils, hicolor-icon-theme and shared-mime-info own, on both Debian and Fedora. The .deb does register /usr/bin/x-www-browser through update-alternatives, which is the only thing a maintainer script is genuinely needed for.

GStreamer is an ordinary system package on Linux, so --features media needs no bundling — unlike macOS, where the framework has to be copied into the app.

Nothing here is signed, which on Linux is not the obstacle it is on macOS: both dpkg -i and dnf install will install an unsigned local package, with at most a warning.

The AppImage

./scripts/build-appimage.sh --features engine-downloads,media

Built inside an ubuntu:22.04 container, not on the runner. glibc is backwards compatible and not forwards, so the oldest base still worth supporting reaches furthest — and a container outlives the ubuntu-22.04 runner label, whose deprecation starts in September 2026.

The AppImage uses the host graphics and display libraries and the system CA certificate bundle. In media builds it also uses the host’s GStreamer 1.20+ and GLib as a unit, including the host’s plugin scanner and plugins. The packaging script checks the AppDir for copies of these libraries before building the image. On Debian-family systems with media enabled, install gstreamer1.0-gl, gstreamer1.0-plugins-{base,good,bad,ugly}, and gstreamer1.0-libav. The linked GL, base, and bad libraries are required to start a media build.

Tagged release AppImages include a .zsync file for delta updates. If FUSE is unavailable, run the image with --appimage-extract-and-run:

chmod +x Zervo-<version>-x86_64.AppImage
./Zervo-<version>-x86_64.AppImage --appimage-extract-and-run

The Flatpak

Download the .flatpak next to the AppImage in GitHub Releases or a preview build. The bundle records Flathub as the source for its GNOME 50 runtime.

flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install --user ./Zervo-<version>-x86_64.flatpak
flatpak run app.zervo.Zervo

Flatpak and AppImage reuse the same Linux executable and Cargo features. The Flatpak uses the runtime’s graphics and GStreamer libraries and packages Zenity for file dialogs. It grants write access to Downloads and uses the desktop’s Secret Service for saved passwords. CI tests the installed bundle inside its sandbox. The bundle is distributed through GitHub.

Arch and the AUR

./scripts/package-linux.sh --pkgbuild renders two packages from the templates in scripts/aur/:

  • zervo-bin repackages the release tarball. This is the one to install.
  • zervo builds from source, which means compiling the Servo engine.

Both are rendered with the checksums of the artefacts that were actually built, and CI attaches them to the release as zervo-aur-packages.tar.gz, complete with the .SRCINFO the AUR serves.

Publishing is not automated and will not be. The AUR is a git remote over SSH tied to one person's account:

git -c init.defaultBranch=master clone ssh://aur@aur.archlinux.org/zervo-bin.git
cp zervo-bin/PKGBUILD zervo-bin/.SRCINFO aur-checkout/
cd aur-checkout && git commit -am "zervo-bin 0.4.1" && git push

Three things the AUR's server-side hook will reject a push for, all of which the CI job checks in seconds: .SRCINFO missing or out of date with PKGBUILD, a push to any branch other than master, and any subdirectory in the repository.

Servo's own mach bootstrap is a silent no-op on Arch — it accepts Arch as a known distribution and then installs nothing — so the makedepends array in scripts/aur/PKGBUILD.in is the only Arch dependency list that exists anywhere.


Windows

pwsh scripts/package-windows.ps1 -Features engine-downloads,media -Installer

Produces a directory, a .zip of it, and — with -Installer — an NSIS setup executable.

Three things travel beside the exe because they have to:

ANGLE. Windows composites through EGL on Direct3D 11 rather than WGL, and mozangle builds libEGL.dll and libGLESv2.dll into its own OUT_DIR, not into the profile directory. The exe is linked against libEGL, so without them it does not start at all. The script picks the newest copy under target/*/build, because a target directory that has built more than one mozangle contains several and a stale one is a crash at launch.

The Visual C++ runtime. Rust's MSVC targets link the CRT dynamically, so a machine without the redistributable gets "vcruntime140.dll was not found" and nothing else.

GStreamer, when -GStreamerRoot is given. Everything in the installation's bin/ and everything in lib/gstreamer-1.0/ is copied flat beside the exe — flat because the engine looks for plugins next to the binary, and a tidier layout means media silently stops working with no error to point at.

The installer

Per-user, into %LOCALAPPDATA%\Programs\Zervo, registered under HKCU, with RequestExecutionLevel user. That is deliberate: the build is unsigned, and an unsigned installer asking for administrator rights is the combination Windows objects to most loudly. Nothing in Heion needs to live outside the user's profile.

It registers Heion's capability to handle http and https, which is what puts it in Settings → Default apps. It does not make itself the default; an installer may not, and should not.

Uninstalling removes the program and its registry entries and leaves %APPDATA% alone. An uninstall is not a request to throw away bookmarks.

SmartScreen

An unsigned binary shows "Windows protected your PC" on first run, and on a machine with Smart App Control enabled it does not run at all.

Signing does not remove that prompt — reputation still has to accumulate — but it is the only thing that lets reputation accumulate across versions rather than resetting to zero on every release. Do not buy an EV certificate for this: Microsoft's own documentation now says EV no longer bypasses SmartScreen. The cheapest real option is Azure Artifact Signing (formerly Trusted Signing) at about $10 a month, with the caveat that individual enrolment is limited to the United States and Canada and identity validation takes days.

ARM64

Not built, and that is a decision rather than an omission.

aarch64-pc-windows-msvc is Rust tier 1, mozjs already publishes a prebuilt SpiderMonkey for it, and mozangle guards its SSE2 flags by architecture. What blocks it is a header collision: MSVC's <arm_fp16.h> typedefs float16_t, and the vendored glsl-optimizer inside glslopt declares a struct of the same name. Both the fix (glslopt-rs#11) and the Servo PR that carries it (servo#42312) are open and unmerged, and there is no official GStreamer build for Windows on ARM at all.

Meanwhile Windows 11 on ARM emulates x64 user-mode code through Prism, and does not emulate the GPU path — Direct3D and ANGLE call into native arm64 system libraries. So the x64 build runs on those machines; it is slower at CPU-bound work and correct at everything else.

The job is wired and switched off. workflow_dispatch with try-arm64 turns it on, and it will either work or say exactly why not.


The release pipeline

Pushes to main build macOS preview artifacts without creating a release. Download them from Actions → Release. To build a specific ref, run the workflow manually with the tag field blank.

A matching v* tag builds the two disk images and the source archive, then attaches them and their checksums to the release. A manual tagged run leaves a draft unless publication is selected.

When clang moves under you

Ubuntu 26.04 carries several LLVM versions. mozangle runs bindgen over ANGLE's shader translator, and bindgen loads libclang at runtime while reading the headers that clang resolves to — but clang-sys picks the newest libclang it can find. So bindgen parsed LLVM 21's headers with a newer libclang, and every SSE builtin those headers name had been removed in the meantime:

/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:245:18:
    error: use of undeclared identifier '__builtin_ia32_sqrtss'

Twenty of those, then fatal error: too many errors emitted, then a panic in a build script an hour into the job. The fix is to make the two the same version by construction rather than by luck:

RESOURCE_DIR="$(clang -print-resource-dir)"     # /usr/lib/llvm-21/lib/clang/21
echo "LIBCLANG_PATH=${RESOURCE_DIR%/clang/*}"   # /usr/lib/llvm-21/lib

The .deb and AppImage jobs both do this; the Fedora one pins /usr/lib64 for the same reason, because clang-libs there ships only a versioned libclang.so.NN and the unversioned symlink bindgen prefers lives in clang-devel.

Draft first, attach everything to the draft, publish last. The three platform workflows used to attach their own artefacts to the tag as they finished, which is a create-or-update race between jobs, cannot produce a SHA256SUMS covering more than one platform, and breaks outright the day immutable releases are switched on for the repository. If any platform fails, the draft stays a draft and nothing half-finished is ever visible.

The long build jobs hold no write token and check out with persist-credentials: false, so the release token is never in reach of a build script from any of the thousand-odd crates in the dependency graph.

workflow_dispatch on release.yml takes an existing tag and leaves the result as a draft unless you ask otherwise, which is how to rehearse one.

Cutting a release

  1. Bump the application and core versions, refresh Cargo.lock, and add a CHANGELOG.md entry. Update the AppStream entry for releases that include Linux packages.
  2. Commit, tag vX.Y.Z, push the tag.
  3. Watch. A cold build is hours; a warm one considerably less.
  4. Check the draft, then let it publish — or publish it yourself if you ran the workflow by hand.

What CI checks before any of that

check.yml runs on every pull request and compiles nothing heavier than zervo-core. It also lints the half of the repository that cannot be run on a developer's machine at all: shellcheck -x over every script including the shared library, actionlint over every workflow, PSScriptAnalyzer over the PowerShell, desktop-file-validate and appstreamcli over the freedesktop metadata, mandoc -Tlint over the man page, and a render-and-parse of both PKGBUILDs.

None of that catches a broken package. All of it catches the typo that would otherwise surface three hours into a release build.


What is missing

  • File uploads shell out to zenity. The packages recommend it; the proper fix is the XDG desktop portal over D-Bus.
  • No vibrancy on Linux or Windows. The translucent chrome is an AppKit feature; the other platforms draw the same chrome without the frosted backdrop behind it.
  • Wayland versus X11 has had no testing at all.
  • The Windows exe has no icon of its own. The installer's shortcuts do; Explorer shows the generic one, because embedding it needs a build script and a resource compiler.
  • Nothing is signed, on any platform.