Skip to content

Distribution

pam desktop build turns an application into a self-contained bundle for the system the build runs on, plus that system’s installers. The bundle carries the native host, your application with its vendor directory, a PHP runtime and a launcher: the machine it is installed on needs neither PHP nor Composer. Nothing is booted and no bundler runs; the build reads pam-desktop.json, copies files and calls the packaging tools of the system.

Terminal window
# Bundle directory + update-ready portable archive
pam desktop build
pam desktop build --format deb
pam desktop build --format appimage --format rpm
pam desktop build --output artifacts --format all

Artifacts are written to dist/ (or --output). Existing destinations cause a failure; --force replaces exactly those versioned artifacts. Every artifact is staged privately and published only after all of them were built, so a missing tool never leaves an incomplete artifact.

Host directory portable Installers
Linux Self-contained directory Deterministic .tar.gz appimage, deb, rpm
macOS Self-contained directory .zip of the .app dmg, pkg
Windows Self-contained directory .zip msix, msi

Each installer is built on its own system; --format all selects every format of the host. The tools a format needs are checked before any work starts: dpkg-deb, the official appimagetool, rpmbuild, ditto, hdiutil, pkgbuild, makeappx and WiX 5.

The build reads the identity of the application from pam-desktop.json and is strict: a field with the wrong type or an unsafe value stops the command with the reason.

pam-desktop.json
{
"applicationId": "com.example.notes",
"name": "Acme Notes",
"version": "1.0.0",
"build": 42,
"entry": "index.php",
"description": "Fast notes for your desktop.",
"publisher": "Acme",
"category": "productivity",
"icon": "resources/icon.png",
"exclude": ["storage/cache", "notes"],
"extensions": ["auto", "intl"],
"urlSchemes": ["acme-notes"],
"singleInstance": true,
"window": { "width": 1100, "height": 720 }
}
Field Default Rules
applicationId derived from the folder Lowercase reverse-DNS, at most 155 bytes. It names the package, the desktop entry, the data directories and the update feed: set it before your first release and never change it.
name the folder name 1 to 80 bytes.
version 0.0.0 Starts with a digit; letters, digits, ., +, -, ~.
description, publisher empty, name Shown by installers.
category utility development, productivity, graphics, audio-video, network, utility, game, education.
icon a generic icon A square PNG (64 to 1024 px) or a self-contained SVG, at most 2 MiB. Windows launchers need a PNG.
exclude nothing Project paths left out of the bundle.
extensions what your code refers to PHP extensions to ship; see below.
urlSchemes none Up to 8 schemes that open the application.
singleInstance true when urlSchemes is set A second launch hands its link to the running instance.
updates none See Signed Updates.
acme-notes-1.0.0-linux-x86_64/
manifest.json identity, target and SHA-256 of every file
bin/pam-desktop the native host
bin/acme-notes the launcher
runtime/php/ PHP, its shared libraries and extensions
etc/php.ini production settings and the shipped extensions
lib/ host libraries the system does not provide
app/ your application, with its vendor directory
share/ desktop entry template and icon (Linux)
install.sh uninstall.sh per-user installation (Linux)

The build always leaves out .git, .env and .env.*, .pam-desktop, dist, node_modules, target and directories tagged with CACHEDIR.TAG. A bundle holds no symbolic links. The host is the pam-desktop binary that runs the build, so build with the host you mean to ship.

PHP is found the way run finds it. On Linux the build ships the shared libraries PHP and its extensions link against (collected with ldd); on Windows, the DLLs from the import tables plus the Visual C++ runtime, so the target machine needs no redistributable.

The build ships only the shared extensions your code refers to: it scans the .php and .pam files of the bundle (runtime vendor packages included) for functions, classes, constants, PDO data sources and stream wrappers of each extension. A name only checked with extension_loaded() does not count. What the scan cannot see, such as a function name built at run time, must be listed: ["auto", "intl"] adds intl to what was found, a list without "auto" ships exactly the listed ones, and ["all"] ships every loaded extension. PAM_DESKTOP_EXTENSION_USAGE=1 prints the first reference to each extension.

On Linux the host uses the GTK 4, GStreamer and WebKitGTK of the machine it runs on, so themes, portals and GPU drivers match. They are not bundled: .deb and .rpm packages declare GTK as a dependency, and WebKitGTK only when your code names WebView. Tell users of media applications to install gstreamer1.0-plugins-good. Build Linux artifacts on the oldest distribution you support, since the bundle depends on its C library.

  • Portable .tar.gz with install.sh and uninstall.sh: an atomic per-user installation under ~/.local/share/pam-desktop/apps, a link in ~/.local/bin, the desktop entry and the icon. Updates itself.
  • .deb / .rpm: the bundle under /opt/<applicationId>, the launcher linked in /usr/bin, the desktop entry and icon. Updated by the package manager.
  • AppImage: the bundle in an AppDir. Runs with APPIMAGE_EXTRACT_AND_RUN=1 where FUSE is missing.

The installed application never writes under /opt: compiled templates go to ~/.cache/<applicationId> and state to ~/.local/state/<applicationId>.

Each scheme in urlSchemes is a lowercase letter followed by 1 to 31 lowercase letters, digits, +, . or -; http, https, file, mailto, javascript and data cannot be claimed. The installers register them:

System Registration
Linux MimeType=x-scheme-handler/<scheme>; in the desktop entry
macOS CFBundleURLTypes in the Info.plist
Windows windows.protocol in the MSIX; per-user Software\Classes\<scheme> keys in the MSI

The launcher hands its link to the application as PAM_DESKTOP_LAUNCH_URL, which Linking::initial() reports. With singleInstance, a second launch passes its link to the running instance, which receives it through Linking::listen(), and exits. See System Services.

--sign is available on macOS and Windows. Credentials come from the environment, never from the project:

Terminal window
pam desktop build --format dmg --format pkg --sign
Variable Use
PAM_MACOS_SIGNING_IDENTITY Developer ID identity for codesign (hardened runtime, timestamp) of the binaries, the .app and the DMG.
PAM_MACOS_INSTALLER_IDENTITY Installer identity for pkgbuild --sign.
PAM_MACOS_NOTARY_PROFILE Optional notarytool keychain profile: the DMG and PKG are notarized and stapled.
PAM_WINDOWS_CERTIFICATE_SHA1 Thumbprint of the Authenticode certificate for signtool.
PAM_WINDOWS_TIMESTAMP_URL Timestamp server, DigiCert by default.
PAM_WINDOWS_PUBLISHER Publisher of the MSIX identity; must match the certificate.

Missing credentials stop the build before it starts. Linux artifacts are not signed by the build: their integrity comes from the per-file manifest.json and the separately signed update feed.

Every bundle contains manifest.json with the identity of the application, the versions of PAM Desktop and PHP, the target system, and every shipped path with its size and SHA-256. File modes are normalized (0755 for directories and executables, 0644 for the rest). Linux portable archives also fix entry order, ownership, timestamps (SOURCE_DATE_EPOCH) and the gzip header, so the same inputs give the same bytes.

  1. Set applicationId, name, version, publisher, category and a PNG icon.
  2. Run pam desktop check and your tests.
  3. List development files in exclude.
  4. Build on each target system, on the oldest version you support.
  5. Install, launch and, if you use updates, update from the previous version on a clean machine.
  6. Sign on macOS and Windows, and publish a signed update feed.