beni 0.26.0 → 0.27.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +22 -18
- data/lib/beni/builder.rb +3 -1
- data/lib/beni/dsl/context.rb +1 -5
- data/lib/beni/tasks.rb +1 -1
- data/lib/beni/vendor/toolchains/wasi.rake +11 -9
- data/lib/beni/vendor.rb +21 -9
- data/lib/beni/version.rb +1 -1
- data/sig/beni/dsl/context.rbs +0 -2
- data/sig/beni/vendor.rbs +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dac8da0cd927263034acac8b4d54462b4ca1a9b1821f38612c7851340e31eea5
|
|
4
|
+
data.tar.gz: 62feac9f7b0c27319558b34b29e54d8eee9491fc7251919ec5f7a72b404a3cff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 334a6d039c379ef4937e1c81d623e98bc8529f941149837009bb823d2874a372e5167be7433eb633da5ecefe20d6e26231f895758290ccefa4a1bd9e82b2de18
|
|
7
|
+
data.tar.gz: 78d2dd21747eb7baf024481e9061cf50e62650229fa7d3201cf6a7d0271d632449bede13634404b1e9e73f6e563707505b10c50e6e667bf285bfcdf54e63a2e9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.27.0](https://github.com/elct9620/beni/compare/v0.26.0...v0.27.0) (2026-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **beni-sys:** link a wasm32 archive for the WASI target it was built for ([8fca530](https://github.com/elct9620/beni/commit/8fca5307a20e68bf2f484522c6c09f2c104a05eb))
|
|
9
|
+
* **wasi:** take the WASI target and keep mruby's own wasi toolchain ([fde5584](https://github.com/elct9620/beni/commit/fde5584ff9a6f88190e4f549c1a1e62927733796))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **tasks:** hand the ABI legs' wasi builds the wasi-sdk root beni:build does ([77a628d](https://github.com/elct9620/beni/commit/77a628d3699759d619944fa04ff56267912d0a00))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Performance Improvements
|
|
18
|
+
|
|
19
|
+
* **build:** run mruby's rake with parallel compiles ([0089cee](https://github.com/elct9620/beni/commit/0089ceeab292fc9a7b77854559f3397ad061a3ac))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Reverts
|
|
23
|
+
|
|
24
|
+
* run mruby's rake without parallel compiles ([dce48d5](https://github.com/elct9620/beni/commit/dce48d5615b8823f0af4075065eae208ddf74c68))
|
|
25
|
+
|
|
3
26
|
## [0.26.0](https://github.com/elct9620/beni/compare/v0.25.0...v0.26.0) (2026-11-06)
|
|
4
27
|
|
|
5
28
|
|
data/README.md
CHANGED
|
@@ -107,7 +107,7 @@ fails naming the ones it looked for, rather than handing you a crate
|
|
|
107
107
|
whose every call aborts later. Any C API the typed wrapper does not
|
|
108
108
|
cover stays reachable through the unsafe `beni::sys` escape hatch.
|
|
109
109
|
|
|
110
|
-
### Cross-compile for
|
|
110
|
+
### Cross-compile for WASI
|
|
111
111
|
|
|
112
112
|
Declare a `wasi` target referencing the `wasi-sdk` toolchain:
|
|
113
113
|
|
|
@@ -122,25 +122,29 @@ Beni::Tasks.new do
|
|
|
122
122
|
end
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
and append the cross build to the generated config
|
|
125
|
+
and append the cross build to the generated config. `target:` picks
|
|
126
|
+
the WASI target, `wasm32-wasip1` when omitted:
|
|
126
127
|
|
|
127
128
|
```ruby
|
|
128
129
|
MRuby::CrossBuild.new("wasi") do |conf|
|
|
129
|
-
conf.toolchain :wasi
|
|
130
|
+
conf.toolchain :wasi, target: "wasm32-wasip2"
|
|
130
131
|
end
|
|
131
132
|
```
|
|
132
133
|
|
|
133
|
-
`conf.toolchain :wasi` resolves to
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
| mruby release | `conf.toolchain :wasi` resolves to |
|
|
135
|
+
|---|---|
|
|
136
|
+
| ships its own wasi toolchain file (4.1 onward) | that file, kept as is |
|
|
137
|
+
| ships none | the one `beni:vendor:setup` stages, taking the same `target:` |
|
|
138
|
+
|
|
139
|
+
`rake beni:build` points either file at the vendored wasi-sdk. A
|
|
140
|
+
cross-compiled cargo target never reads the vendor tree, so name the
|
|
141
|
+
staged archive and the wasi-sdk root. Cargo must build for the target
|
|
142
|
+
the archive was built for:
|
|
139
143
|
|
|
140
144
|
```bash
|
|
141
145
|
MRUBY_LIB_DIR=$PWD/vendor/mruby/build/wasi/lib \
|
|
142
146
|
WASI_SDK_PATH=$PWD/vendor/wasi-sdk \
|
|
143
|
-
cargo build --target wasm32-
|
|
147
|
+
cargo build --target wasm32-wasip2
|
|
144
148
|
```
|
|
145
149
|
|
|
146
150
|
### Prism Source
|
|
@@ -167,9 +171,9 @@ The commit is the one the release records for
|
|
|
167
171
|
## Toolchain
|
|
168
172
|
|
|
169
173
|
beni targets plain mruby and is not bound to WebAssembly. `rust-toolchain.toml`
|
|
170
|
-
keeps `wasm32-wasip1` only as
|
|
171
|
-
consumers (kobako). For
|
|
172
|
-
repo and kobako; host builds are unaffected.
|
|
174
|
+
keeps `wasm32-wasip1` and `wasm32-wasip2` only as build-verification targets
|
|
175
|
+
for downstream wasi consumers (kobako). For those targets two versions move in
|
|
176
|
+
lockstep, in both this repo and kobako; host builds are unaffected.
|
|
173
177
|
|
|
174
178
|
| Version | Lockstep reason |
|
|
175
179
|
|---|---|
|
|
@@ -180,13 +184,13 @@ repo and kobako; host builds are unaffected.
|
|
|
180
184
|
|
|
181
185
|
After checking out the repo, run `bin/setup` to install dependencies, then
|
|
182
186
|
`bundle exec rake` for the default gate (tests + RuboCop + Steep). The repo
|
|
183
|
-
dogfoods its own gem: the Rakefile wires `Beni::Tasks` with the
|
|
184
|
-
config `build_config/mruby.rb
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
dogfoods its own gem: the Rakefile wires `Beni::Tasks` with the verification
|
|
188
|
+
config `build_config/mruby.rb`. It builds host, wasm32-wasip1 and
|
|
189
|
+
wasm32-wasip2 archives, and a repo-local rake chain verifies the crates
|
|
190
|
+
against each:
|
|
187
191
|
|
|
188
192
|
```bash
|
|
189
|
-
bundle exec rake rust:verify # beni:build + check/test (host) + check (wasm32)
|
|
193
|
+
bundle exec rake rust:verify # beni:build + check/test (host) + check/link (wasm32)
|
|
190
194
|
```
|
|
191
195
|
|
|
192
196
|
Behavior contracts live in `SPEC.md` — the source of truth the
|
data/lib/beni/builder.rb
CHANGED
|
@@ -130,8 +130,10 @@ module Beni
|
|
|
130
130
|
# the consuming project lives on disk. +MRUBY_CONFIG+ is only set
|
|
131
131
|
# for an explicit config — absent, mruby falls back to its own
|
|
132
132
|
# +build_config/default.rb+ (lib/mruby/build.rb#mruby_config_path).
|
|
133
|
+
# +WASI_SDK_PATH+ is how a wasi toolchain file — beni's or the mruby
|
|
134
|
+
# release's own — finds wasi-sdk.
|
|
133
135
|
def env
|
|
134
|
-
env = { "BENI_VENDOR_DIR" => vendor_dir }
|
|
136
|
+
env = { "BENI_VENDOR_DIR" => vendor_dir, "WASI_SDK_PATH" => Vendor.wasi_sdk_root(vendor_dir:) }
|
|
135
137
|
env["MRUBY_CONFIG"] = build_config if build_config
|
|
136
138
|
env
|
|
137
139
|
end
|
data/lib/beni/dsl/context.rb
CHANGED
|
@@ -99,13 +99,9 @@ module Beni
|
|
|
99
99
|
definition = @definitions[name]
|
|
100
100
|
return SelectedToolchain.new(name: name, version: definition.version, sha256: definition.sha256) if definition
|
|
101
101
|
|
|
102
|
-
version = name == "mruby"
|
|
102
|
+
version = (@settings[:version] if name == "mruby") || Vendor.built_in_version(name)
|
|
103
103
|
SelectedToolchain.new(name: name, version: version, sha256: Vendor.built_in_sha256(name, version))
|
|
104
104
|
end
|
|
105
|
-
|
|
106
|
-
def mruby_version
|
|
107
|
-
@settings[:version] || Vendor::BUILT_IN_PAIRS.fetch("mruby").fetch(:version)
|
|
108
|
-
end
|
|
109
105
|
end
|
|
110
106
|
end
|
|
111
107
|
end
|
data/lib/beni/tasks.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Beni
|
|
|
12
12
|
#
|
|
13
13
|
# Beni::Tasks.new
|
|
14
14
|
#
|
|
15
|
-
# or with declarations (a custom config cross-building to
|
|
15
|
+
# or with declarations (a custom config cross-building to a WASI target):
|
|
16
16
|
#
|
|
17
17
|
# Beni::Tasks.new do
|
|
18
18
|
# build_config "build_config/mruby.rb"
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# beni's wasm32
|
|
4
|
-
#
|
|
5
|
-
# +beni:vendor:setup+
|
|
6
|
-
# activates it with +conf.toolchain :wasi
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
# beni's wasm32 WASI cross-compile toolchain — the wasi toolchain file,
|
|
4
|
+
# staged into the mruby tree's +tasks/toolchains/+ by
|
|
5
|
+
# +beni:vendor:setup+ when the tree holds none of its own. A build
|
|
6
|
+
# config activates it with +conf.toolchain :wasi+, or names another
|
|
7
|
+
# WASI target with +conf.toolchain :wasi, target: "wasm32-wasip2"+ —
|
|
8
|
+
# the parameter mruby's own wasi toolchain file takes.
|
|
9
|
+
MRuby::Toolchain.new(:wasi) do |conf, params|
|
|
10
|
+
# +beni:build+ points WASI_SDK_PATH at the vendored wasi-sdk.
|
|
11
|
+
wasi_sdk = ENV["WASI_SDK_PATH"] || "/opt/wasi-sdk"
|
|
11
12
|
bin = File.join(wasi_sdk, "bin")
|
|
12
|
-
|
|
13
|
+
target = params[:target] || "wasm32-wasip1"
|
|
14
|
+
target_flags = ["--target=#{target}", "--sysroot=#{File.join(wasi_sdk, "share", "wasi-sysroot")}"]
|
|
13
15
|
# setjmp/longjmp via the wasm exception-handling mechanism: these
|
|
14
16
|
# flags go to every compile and the link, and the link adds the
|
|
15
17
|
# setjmp library.
|
data/lib/beni/vendor.rb
CHANGED
|
@@ -26,8 +26,8 @@ module Beni
|
|
|
26
26
|
# digests); mruby's source archive is host-agnostic with a single
|
|
27
27
|
# checksum.
|
|
28
28
|
#
|
|
29
|
-
# wasi-sdk: must be >= 26 for native
|
|
30
|
-
#
|
|
29
|
+
# wasi-sdk: must be >= 26 for native WASI setjmp/longjmp support.
|
|
30
|
+
# 33's +libc.a+ supplies +__wasi_init_tp+, which Rust's
|
|
31
31
|
# wasm32-wasip1 +crt1-command.o+ references from 1.96 onward. Keep in
|
|
32
32
|
# lockstep with the channel in +rust-toolchain.toml+ — in both this
|
|
33
33
|
# repo and kobako.
|
|
@@ -63,6 +63,10 @@ module Beni
|
|
|
63
63
|
"prism" => :prism
|
|
64
64
|
}.freeze
|
|
65
65
|
|
|
66
|
+
# What every wasi toolchain file beni has shipped says about itself,
|
|
67
|
+
# and an mruby release's own does not.
|
|
68
|
+
WASI_TOOLCHAIN_MARK = "beni:vendor:setup"
|
|
69
|
+
|
|
66
70
|
# Where a toolchain staging somewhere other than its own name under
|
|
67
71
|
# the vendor tree unpacks; every other one unpacks at its name.
|
|
68
72
|
STAGED_DIRS = {
|
|
@@ -130,13 +134,18 @@ module Beni
|
|
|
130
134
|
def built_in_version(name)
|
|
131
135
|
BUILT_IN_PAIRS.fetch(name).fetch(:version)
|
|
132
136
|
end
|
|
133
|
-
private_class_method :built_in_version
|
|
134
137
|
|
|
135
138
|
# Where +name+ unpacks, relative to the vendor tree.
|
|
136
139
|
def staged_dir(name)
|
|
137
140
|
STAGED_DIRS.fetch(name, name)
|
|
138
141
|
end
|
|
139
142
|
|
|
143
|
+
# The wasi-sdk root +beni:build+ hands a wasi toolchain file: the
|
|
144
|
+
# caller's +WASI_SDK_PATH+, else the one unpacked in +vendor_dir+.
|
|
145
|
+
def wasi_sdk_root(vendor_dir:)
|
|
146
|
+
ENV.fetch("WASI_SDK_PATH") { File.join(vendor_dir, staged_dir("wasi-sdk")) }
|
|
147
|
+
end
|
|
148
|
+
|
|
140
149
|
# The built-in checksum for +name+ at +version+: the build platform's
|
|
141
150
|
# entry when the toolchain's checksums are platform-keyed, +nil+ for
|
|
142
151
|
# any version other than the vendored one — mruby's TOFU pinning path.
|
|
@@ -154,16 +163,19 @@ module Beni
|
|
|
154
163
|
checksum.fetch(platform) { UnvendoredChecksum.new(name:, version:, platform:) }
|
|
155
164
|
end
|
|
156
165
|
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
#
|
|
166
|
+
# Put a wasi toolchain file in the staged mruby source, where
|
|
167
|
+
# mruby's +conf.toolchain :wasi+ resolves it from. One the tree
|
|
168
|
+
# already holds that beni did not write — an mruby release's own —
|
|
169
|
+
# is kept; otherwise the gem-shipped file is written, so a
|
|
170
|
+
# re-extracted tree or an older beni's copy converges on this
|
|
171
|
+
# release's definition. Returns the staged path.
|
|
162
172
|
def stage_wasi_toolchain_file(vendor_dir:)
|
|
173
|
+
target = File.join(vendor_dir, "mruby", "tasks", "toolchains", "wasi.rake")
|
|
174
|
+
return target if File.exist?(target) && !File.read(target).include?(WASI_TOOLCHAIN_MARK)
|
|
175
|
+
|
|
163
176
|
# `__dir__ || "."`: __dir__ is only nil under eval, which never
|
|
164
177
|
# loads this file; the fallback satisfies steep's String? typing.
|
|
165
178
|
source = File.expand_path("vendor/toolchains/wasi.rake", __dir__ || ".")
|
|
166
|
-
target = File.join(vendor_dir, "mruby", "tasks", "toolchains", "wasi.rake")
|
|
167
179
|
FileUtils.mkdir_p(File.dirname(target))
|
|
168
180
|
FileUtils.cp(source, target)
|
|
169
181
|
target
|
data/lib/beni/version.rb
CHANGED
data/sig/beni/dsl/context.rbs
CHANGED
data/sig/beni/vendor.rbs
CHANGED
|
@@ -5,6 +5,7 @@ module Beni
|
|
|
5
5
|
BUILT_IN_PAIRS: Hash[String, built_in_pair]
|
|
6
6
|
DEPENDENCIES: Hash[String, Array[String]]
|
|
7
7
|
TOOLCHAIN_FACTORIES: Hash[String, Symbol]
|
|
8
|
+
WASI_TOOLCHAIN_MARK: String
|
|
8
9
|
STAGED_DIRS: Hash[String, String]
|
|
9
10
|
SELECTED_BY_DEFINITION: Array[String]
|
|
10
11
|
|
|
@@ -20,6 +21,8 @@ module Beni
|
|
|
20
21
|
|
|
21
22
|
def self?.staged_dir: (String name) -> String
|
|
22
23
|
|
|
24
|
+
def self?.wasi_sdk_root: (vendor_dir: String) -> String
|
|
25
|
+
|
|
23
26
|
def self?.built_in_sha256: (String name, String version, ?String platform) -> (String | UnvendoredChecksum)?
|
|
24
27
|
|
|
25
28
|
def self?.stage_wasi_toolchain_file: (vendor_dir: String) -> String
|