@gjsify/rolldown-native 0.53.0 → 0.55.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.
Files changed (2) hide show
  1. package/meson.build +48 -7
  2. package/package.json +6 -6
package/meson.build CHANGED
@@ -60,22 +60,62 @@ if host_system == 'darwin'
60
60
  lib_rpath = '@loader_path'
61
61
  # Normalise the cdylib's LC_ID_DYLIB to @rpath/<leaf> BEFORE the Vala
62
62
  # library links against it: ld64 copies the dependency's install name
63
- # verbatim into the dependent's LC_LOAD_DYLIB. rustc's own install name has
64
- # varied across releases (absolute build path in older rustc, @rpath/<leaf>
65
- # in current ones); pinning it here makes the recorded dependency
66
- # rustc-version-independent, and @rpath/ is never longer than an absolute
67
- # path so install_name_tool can always rewrite in place.
68
- rust_cdylib_post = ' && install_name_tool -id "@rpath/' + rust_cdylib_name + '" "$3"'
63
+ # verbatim into the dependent's LC_LOAD_DYLIB. Pinning it here makes the
64
+ # recorded dependency rustc-version-independent, and @rpath/ is never
65
+ # longer than an absolute path so install_name_tool can always rewrite in
66
+ # place.
67
+ #
68
+ # The cdylib must be a FUNCTION OF ITS SOURCES, and on darwin that takes
69
+ # TWO steps, only the first of which `install_name_tool` could do.
70
+ # MEASURED with rustc 1.98.1 / ld64-27037.1 (macOS 27, arm64); the whole
71
+ # measurement and the reasoning behind each step: scripts/macho-set-uuid.mjs.
72
+ #
73
+ # 1. THE INSTALL NAME, at the LINK. rustc still gives a cdylib the ABSOLUTE
74
+ # path of its own output as `LC_ID_DYLIB`
75
+ # (`<builddir>/cargo-target/release/deps/<leaf>`), so the build
76
+ # directory's name and LENGTH reach the artifact: the recorded name, the
77
+ # load-command block's size, and therefore every section address after it.
78
+ # Without this, two builds from `build/` and `builddir/` differ by 8 bytes
79
+ # of pure layout before any content is compared. ld64 takes the LAST
80
+ # `-install_name` (verified), and a `-C link-arg` lands after rustc's own,
81
+ # so this one wins. `install_name_tool` then keeps the recorded dependency
82
+ # rustc-version-independent.
83
+ # 2. THE UUID, after every other edit (the script, which re-signs). ld64
84
+ # computed that field over the image it emitted and `install_name_tool`
85
+ # recomputes neither it nor the signature — and it is not a function of
86
+ # the emitted bytes even so, so pinning the name above still leaves 48
87
+ # moving bytes (16 `LC_UUID` + 32 of the signature hashing it). It is
88
+ # derived from the image instead, so if the CODE ever stops being a
89
+ # function of the sources the UUID moves with it and
90
+ # `check-prebuild-reproducible.mjs` still reds; nothing here hides
91
+ # content drift.
92
+ rust_cargo_link_args = ' -- -C link-arg=-Wl,-install_name,@rpath/' + rust_cdylib_name
93
+ rust_cargo_cmd = 'cargo rustc --lib'
94
+ # The repo's OWN script, from the package's own meson.build — so a bridge
95
+ # built outside the workspace has to say so itself rather than silently
96
+ # skipping the step that makes its artifact reproducible.
97
+ set_uuid_tool = meson.current_source_dir() / '..' / '..' / '..' / 'scripts' / 'macho-set-uuid.mjs'
98
+ rust_cdylib_post = ' && install_name_tool -id "@rpath/' + rust_cdylib_name + '" "$3"' \
99
+ + ' && ' + find_program('node').full_path() + ' "' + set_uuid_tool + '" "$3"'
69
100
  else
70
101
  rust_cdylib_name = 'libgjsify_rolldown.so'
71
102
  shared_lib_name = 'libgjsifyrolldown.so'
72
103
  lib_rpath = '$ORIGIN'
104
+ # ELF records a bare SONAME and no UUID load command, and its link line is
105
+ # already a function of the sources: the darwin branch's steps have no ELF
106
+ # spelling, so this one is left exactly as it was.
107
+ rust_cargo_link_args = ''
108
+ rust_cargo_cmd = 'cargo build'
73
109
  rust_cdylib_post = ''
74
110
  endif
75
111
 
76
112
  # ----------------------------------------------------------------------------
77
113
  # Rust cdylib (cargo)
78
114
  # ----------------------------------------------------------------------------
115
+ # `cargo rustc --lib -- <args>` rather than `cargo build`, so the link args reach
116
+ # the FINAL crate's rustc and no other: the dependency rlibs and any build
117
+ # script are linked without them, and a pinned `-install_name` on an executable
118
+ # is not a thing ld64 wants.
79
119
  cargo = find_program('cargo')
80
120
 
81
121
  rust_sources = files(
@@ -100,7 +140,8 @@ rust_cdylib = custom_target('gjsify-rolldown-rust',
100
140
  input: rust_sources,
101
141
  output: rust_cdylib_name,
102
142
  command: ['sh', '-c',
103
- 'cargo build --release ${CI:+--locked} --manifest-path "$1" --target-dir "$2" && cp "$2/release/'
143
+ rust_cargo_cmd + ' --release ${CI:+--locked} --manifest-path "$1" --target-dir "$2"'
144
+ + rust_cargo_link_args + ' && cp "$2/release/'
104
145
  + rust_cdylib_name + '" "$3"' + rust_cdylib_post,
105
146
  'sh',
106
147
  meson.current_source_dir() / 'src/rust/Cargo.toml',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/rolldown-native",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "description": "Phase D-2 POC: Vala/GObject + Rust cdylib bridge to rolldown for GJS. Wraps `rolldown::Bundler::generate()` (async, tokio) in a per-call current-thread runtime so JS sees a sync `bundle()` call. JSON-encoded BundlerOptions in, JSON-encoded BundleOutput out — the boundary stays small even though rolldown's option surface is enormous. POC scope: no JS plugins (Phase B), no watch/HMR, no incremental builds. Companion to `@gjsify/lightningcss-native`; together they remove the last two Rust-crate runtime blockers from the gjsify build pipeline (Phase D-3 unblock).",
5
5
  "type": "module",
6
6
  "main": "lib/esm/index.js",
@@ -58,7 +58,7 @@
58
58
  "@girs/gobject-2.0": "5.4.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@gjsify/cli": "^0.53.0",
61
+ "@gjsify/cli": "^0.55.0",
62
62
  "@types/node": "^25.9.2",
63
63
  "typescript": "^6.0.3"
64
64
  },
@@ -74,9 +74,9 @@
74
74
  },
75
75
  "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/rolldown-native#readme",
76
76
  "optionalDependencies": {
77
- "@gjsify/rolldown-native-darwin-arm64": "0.53.0",
78
- "@gjsify/rolldown-native-darwin-x64": "0.53.0",
79
- "@gjsify/rolldown-native-linux-arm64": "0.53.0",
80
- "@gjsify/rolldown-native-linux-x64": "0.53.0"
77
+ "@gjsify/rolldown-native-darwin-arm64": "0.55.0",
78
+ "@gjsify/rolldown-native-darwin-x64": "0.55.0",
79
+ "@gjsify/rolldown-native-linux-arm64": "0.55.0",
80
+ "@gjsify/rolldown-native-linux-x64": "0.55.0"
81
81
  }
82
82
  }