@gjsify/gtk-runtime-darwin-arm64 0.21.0 → 0.22.0

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.
package/gtk/manifest.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "platform": "darwin-arm64",
3
+ "windowing": false,
3
4
  "generatedFrom": "/opt/homebrew",
4
5
  "dylibs": 45,
5
6
  "typelibs": 38,
6
7
  "libBytes": 29101712,
7
8
  "typelibBytes": 2342100,
9
+ "dataBytes": 0,
8
10
  "totalBytes": 31443812,
9
11
  "dylibList": [
10
12
  "libX11.6.dylib",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/gtk-runtime-darwin-arm64",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Batteries-included, relocated GTK/GObject-Introspection runtime bundle for macOS arm64 — lets @gjsify/node-gi load gi:// namespaces (GLib/GObject/Gio/cairo/Pango/Graphene/Gdk) with NO Homebrew GTK. Platform-gated (darwin/arm64 only).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -195,6 +195,84 @@ if (existsSync(brewTypelibs)) {
195
195
  }
196
196
  console.log(`build-gtk-runtime: copied ${typelibCount} typelibs`);
197
197
 
198
+ // --- 3b. WINDOWING data (schemas / icons / gtksource) ---------------------
199
+ // The runtime DATA a REAL app needs beyond the dylibs+typelibs: compiled GSettings
200
+ // schemas (Gio.Settings — a HARD startup blocker without them), the Adwaita/hicolor
201
+ // icon themes, and GtkSource's language-specs/styles. These are plain files (no dylib
202
+ // relocation), located at runtime via GSETTINGS_SCHEMA_DIR / XDG_DATA_DIRS (node-gi's
203
+ // gtk-runtime.js maybeWireGtkWindowingEnv keys on the gschemas.compiled marker). Gated
204
+ // on --windowing; the display-free bundle is byte-unchanged. NB the gdk-pixbuf image
205
+ // LOADERS (needed to render SVG symbolic icons) are NOT bundled yet — they are dylibs
206
+ // that need @loader_path relocation from a NESTED dir (unlike win32's plain DLL copy);
207
+ // tracked follow-up, so symbolic icons may be blank until then.
208
+ const windowing = { schemas: false, iconThemes: [], gtksource: false };
209
+ if (WINDOWING) {
210
+ const brewShare = join(brewPrefix, 'share');
211
+ const findTool = (leaf) => {
212
+ const inBrew = join(brewPrefix, 'bin', leaf);
213
+ return existsSync(inBrew) ? inBrew : leaf; // fall back to PATH
214
+ };
215
+
216
+ // 3b-a. Compiled GSettings schemas + (re)compile gschemas.compiled — also the
217
+ // windowing-data marker node-gi's loader detects.
218
+ const schemasSrc = join(brewShare, 'glib-2.0', 'schemas');
219
+ if (existsSync(schemasSrc)) {
220
+ const schemasOut = join(OUT, 'share', 'glib-2.0', 'schemas');
221
+ mkdirSync(schemasOut, { recursive: true });
222
+ for (const f of readdirSync(schemasSrc)) {
223
+ if (f.endsWith('.xml') || f.endsWith('.gschema.override') || f === 'gschemas.compiled') {
224
+ copyFileSync(join(schemasSrc, f), join(schemasOut, f));
225
+ }
226
+ }
227
+ try {
228
+ execFileSync(findTool('glib-compile-schemas'), [schemasOut]);
229
+ } catch (err) {
230
+ console.warn(`build-gtk-runtime: WARNING — glib-compile-schemas failed: ${err?.message ?? err}`);
231
+ }
232
+ windowing.schemas = existsSync(join(schemasOut, 'gschemas.compiled'));
233
+ console.log(`build-gtk-runtime: GSettings schemas ${windowing.schemas ? 'compiled' : 'copied (no gschemas.compiled!)'}`);
234
+ } else {
235
+ console.warn(`build-gtk-runtime: WARNING — ${schemasSrc} missing; GSettings schemas NOT bundled (Gio.Settings will fail)`);
236
+ }
237
+
238
+ // 3b-b. Icon themes (Adwaita symbolic + hicolor) + caches, loaded from
239
+ // XDG_DATA_DIRS/icons/<theme>/.
240
+ const updateIconCache = findTool('gtk4-update-icon-cache');
241
+ for (const theme of ['Adwaita', 'hicolor']) {
242
+ const themeSrc = join(brewShare, 'icons', theme);
243
+ if (!existsSync(themeSrc)) continue;
244
+ cpSync(themeSrc, join(OUT, 'share', 'icons', theme), { recursive: true });
245
+ try {
246
+ execFileSync(updateIconCache, ['-q', '-t', '-f', join(OUT, 'share', 'icons', theme)]);
247
+ } catch {
248
+ // an existing icon-theme.cache from the copy is a usable fallback
249
+ }
250
+ windowing.iconThemes.push(theme);
251
+ }
252
+ console.log(
253
+ windowing.iconThemes.length
254
+ ? `build-gtk-runtime: icon themes ${windowing.iconThemes.join(', ')}`
255
+ : 'build-gtk-runtime: WARNING — no Adwaita/hicolor icon theme under share/icons',
256
+ );
257
+
258
+ // 3b-c. GtkSource-5 language-specs + styles (the editor's syntax highlighting).
259
+ const gtksourceSrc = join(brewShare, 'gtksourceview-5');
260
+ if (existsSync(gtksourceSrc)) {
261
+ let copied = 0;
262
+ for (const sub of ['language-specs', 'styles']) {
263
+ const subSrc = join(gtksourceSrc, sub);
264
+ if (existsSync(subSrc)) {
265
+ cpSync(subSrc, join(OUT, 'share', 'gtksourceview-5', sub), { recursive: true });
266
+ copied += readdirSync(subSrc).length;
267
+ }
268
+ }
269
+ windowing.gtksource = copied > 0;
270
+ console.log(`build-gtk-runtime: GtkSource-5 data ${windowing.gtksource ? `bundled (${copied} files)` : 'empty'}`);
271
+ } else {
272
+ console.warn(`build-gtk-runtime: WARNING — ${gtksourceSrc} missing; GtkSource-5 data NOT bundled`);
273
+ }
274
+ }
275
+
198
276
  // --- 4. optional: relocate a copy of the node-gi addon --------------------
199
277
  // The addon (built against Homebrew) carries absolute /opt/homebrew refs. Rewrite
200
278
  // them to @rpath/<leaf> + add an rpath to the SIBLING bundle so it loads the
@@ -237,15 +315,20 @@ function dirSize(dir) {
237
315
  }
238
316
  const libBytes = dirSize(libOut);
239
317
  const typelibBytes = dirSize(typelibOut);
318
+ const shareOut = join(OUT, 'share');
319
+ const dataBytes = WINDOWING && existsSync(shareOut) ? dirSize(shareOut) : 0;
240
320
  const manifest = {
241
321
  platform: 'darwin-arm64',
322
+ windowing: WINDOWING,
242
323
  generatedFrom: brewPrefix,
243
324
  dylibs: bundledLeaves.size,
244
325
  typelibs: typelibCount,
245
326
  libBytes,
246
327
  typelibBytes,
247
- totalBytes: libBytes + typelibBytes,
328
+ dataBytes,
329
+ totalBytes: libBytes + typelibBytes + dataBytes,
248
330
  dylibList: [...bundledLeaves].sort(),
331
+ ...(WINDOWING ? { windowingData: windowing } : {}),
249
332
  };
250
333
  writeFileSync(join(OUT, 'manifest.json'), JSON.stringify(manifest, null, 2));
251
334