@gjsify/gtk-runtime-darwin-x64 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +101 -0
  2. package/index.d.ts +11 -0
  3. package/index.js +32 -0
  4. package/package.json +45 -0
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # @gjsify/gtk-runtime-darwin-x64
2
+
3
+ Batteries-included, **relocated** GTK / GObject-Introspection runtime bundle for
4
+ **macOS on Intel (x64)**. It lets [`@gjsify/node-gi`](../node-gi) load `gi://`
5
+ namespaces (GLib · GObject · Gio · cairo · Pango · Graphene · Gdk) with **no
6
+ Homebrew GTK** installed on the host.
7
+
8
+ Platform-gated (`os: ["darwin"]`, `cpu: ["x64"]`), tier 3 (experimental). On any
9
+ other platform npm skips it and `@gjsify/node-gi` falls back to a system/Homebrew
10
+ GTK. The heavy `gtk/` payload is **not committed** — it is built on an Intel macOS
11
+ CI runner and shipped via the package tarball / staged into node-gi's
12
+ `prebuilds/darwin-x64/gtk/`.
13
+
14
+ ## Why this package exists
15
+
16
+ `@gjsify/node-gi` shipped a loadable `darwin-x64` addon prebuild before this
17
+ package existed, so an Intel Mac got a working reverse bridge and then still had to
18
+ `brew install gtk4 …` by hand — while an Apple-silicon Mac and a Windows box did
19
+ not. That was **one bridge running two policies**, the asymmetry
20
+ [`AGENTS.md`](../../../AGENTS.md) warns about. This package is the missing half.
21
+
22
+ It is the Intel sibling of
23
+ [`@gjsify/gtk-runtime-darwin-arm64`](../gtk-runtime-darwin-arm64) and shares its
24
+ builder — see that package's README for the full mechanism (closure walk,
25
+ `@loader_path` relocation, ad-hoc re-signing, how node-gi finds and activates a
26
+ bundle, and the env-free re-exec).
27
+
28
+ ## The builder is SHARED, not copied
29
+
30
+ Both darwin packages are built by the one parameterised script
31
+ [`../scripts/build-gtk-runtime-darwin.mjs`](../scripts/build-gtk-runtime-darwin.mjs).
32
+ Nothing about the relocation pass is arch-dependent, so a per-package copy would
33
+ have been a third near-duplicate of a ~360-line pass — the shape `AGENTS.md` names
34
+ as the place to lift a helper.
35
+
36
+ Two properties make the shared script safe to point at either package:
37
+
38
+ - **the target is derived, never passed** — `darwin-${process.arch}` comes from the
39
+ running Node (the same discipline `scripts/stage-prebuild.mjs` uses), so a leg
40
+ cannot stamp one arch's closure with another arch's name;
41
+ - **`--out` is cross-checked** against the destination package's own `os`/`cpu`
42
+ declaration, so an Intel runner cannot populate the arm64 package's `gtk/` (and
43
+ vice versa). That is the class of bug that shipped x86-64 binaries into
44
+ `prebuilds/linux-ppc64/` for weeks.
45
+
46
+ It lives beside the packages (under `packages/node-gi/`) rather than in the
47
+ repo-root `scripts/` dir because `packages/node-gi/**` is both the affected
48
+ classifier's IGNORE list and `node-gi.yml`'s `paths:` trigger: an edit here runs
49
+ node-gi's own CI and does not force a full `main.yml` run.
50
+
51
+ The relocation assertion also moved INTO that script, and it is brew-prefix
52
+ **derived**. The per-job YAML greps for the literal `/opt/homebrew` — correct on
53
+ Apple silicon, where the Homebrew prefix is `/opt/homebrew`, and **vacuously true on
54
+ Intel**, where it is `/usr/local`. A hardcoded grep would have been the first thing
55
+ this bundle got wrong.
56
+
57
+ ## Layout
58
+
59
+ ```
60
+ gtk/
61
+ lib/ relocated dylibs (@loader_path-linked, ad-hoc re-signed)
62
+ girepository-1.0/ typelibs (GLib/GObject/Gio/cairo/Pango/Graphene/Gdk/…)
63
+ manifest.json target + builder + counts + sizes + dylib list
64
+ ```
65
+
66
+ `manifest.json` records the `builder` path, so a consumer holding only the tarball
67
+ can find the recipe that produced its bytes — the tarballs no longer carry a
68
+ per-package copy of the script.
69
+
70
+ ## Install
71
+
72
+ ```sh
73
+ npm install @gjsify/node-gi @gjsify/gtk-runtime-darwin-x64
74
+ ```
75
+
76
+ `@gjsify/node-gi` resolves the bundle via
77
+ `require.resolve('@gjsify/gtk-runtime-darwin-x64')` (candidate 4 of
78
+ `resolveGtkRuntimeBundle()`) — no loader change was needed to add this arch.
79
+
80
+ > **Not a dependency of `@gjsify/node-gi`, deliberately.** #910 made the arm64
81
+ > bundle a dependency and #920 reverted it: an installed bundle satisfies candidate
82
+ > 4, so a job that built the addon against Homebrew GTK re-execs onto the *bundle's*
83
+ > typelibs with native code linked against a *different* GTK — wrong method entries,
84
+ > then a 29-minute timeout. Install it explicitly when you want the no-Homebrew
85
+ > path.
86
+
87
+ ## CI status — read this before trusting the "no Homebrew" claim
88
+
89
+ - **Built + load-tested on every `packages/node-gi/**` PR** by `node-gi.yml`'s
90
+ `macos-gtk-runtime` → `macos-gtk-batteries-included` chain (matrix leg
91
+ `arch: x64`, runner `macos-15-intel`). The batteries-included job never
92
+ `brew install`s GTK, so a green run *is* the conformance: the bundle self-satisfies
93
+ or nothing loads.
94
+ - **Published** by `release.yml`'s `publish-gtk-runtime-darwin` job (matrix leg
95
+ `x64`), which builds the bundle on an Intel runner and OIDC-publishes only this
96
+ package with the populated `gtk/`.
97
+ - **NOT yet covered:** the `--windowing` GUI proof (`macos-gtk-windowing-runtime` →
98
+ `macos-gtk-windowing`) runs on arm64 only. Tracked in `status/open-todos.md`.
99
+
100
+ `macos-15-intel` is the last x86_64 macOS image GitHub Actions offers (through
101
+ August 2027), which puts a horizon on this package's CI coverage.
package/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /** Absolute path to the bundle root (contains `lib/` + `girepository-1.0/`). */
3
+ export const bundleDir: string;
4
+ /** Absolute path to the relocated dylib dir (`@loader_path`-linked). */
5
+ export const libDir: string;
6
+ /** Absolute path to the typelib dir (feed to GIRepository.prepend_search_path). */
7
+ export const typelibDir: string;
8
+ /** Whether the bundle payload is actually present on disk (it is built on CI). */
9
+ export const isPresent: boolean;
10
+ declare const _default: { bundleDir: string; libDir: string; typelibDir: string; isPresent: boolean };
11
+ export default _default;
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // @gjsify/gtk-runtime-darwin-x64 — path helpers for the relocated GTK runtime
3
+ // bundle. @gjsify/node-gi resolves this package (optional, os/cpu-gated) to find
4
+ // the bundled typelib + dylib dirs when no Homebrew GTK is present. The heavy
5
+ // `gtk/` payload is produced by ../scripts/build-gtk-runtime-darwin.mjs on an
6
+ // Intel macOS runner.
7
+ //
8
+ // Byte-for-byte the same body as the darwin-arm64 / win32-x64 siblings apart from
9
+ // this header, and deliberately NOT lifted into a shared module: this file IS the
10
+ // package entry (`require.resolve('@gjsify/gtk-runtime-<target>')`), and these
11
+ // tarballs are deliberately dependency-free so a platform-gated install needs no
12
+ // resolution beyond itself. It also carries no arch-dependent logic to drift —
13
+ // every path is relative to this file.
14
+ import { existsSync } from 'node:fs';
15
+ import { dirname, join } from 'node:path';
16
+ import { fileURLToPath } from 'node:url';
17
+
18
+ const here = dirname(fileURLToPath(import.meta.url));
19
+
20
+ /** Absolute path to the bundle root (contains `lib/` + `girepository-1.0/`). */
21
+ export const bundleDir = join(here, 'gtk');
22
+
23
+ /** Absolute path to the relocated dylib dir (`@loader_path`-linked). */
24
+ export const libDir = join(bundleDir, 'lib');
25
+
26
+ /** Absolute path to the typelib dir (feed to GIRepository.prepend_search_path). */
27
+ export const typelibDir = join(bundleDir, 'girepository-1.0');
28
+
29
+ /** Whether the bundle payload is actually present on disk (it is built on CI). */
30
+ export const isPresent = existsSync(typelibDir) && existsSync(libDir);
31
+
32
+ export default { bundleDir, libDir, typelibDir, isPresent };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@gjsify/gtk-runtime-darwin-x64",
3
+ "version": "0.26.1",
4
+ "description": "Batteries-included, relocated GTK/GObject-Introspection runtime bundle for macOS Intel (x64) — lets @gjsify/node-gi load gi:// namespaces (GLib/GObject/Gio/cairo/Pango/Graphene/Gdk) with NO Homebrew GTK. Platform-gated (darwin/x64 only).",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "os": [
8
+ "darwin"
9
+ ],
10
+ "cpu": [
11
+ "x64"
12
+ ],
13
+ "main": "./index.js",
14
+ "types": "./index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./index.d.ts",
18
+ "default": "./index.js"
19
+ },
20
+ "./gtk/girepository-1.0": "./gtk/girepository-1.0",
21
+ "./gtk/lib": "./gtk/lib"
22
+ },
23
+ "files": [
24
+ "index.js",
25
+ "index.d.ts",
26
+ "gtk"
27
+ ],
28
+ "gjsify": {
29
+ "runtimes": {
30
+ "gjs": "none",
31
+ "node": "polyfill",
32
+ "browser": "none",
33
+ "nativescript": "none"
34
+ },
35
+ "tier": 3
36
+ },
37
+ "scripts": {
38
+ "build:bundle": "node ../scripts/build-gtk-runtime-darwin.mjs"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/gjsify/gjsify.git",
43
+ "directory": "packages/node-gi/gtk-runtime-darwin-x64"
44
+ }
45
+ }