@gjsify/napi 0.64.5 → 0.64.6

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 (2) hide show
  1. package/meson.build +29 -8
  2. package/package.json +3 -3
package/meson.build CHANGED
@@ -15,14 +15,36 @@ project('GjsifyNapi', ['c', 'cpp', 'vala'],
15
15
  # exceptions — mozjs-140 has no stable C++ ABI and is built the same way.
16
16
  default_options: ['cpp_std=c++17', 'buildtype=plain'])
17
17
 
18
- dependencies = [
19
- dependency('glib-2.0'),
20
- dependency('gobject-2.0'),
21
- dependency('gio-2.0'),
22
- dependency('gjs-1.0'), # gjs_context_get_current / get_native_context
23
- dependency('mozjs-140'), # JSAPI
18
+ host_system = host_machine.system()
19
+
20
+ # On darwin every GNOME library is resolved against the HOST PROCESS rather than
21
+ # recorded as an `@rpath/` dependency: a second GLib beside the one the host
22
+ # already loaded gives the process two GType registries, then SIGSEGV.
23
+ # docs/prebuilds.md § One GLib. `gjs-1.0` is in the list because its own
24
+ # `--libs` carry `-lglib-2.0 -lgobject-2.0 -lgio-2.0` — stripping only the glib
25
+ # trio would still let ld64 record a GLib load command. It belongs there twice
26
+ # over: this shim runs INSIDE the gjs process, so libgjs is by definition
27
+ # already loaded.
28
+ host_provided = [
29
+ 'glib-2.0',
30
+ 'gobject-2.0',
31
+ 'gio-2.0',
32
+ 'gjs-1.0', # gjs_context_get_current / get_native_context
24
33
  ]
25
34
 
35
+ dependencies = []
36
+ foreach pkg : host_provided
37
+ dep = dependency(pkg)
38
+ dependencies += host_system == 'darwin' \
39
+ ? dep.partial_dependency(compile_args: true, includes: true) \
40
+ : dep
41
+ endforeach
42
+
43
+ # mozjs-140 (JSAPI) pulls no GLib of its own, so it stays an ordinary link dep.
44
+ dependencies += dependency('mozjs-140')
45
+
46
+ host_provided_link_args = host_system == 'darwin' ? ['-Wl,-undefined,dynamic_lookup'] : []
47
+
26
48
  cc = meson.get_compiler('c')
27
49
  dl_dep = cc.find_library('dl', required: false) # dlopen/dlsym/dladdr
28
50
  if dl_dep.found()
@@ -66,7 +88,6 @@ cc_sources = files(
66
88
  # status/open-todos/README.md "N-API host in GJS" cross-platform prebuilds + the `windows` job in
67
89
  # napi.yml) — mozjs-140 is now obtainable (servo/mozjs prebuilt
68
90
  # libmozjs-x86_64-pc-windows-msvc), the open wall is gjs-on-Windows itself.
69
- host_system = host_machine.system()
70
91
  if host_system == 'darwin'
71
92
  export_symbols = meson.current_source_dir() / 'src/cc/napi.exported-symbols.txt'
72
93
  export_link_args = ['-Wl,-exported_symbols_list,' + export_symbols]
@@ -108,7 +129,7 @@ libGjsifyNapi = library('gjsifynapi', vala_sources + cc_sources,
108
129
  vala_args: [
109
130
  '--vapidir=' + meson.current_source_dir() / 'src/vala',
110
131
  ],
111
- link_args: export_link_args,
132
+ link_args: export_link_args + host_provided_link_args,
112
133
  link_depends: export_link_depends,
113
134
  vala_gir: meson.project_name() + '-1.0.gir',
114
135
  install: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/napi",
3
- "version": "0.64.5",
3
+ "version": "0.64.6",
4
4
  "description": "Node-API (N-API) host for GJS — implements the napi C ABI over SpiderMonkey (mozjs-140) so GJS can load unmodified compiled .node addons. The forward mirror of @gjsify/node-gi (GI in Node); this is N-API in GJS. Vala/C++ shim as .so+.gir+.typelib prebuild, loaded via imports.gi.",
5
5
  "type": "module",
6
6
  "main": "lib/esm/index.js",
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/napi/napi#readme",
99
99
  "optionalDependencies": {
100
- "@gjsify/napi-darwin-arm64": "0.64.5",
101
- "@gjsify/napi-linux-x64": "0.64.5"
100
+ "@gjsify/napi-darwin-arm64": "0.64.6",
101
+ "@gjsify/napi-linux-x64": "0.64.6"
102
102
  }
103
103
  }