Help us shape the future of Go! Take the 2026 Go Developer Survey

appimage

package
v3.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 28 Imported by: 0

README

Native AppImage packaging

CreateNative collects ELF dependencies, adds an explicit GTK3 or GTK4 WebKit profile for GUI applications (including purego's dynamically loaded libraries), and writes a SquashFS image using internal/readonlyfs. It executes no target programs or packaging tools. The older Create adapter retains its linuxdeploy boundary for callers outside Wake.

RuntimeRoot is a Linux root filesystem tree, such as a directory containing usr/lib64 and usr/share. An explicit tree is resolved without searching the packaging host. Absolute Linux symlinks stay inside that tree. Native Linux can use the installed runtime; other hosts need a supplied tree for GUI applications. The tree must include compiled GLib schemas and pre-generated GDK/GTK module caches when it contains external loader modules. Target glibc and its ELF interpreter remain operating-system prerequisites. Packaging a newer glibc ABI does not make it compatible with older Linux distributions.

Staging materializes regular files, so Windows needs no elevated symlink privileges. Archive modes are explicit Linux modes. RuntimeIdentity hashes the selected destination/source mappings, source modes and contents, launcher, target profile, and runtime artifact. Call it after binary inputs become available.

The external AppImage type-2 runtime is downloaded by immutable release-asset ID and verified against pinned SHA256 values in runtime_asset.go. A local RuntimePath override is target-validated and included in the content identity. This runtime remains an external dependency; the implementation is not wholly first-party. Runtime release: https://github.com/AppImage/type2-runtime/commit/fedfad51acc2860b2916a1eef32ba4a500ff31ef

The new implementation was written from format documentation and existing Wails-owned deployment code, without copying third-party implementations. Update metadata and zsync sidecars follow the published formats: https://github.com/AppImage/AppImageSpec/blob/master/draft.md https://github.com/cph6/zsync/blob/master/SPEC.md The existing golang.org/x/crypto/md4 implementation supplies the legacy zsync block hash; no Go module or version was added. Tests retain official zsyncmake reference bytes and use the standard library. Benchmarks retain measurements of runtime dependency collection and update-control generation.

Documentation

Overview

Package appimage stages Linux application runtimes and publishes type-2 AppImages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, options Options) error

func CreateNative

func CreateNative(ctx context.Context, options Options) error

CreateNative builds a type-2 AppImage without executing target binaries or packaging tools. Its target runtime is an explicitly pinned external artifact.

func FindRuntimeFiles

func FindRuntimeFiles(ctx context.Context, root string, names []string) ([]string, error)

FindRuntimeFiles searches runtime directories first, with a full-root fallback for nonstandard installations. Directory symlinks are not followed.

func Launcher

func Launcher(binary string) []byte

Launcher renders the Wails-owned AppRun for the primary executable.

func OutputName

func OutputName(name, arch string) (string, error)

func RelocateWebKitHelpers

func RelocateWebKitHelpers(appDir string, helperDirs []string) error

RelocateWebKitHelpers points the bundled WebKit library at the helper processes copied into the AppDir. WebKitGTK looks for them in a directory compiled into the library (only developer builds honour WEBKIT_EXEC_PATH), so as deployed the AppImage only starts where the build machine's path exists, e.g. /usr/lib/x86_64-linux-gnu on Debian and Ubuntu, and there it runs the system's helpers. Everywhere else WebKit fails with "Unable to spawn a new child process".

Each helper directory moves to usr/lib/<name> and the library's copy of its path becomes "././<name>/", NUL-padded to the original length. WebKit hands that string to bubblewrap both as a bind destination, resolved against the sandbox root, and as the exec path, resolved against the working directory. bwrap can create a top-level destination in its read-only root where a nested one under /lib fails, and appRun starts the application in $APPDIR/usr/lib, which WebKit binds at the same absolute path, so the exec path resolves inside the sandbox too. Only the whole NUL-terminated string is rewritten: the injected-bundle directory shares the prefix on Debian-family systems and must stay absolute, because a relative bind destination there fails the same way; appRun redirects it to the bundled copy.

Types

type Binary

type Binary struct{ Name, Path string }

type Command

type Command struct {
	Program   string
	Args      []string
	Directory string
	Env       map[string]string
}

type Options

type Options struct {
	Root, Name, Arch, Output, Icon, IconName, DesktopFile, WorkDir, CacheDir string
	Binaries                                                                 []Binary
	LibraryDirs                                                              []string
	RuntimeRoot                                                              string
	RuntimePath                                                              string
	GTKVersion                                                               int
	// UpdateInfo is passed to linuxdeploy's AppImage plugin; it must emit a zsync sidecar.
	UpdateInfo string
	WebKit     bool
	// GTKPlugin is the existing external plugin artifact, not a native replacement.
	GTKPlugin  []byte
	Tools      Tools
	ForceTools bool
	Env        map[string]string
	Runner     Runner
	Client     *http.Client
	Progress   func(string)
}

func (Options) PrepareRuntime

func (options Options) PrepareRuntime(ctx context.Context) (string, error)

func (Options) PrepareTools

func (options Options) PrepareTools(ctx context.Context) (Tools, error)

PrepareTools resolves and downloads the external tools before action identity is calculated.

func (Options) RuntimeIdentity

func (options Options) RuntimeIdentity(ctx context.Context) (string, error)

RuntimeIdentity fingerprints the exact selected deployment, including data added since a previous build. Call it after executable inputs materialize.

func (Options) RuntimeInputs

func (options Options) RuntimeInputs(ctx context.Context) ([]string, error)

RuntimeInputs lists the resolved target libraries and data that influence packaging, so an OS or supplied runtime update invalidates the package cache.

type Runner

type Runner func(context.Context, Command) error

type Tools

type Tools struct{ LinuxDeploy, AppRun string }

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL