beni 0.13.0 → 0.14.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 +34 -0
- data/README.md +9 -8
- data/lib/beni/builder.rb +62 -27
- data/lib/beni/tasks.rb +2 -2
- data/lib/beni/vendor/tarball.rb +14 -1
- data/lib/beni/vendor.rb +41 -19
- data/lib/beni/version.rb +1 -1
- data/sig/beni/builder.rbs +11 -3
- data/sig/beni/vendor/tarball.rbs +2 -0
- data/sig/beni/vendor.rbs +9 -3
- 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: ca0624d64b327fd094db28953e237a37ba0c4adaa4cd8991cf30ec2cf69e2bd7
|
|
4
|
+
data.tar.gz: efcceca68fe021fbca31612ec4abd5f68bea328ef7bcd8f39da4e0eb76afbe88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 836749b747f2add6ca702b9249fdb91c67c2c58f7ae5459243adf1ad322e796117adb77938518510bba0f9c3418a27d23c717585ec819d3adb0134883d380963
|
|
7
|
+
data.tar.gz: ceac3a0bdeb1f2f6996fc5b651f0af974d046d929b245d7bcb4440081a32d216c6f143ddae665d741b62ef44713f3aa387505dcd863774dc319747083f89f548
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.14.0](https://github.com/elct9620/beni/compare/v0.13.0...v0.14.0) (2026-09-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **beni:** `Range::end_` is now `Range::end`.
|
|
9
|
+
* **beni:** `Mrb::load_bytecode` returns `Result<Value, Error>` instead of `c_int`, and `Mrb::load_irep_buf` is removed — call `load_bytecode`.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **beni-sys:** build for the other macOS architecture ([61b1dc9](https://github.com/elct9620/beni/commit/61b1dc92b36ffd977db5a5a1cb8eb9694d1f8bbd))
|
|
14
|
+
* **beni-sys:** look the archive up under the name its sidecar gives ([135f2d1](https://github.com/elct9620/beni/commit/135f2d17aba19b91dd5b7dffd8874799104f8069))
|
|
15
|
+
* **beni-sys:** read a link set named in either toolchain's form ([c300b73](https://github.com/elct9620/beni/commit/c300b73b56e9924e7dc8654275178d26392872a7))
|
|
16
|
+
* **beni-sys:** read an archive's compile flags in MSVC's spelling ([901ccb3](https://github.com/elct9620/beni/commit/901ccb36f945224e1d8c85b2a8e8b404fd6141b0))
|
|
17
|
+
* **beni:** answer a bytecode load the way every other load does ([f2d5af2](https://github.com/elct9620/beni/commit/f2d5af2244447d43c611fabdaf43316e8cf228b5))
|
|
18
|
+
* **beni:** graduate the Mrb::ensure combinator ([47abf29](https://github.com/elct9620/beni/commit/47abf29d286303ccaab4bac85f29dd35d387fb92))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **beni-sys:** keep the POSIX pre-include off a platform without it ([0d8d50e](https://github.com/elct9620/beni/commit/0d8d50e8f789c3c20f6187cbd50017c188710c5e))
|
|
24
|
+
* **beni-sys:** parse under a standard the archive's own compiler kept ([e80507c](https://github.com/elct9620/beni/commit/e80507c6620643ffb54a1426639e3a5e14eae0ad))
|
|
25
|
+
* **beni:** verify the archive the sidecar names, not one file name ([d53d67c](https://github.com/elct9620/beni/commit/d53d67c48f1bc1d5e07ab87bc050bb48e9e387fa))
|
|
26
|
+
* **coverage:** mark every coverage state the same way ([2a5b19f](https://github.com/elct9620/beni/commit/2a5b19fc7bea2ca6d2a06f37d4c7b44e73b6572d))
|
|
27
|
+
* **rust:** probe for cargo without a lookup tool ([622dbb9](https://github.com/elct9620/beni/commit/622dbb9cbb2ec0354426a7939e0e5a9ccd987cd0))
|
|
28
|
+
* **scenarios:** probe for cargo the way every other harness does ([96d673b](https://github.com/elct9620/beni/commit/96d673bae074204617c8c0a84291d44133b71454))
|
|
29
|
+
* **vendor:** name a build platform beni pins no tarball for ([4dac535](https://github.com/elct9620/beni/commit/4dac53598c4e5d937ee1838eedb31af2e0cb1cd7))
|
|
30
|
+
* **vendor:** name the tarball from the directory it unpacks into ([e10f0c6](https://github.com/elct9620/beni/commit/e10f0c68fb540543feb8260508ac3eaab8f35536))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Code Refactoring
|
|
34
|
+
|
|
35
|
+
* **beni:** name a range's end after what it reads ([fec0c2f](https://github.com/elct9620/beni/commit/fec0c2fe21f84ae9ff2e9c54e3194afbaa364476))
|
|
36
|
+
|
|
3
37
|
## [0.13.0](https://github.com/elct9620/beni/compare/v0.12.0...v0.13.0) (2026-09-08)
|
|
4
38
|
|
|
5
39
|
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
beni gives Rust developers a magnus-like experience for mruby: a Ruby gem
|
|
4
4
|
manages the mruby build chain, and Rust crates expose a safe, typed API over
|
|
5
|
-
the
|
|
5
|
+
the archive it builds. Extracted from the
|
|
6
6
|
[kobako](https://github.com/elct9620/kobako) project; APIs follow 0.x semver
|
|
7
7
|
semantics and may still evolve between minor versions.
|
|
8
8
|
|
|
@@ -17,13 +17,13 @@ All three packages release in lockstep under a single version.
|
|
|
17
17
|
|
|
18
18
|
| Package | Registry | Role |
|
|
19
19
|
|---|---|---|
|
|
20
|
-
| `beni` gem | rubygems.org | Rake tasks + DSL config that download mruby and build
|
|
20
|
+
| `beni` gem | rubygems.org | Rake tasks + DSL config that download mruby and build the archive |
|
|
21
21
|
| `beni-sys` crate | crates.io | bindgen FFI surface over the mruby C API |
|
|
22
22
|
| `beni` crate | crates.io | safe typed wrapper over `beni-sys`, aligned with magnus idioms |
|
|
23
23
|
|
|
24
24
|
## Getting started
|
|
25
25
|
|
|
26
|
-
### Build
|
|
26
|
+
### Build the mruby archive with the gem
|
|
27
27
|
|
|
28
28
|
Add `beni` to your Gemfile and install the task library in your Rakefile:
|
|
29
29
|
|
|
@@ -38,9 +38,10 @@ rake beni:build
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
This downloads the pinned mruby release, builds it with mruby's untouched
|
|
41
|
-
upstream default config, and stages `vendor/mruby/build/host/lib/` with
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
upstream default config, and stages `vendor/mruby/build/host/lib/` with the
|
|
42
|
+
archive and its `libmruby.flags.mak` compile-flags sidecar — everything the
|
|
43
|
+
crates need. The archive's own file name follows the toolchain that built it
|
|
44
|
+
(`libmruby.a`, `libmruby.lib` under MSVC), and the sidecar names it.
|
|
44
45
|
|
|
45
46
|
To tune the build, declare a config path and generate the seed:
|
|
46
47
|
|
|
@@ -151,8 +152,8 @@ After checking out the repo, run `bin/setup` to install dependencies, then
|
|
|
151
152
|
`bundle exec rake` for the default gate (tests + RuboCop + Steep). The repo
|
|
152
153
|
dogfoods its own gem: the Rakefile wires `Beni::Tasks` with the validation
|
|
153
154
|
config `build_config/mruby.rb` (host + wasi targets), and a repo-local rake
|
|
154
|
-
chain verifies the crates compile against a real
|
|
155
|
-
|
|
155
|
+
chain verifies the crates compile against a real archive on both the host
|
|
156
|
+
target and wasm32-wasip1:
|
|
156
157
|
|
|
157
158
|
```bash
|
|
158
159
|
bundle exec rake rust:verify # beni:build + check/test (host) + check (wasm32)
|
data/lib/beni/builder.rb
CHANGED
|
@@ -5,7 +5,7 @@ require "rbconfig"
|
|
|
5
5
|
|
|
6
6
|
module Beni
|
|
7
7
|
# Drives the vendored mruby tree's build to produce the per-target
|
|
8
|
-
#
|
|
8
|
+
# archives, by running mruby's own +Rakefile+ — the
|
|
9
9
|
# documented build entry point (doc/guides/compile.md). With no
|
|
10
10
|
# +build_config+, mruby falls back to its own
|
|
11
11
|
# +build_config/default.rb+; an explicit config is wired in via the
|
|
@@ -13,10 +13,18 @@ module Beni
|
|
|
13
13
|
class Builder
|
|
14
14
|
# mruby's anonymous +MRuby::Build.new+ names its target "host"
|
|
15
15
|
# (lib/mruby/build.rb), so the upstream default config produces
|
|
16
|
-
# +build/host/lib
|
|
17
|
-
#
|
|
16
|
+
# +build/host/lib/+. A custom build config with different target
|
|
17
|
+
# names supplies its own list via +Beni::Tasks+.
|
|
18
18
|
DEFAULT_TARGETS = %w[host].freeze
|
|
19
19
|
|
|
20
|
+
# The sidecar line naming the archive's own path. An archive's file
|
|
21
|
+
# name follows the toolchain that built it, so the sidecar is what
|
|
22
|
+
# says which file to look for.
|
|
23
|
+
ARCHIVE_PATH_KEY = "MRUBY_LIBMRUBY_PATH = "
|
|
24
|
+
|
|
25
|
+
# The sidecar mruby writes beside every archive it builds.
|
|
26
|
+
FLAGS_MAK = "libmruby.flags.mak"
|
|
27
|
+
|
|
20
28
|
attr_reader :vendor_dir, :build_config, :targets
|
|
21
29
|
|
|
22
30
|
def initialize(vendor_dir:, build_config: nil, targets: DEFAULT_TARGETS)
|
|
@@ -29,21 +37,38 @@ module Beni
|
|
|
29
37
|
File.join(vendor_dir, "mruby")
|
|
30
38
|
end
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
# Where one target's archive and its sidecar stage.
|
|
41
|
+
def staged_path(target)
|
|
42
|
+
File.join(mruby_dir, "build", target, "lib")
|
|
34
43
|
end
|
|
35
44
|
|
|
36
|
-
def
|
|
37
|
-
targets.map { |target|
|
|
45
|
+
def staged_paths
|
|
46
|
+
targets.map { |target| staged_path(target) }
|
|
38
47
|
end
|
|
39
48
|
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
# Per-target +libmruby.flags.mak+ file-task paths, matching the
|
|
50
|
+
# task names mruby defines in tasks/libmruby.rake (absolute,
|
|
51
|
+
# anchored on the default +build/<target>+ layout).
|
|
52
|
+
def flags_mak_path(target)
|
|
53
|
+
File.join(staged_path(target), FLAGS_MAK)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# The archive one target's sidecar names, or +nil+ when no sidecar
|
|
57
|
+
# is there to name one.
|
|
58
|
+
def archive_path(target)
|
|
59
|
+
sidecar = flags_mak_path(target)
|
|
60
|
+
return nil unless File.exist?(sidecar)
|
|
61
|
+
|
|
62
|
+
File.join(staged_path(target), archive_file_name(sidecar))
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# True when every target has its +libmruby.flags.mak+ sidecar — the
|
|
66
|
+
# channel +beni-sys+ parses for ABI alignment — and the archive that
|
|
67
|
+
# sidecar names, letting callers skip the build without spawning a
|
|
68
|
+
# subprocess. A missing sidecar triggers a rebuild, which is
|
|
69
|
+
# incremental and only emits what it lacks.
|
|
45
70
|
def built?
|
|
46
|
-
|
|
71
|
+
targets.all? { |target| exist?(archive_path(target)) }
|
|
47
72
|
end
|
|
48
73
|
|
|
49
74
|
# Idempotent build entry point for +rake beni:build+: skip with a
|
|
@@ -53,16 +78,16 @@ module Beni
|
|
|
53
78
|
def ensure_built
|
|
54
79
|
check_build_config!
|
|
55
80
|
if built?
|
|
56
|
-
puts "[beni]
|
|
81
|
+
puts "[beni] archive already present for #{targets.join(" + ")} — skipping"
|
|
57
82
|
return
|
|
58
83
|
end
|
|
59
84
|
|
|
60
85
|
build
|
|
61
|
-
puts "[beni]
|
|
86
|
+
puts "[beni] archive ready for #{targets.join(" + ")}"
|
|
62
87
|
end
|
|
63
88
|
|
|
64
|
-
# Run mruby's rake and raise unless every target's
|
|
65
|
-
#
|
|
89
|
+
# Run mruby's rake and raise unless every target's archive exists
|
|
90
|
+
# afterwards. Alongside the default task, each target's
|
|
66
91
|
# +libmruby.flags.mak+ file task is requested explicitly — mruby's
|
|
67
92
|
# embedder interface recording the exact compile flags, which
|
|
68
93
|
# +beni-sys+'s build script parses to keep bindgen's view of the
|
|
@@ -89,10 +114,18 @@ module Beni
|
|
|
89
114
|
|
|
90
115
|
private
|
|
91
116
|
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
|
|
117
|
+
# The archive's file name, as its sidecar names the path to it.
|
|
118
|
+
# mruby writes that path through a make variable no reader outside
|
|
119
|
+
# make can expand, so the name is what is taken from it.
|
|
120
|
+
def archive_file_name(sidecar)
|
|
121
|
+
line = File.foreach(sidecar).find { |candidate| candidate.start_with?(ARCHIVE_PATH_KEY) }
|
|
122
|
+
raise Error, "[beni] #{sidecar} has no #{ARCHIVE_PATH_KEY.strip} line" unless line
|
|
123
|
+
|
|
124
|
+
File.basename(line.delete_prefix(ARCHIVE_PATH_KEY).strip.tr("\\", "/"))
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def exist?(path)
|
|
128
|
+
!path.nil? && File.exist?(path)
|
|
96
129
|
end
|
|
97
130
|
|
|
98
131
|
# Spawn mruby's rake with the parent environment plus the +env+
|
|
@@ -113,11 +146,8 @@ module Beni
|
|
|
113
146
|
env
|
|
114
147
|
end
|
|
115
148
|
|
|
116
|
-
# Per-target +libmruby.flags.mak+ file-task paths, matching the
|
|
117
|
-
# task names mruby defines in tasks/libmruby.rake (absolute,
|
|
118
|
-
# anchored on the default +build/<target>+ layout).
|
|
119
149
|
def flags_mak_paths
|
|
120
|
-
targets.map { |target|
|
|
150
|
+
targets.map { |target| flags_mak_path(target) }
|
|
121
151
|
end
|
|
122
152
|
|
|
123
153
|
# The declared config belongs to the consumer; a path that does
|
|
@@ -129,9 +159,14 @@ module Beni
|
|
|
129
159
|
end
|
|
130
160
|
|
|
131
161
|
# Report every missing artifact at once, so a multi-target build
|
|
132
|
-
# failure shows the whole gap instead of one path per run.
|
|
162
|
+
# failure shows the whole gap instead of one path per run. A target
|
|
163
|
+
# with no sidecar is reported by the sidecar, which is the artifact
|
|
164
|
+
# naming the other one.
|
|
133
165
|
def verify_artifacts!
|
|
134
|
-
missing =
|
|
166
|
+
missing = targets.flat_map do |target|
|
|
167
|
+
archive = archive_path(target)
|
|
168
|
+
archive.nil? ? [flags_mak_path(target)] : [archive].reject { |path| File.exist?(path) }
|
|
169
|
+
end
|
|
135
170
|
return if missing.empty?
|
|
136
171
|
|
|
137
172
|
raise Error, "[beni] build completed but artifacts are missing:\n #{missing.join("\n ")}"
|
data/lib/beni/tasks.rb
CHANGED
|
@@ -31,7 +31,7 @@ module Beni
|
|
|
31
31
|
#
|
|
32
32
|
# Defined tasks:
|
|
33
33
|
#
|
|
34
|
-
# rake beni:build — fetch toolchains + build
|
|
34
|
+
# rake beni:build — fetch toolchains + build the archive per target
|
|
35
35
|
# rake beni:clean — remove mruby build trees (keeps source)
|
|
36
36
|
# rake beni:config — generate the upstream default build config
|
|
37
37
|
# rake beni:vendor:setup — download & unpack the selected toolchains
|
|
@@ -126,7 +126,7 @@ module Beni
|
|
|
126
126
|
|
|
127
127
|
def define_build_task
|
|
128
128
|
desc "Build vendored mruby for #{configuration.targets.join(" + ")} " \
|
|
129
|
-
"(
|
|
129
|
+
"(stages the archive and its compile-flags sidecar in #{builder.staged_paths.join(", ")})"
|
|
130
130
|
task build: "vendor:setup" do
|
|
131
131
|
builder.ensure_built
|
|
132
132
|
end
|
data/lib/beni/vendor/tarball.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "fileutils"
|
|
4
|
+
require "pathname"
|
|
4
5
|
|
|
5
6
|
module Beni
|
|
6
7
|
module Vendor
|
|
@@ -53,7 +54,19 @@ module Beni
|
|
|
53
54
|
def extract_to_staging(staging)
|
|
54
55
|
FileUtils.rm_rf(staging)
|
|
55
56
|
FileUtils.mkdir_p(staging)
|
|
56
|
-
|
|
57
|
+
# An absolute Windows path opens with a drive letter, which GNU
|
|
58
|
+
# tar reads as the host half of a +host:path+ remote spec and
|
|
59
|
+
# tries to connect to. Naming the tarball from the directory it
|
|
60
|
+
# unpacks into leaves no colon for any tar to find.
|
|
61
|
+
from_staging = Pathname.new(@tarball).relative_path_from(Pathname.new(staging))
|
|
62
|
+
run_tar(from_staging.to_s, staging)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Spawn tar with the staging directory as its working directory.
|
|
66
|
+
# Extracted as a seam so tests can observe the argument shape
|
|
67
|
+
# without unpacking anything.
|
|
68
|
+
def run_tar(tarball, staging)
|
|
69
|
+
system("tar", "-xzf", tarball, chdir: staging, exception: true)
|
|
57
70
|
end
|
|
58
71
|
|
|
59
72
|
# Move the expected +top_level_dir+ subtree out of +staging+ into
|
data/lib/beni/vendor.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Beni
|
|
|
21
21
|
# ---- Built-in pairs ----------------------------------------------------
|
|
22
22
|
# The version and checksum pair this release vendors per toolchain.
|
|
23
23
|
# wasi-sdk ships one tarball per build platform, so its checksum is
|
|
24
|
-
# keyed by +
|
|
24
|
+
# keyed by +BUILD_PLATFORM+ (values from the GitHub release asset
|
|
25
25
|
# digests); mruby's source archive is host-agnostic with a single
|
|
26
26
|
# checksum.
|
|
27
27
|
#
|
|
@@ -50,21 +50,34 @@ module Beni
|
|
|
50
50
|
# task-definition time: referencing wasi-sdk implies mruby.
|
|
51
51
|
DEPENDENCIES = { "wasi-sdk" => %w[mruby] }.freeze
|
|
52
52
|
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
# +RUBY_PLATFORM+ spells the same architecture and operating system
|
|
54
|
+
# differently across hosts; toolchains key their per-platform tarballs
|
|
55
|
+
# by one spelling each.
|
|
56
|
+
ARCH_ALIASES = { "x64" => "x86_64", "amd64" => "x86_64", "aarch64" => "arm64" }.freeze
|
|
57
|
+
OS_ALIASES = { /darwin/ => "macos", /linux/ => "linux", /mingw|mswin/ => "windows" }.freeze
|
|
58
|
+
|
|
59
|
+
# The build platform: the architecture and operating system the Rake
|
|
60
|
+
# tasks run on, spelled the way toolchains key their tarballs. Derived
|
|
61
|
+
# from the host rather than matched against a covered set, so a host no
|
|
62
|
+
# toolchain vendors a tarball for still has a name to be named in.
|
|
63
|
+
def self.build_platform(platform = RUBY_PLATFORM)
|
|
64
|
+
"#{platform_arch(platform)}-#{platform_os(platform)}"
|
|
64
65
|
end
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
def self.platform_arch(platform)
|
|
68
|
+
arch = platform.split("-").first.to_s
|
|
69
|
+
ARCH_ALIASES.fetch(arch, arch)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def self.platform_os(platform)
|
|
73
|
+
OS_ALIASES.find { |pattern, _| pattern.match?(platform) }&.last ||
|
|
74
|
+
platform.split("-")[1].to_s
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
private_class_method :platform_arch, :platform_os
|
|
78
|
+
|
|
79
|
+
# The build platform, resolved once at load.
|
|
80
|
+
BUILD_PLATFORM = build_platform
|
|
68
81
|
|
|
69
82
|
# Known toolchain names mapped to their factory methods — the name
|
|
70
83
|
# domain the DSL validates against and +Beni::Tasks+ dispatches on.
|
|
@@ -81,10 +94,10 @@ module Beni
|
|
|
81
94
|
# full version plus the platform.
|
|
82
95
|
Toolchain.new(
|
|
83
96
|
name: "wasi-sdk",
|
|
84
|
-
version_label: "#{version} (#{
|
|
97
|
+
version_label: "#{version} (#{BUILD_PLATFORM})",
|
|
85
98
|
base_url: "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-#{version.split(".").first}",
|
|
86
|
-
tarball_name: "wasi-sdk-#{version}-#{
|
|
87
|
-
top_level_dir: "wasi-sdk-#{version}-#{
|
|
99
|
+
tarball_name: "wasi-sdk-#{version}-#{BUILD_PLATFORM}.tar.gz",
|
|
100
|
+
top_level_dir: "wasi-sdk-#{version}-#{BUILD_PLATFORM}",
|
|
88
101
|
vendor_dir: vendor_dir,
|
|
89
102
|
expected_sha256: sha256 || built_in_sha256("wasi-sdk", version)
|
|
90
103
|
)
|
|
@@ -116,12 +129,21 @@ module Beni
|
|
|
116
129
|
# The built-in checksum for +name+ at +version+: the build platform's
|
|
117
130
|
# entry when the toolchain's checksums are platform-keyed, +nil+ for
|
|
118
131
|
# any version other than the vendored one — mruby's TOFU pinning path.
|
|
119
|
-
|
|
132
|
+
# A platform-keyed pair carrying no entry for +platform+ vendors no
|
|
133
|
+
# tarball there, and says so rather than letting another platform's
|
|
134
|
+
# checksum stand in.
|
|
135
|
+
def built_in_sha256(name, version, platform = BUILD_PLATFORM)
|
|
120
136
|
pair = BUILT_IN_PAIRS.fetch(name)
|
|
121
137
|
return nil unless version == pair.fetch(:version)
|
|
122
138
|
|
|
123
139
|
checksum = pair.fetch(:sha256)
|
|
124
|
-
checksum.is_a?(Hash)
|
|
140
|
+
return checksum unless checksum.is_a?(Hash)
|
|
141
|
+
|
|
142
|
+
checksum.fetch(platform) do
|
|
143
|
+
raise Error, "[beni] #{name} #{version} vendors no tarball for build platform " \
|
|
144
|
+
"#{platform}; declare the toolchain with its own version and sha256 " \
|
|
145
|
+
"to name one beni does not pin here"
|
|
146
|
+
end
|
|
125
147
|
end
|
|
126
148
|
|
|
127
149
|
# Write the gem-shipped wasi toolchain file into the staged mruby
|
data/lib/beni/version.rb
CHANGED
data/sig/beni/builder.rbs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
module Beni
|
|
2
2
|
class Builder
|
|
3
3
|
DEFAULT_TARGETS: Array[String]
|
|
4
|
+
ARCHIVE_PATH_KEY: String
|
|
5
|
+
FLAGS_MAK: String
|
|
4
6
|
|
|
5
7
|
attr_reader vendor_dir: String
|
|
6
8
|
attr_reader build_config: String?
|
|
@@ -10,9 +12,13 @@ module Beni
|
|
|
10
12
|
|
|
11
13
|
def mruby_dir: () -> String
|
|
12
14
|
|
|
13
|
-
def
|
|
15
|
+
def staged_path: (String target) -> String
|
|
14
16
|
|
|
15
|
-
def
|
|
17
|
+
def staged_paths: () -> Array[String]
|
|
18
|
+
|
|
19
|
+
def flags_mak_path: (String target) -> String
|
|
20
|
+
|
|
21
|
+
def archive_path: (String target) -> String?
|
|
16
22
|
|
|
17
23
|
def built?: () -> bool
|
|
18
24
|
|
|
@@ -24,7 +30,9 @@ module Beni
|
|
|
24
30
|
|
|
25
31
|
private
|
|
26
32
|
|
|
27
|
-
def
|
|
33
|
+
def archive_file_name: (String sidecar) -> String
|
|
34
|
+
|
|
35
|
+
def exist?: (String? path) -> bool
|
|
28
36
|
|
|
29
37
|
def run_mruby_rake: (Hash[String, String] env, Array[String] cmd) -> void
|
|
30
38
|
|
data/sig/beni/vendor/tarball.rbs
CHANGED
data/sig/beni/vendor.rbs
CHANGED
|
@@ -4,10 +4,16 @@ module Beni
|
|
|
4
4
|
|
|
5
5
|
BUILT_IN_PAIRS: Hash[String, built_in_pair]
|
|
6
6
|
DEPENDENCIES: Hash[String, Array[String]]
|
|
7
|
-
|
|
7
|
+
ARCH_ALIASES: Hash[String, String]
|
|
8
|
+
OS_ALIASES: Hash[Regexp, String]
|
|
9
|
+
BUILD_PLATFORM: String
|
|
8
10
|
TOOLCHAIN_FACTORIES: Hash[String, Symbol]
|
|
9
11
|
|
|
10
|
-
def self.
|
|
12
|
+
def self.build_platform: (?String platform) -> String
|
|
13
|
+
|
|
14
|
+
def self.platform_arch: (String platform) -> String
|
|
15
|
+
|
|
16
|
+
def self.platform_os: (String platform) -> String
|
|
11
17
|
|
|
12
18
|
def self?.wasi_sdk: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
|
|
13
19
|
|
|
@@ -15,7 +21,7 @@ module Beni
|
|
|
15
21
|
|
|
16
22
|
def self?.base_url_for: (String default) -> String
|
|
17
23
|
|
|
18
|
-
def self?.built_in_sha256: (String name, String version) -> String?
|
|
24
|
+
def self?.built_in_sha256: (String name, String version, ?String platform) -> String?
|
|
19
25
|
|
|
20
26
|
def self?.stage_wasi_toolchain_file: (vendor_dir: String) -> String
|
|
21
27
|
end
|