darwin

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package darwin handles macOS-specific build steps — wrapping the raw binary into a .app bundle and (host-darwin only) further wrapping that into a .dmg disk image. Pure-Go .app construction works from any host; .dmg requires the macOS-only `hdiutil` tool.

Index

Constants

This section is empty.

Variables

View Source
var ErrSkippedDMG = errors.New("dmg: hdiutil unavailable on non-darwin host")

ErrSkippedDMG is returned when DMG creation is skipped because the host OS is not darwin (hdiutil is macOS-only). Callers may treat this as a non-fatal warning.

Functions

func PackageApp

func PackageApp(binPath, gateBinPath, appName, appVersion, bundleID string) (string, error)

PackageApp wraps a built darwin binary into a standard .app bundle:

bin/<app>.app/
├── Contents/
│   ├── Info.plist
│   ├── MacOS/<app>          (the main binary, copied)
│   ├── MacOS/<app>-gate     (gate sidecar, when shipped)
│   └── Resources/icon.icns  (rendered from the brand W)

gateBinPath (optional) is the gate sidecar to ship as `Contents/MacOS/<AppName>-gate`. Empty = no sidecar (the main binary still has gate embedded; runtime extracts to the session dir on first hook fire). When non-empty, sibling lookup picks up the bundled gate before any extract.

Returns the bundle root path. Source binaries are COPIED (not moved) so the raw artifacts remain available for the self-updater and for naming-consistent CI uploads.

func PackageDMG

func PackageDMG(appPath, dmgPath, volName string, installerLayout bool) (string, error)

PackageDMG wraps an existing .app bundle into a UDZO-compressed .dmg disk image via the macOS `hdiutil` tool.

When installerLayout is true, the image is staged so it also contains an "Applications" symlink — Finder then shows the standard "drag-to-install" layout when the user mounts it. When false, the .dmg embeds just the .app (current/legacy behavior).

Returns the .dmg path on success; returns ErrSkippedDMG when the host is not darwin (the .app bundle alone is still useful then).

volName is the visible name when the user mounts the disk image; dmgPath is the output filename (typically <app>-darwin-<arch>.dmg).

Types

This section is empty.

Jump to

Keyboard shortcuts

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