ruby_wasm 2.7.2 → 2.9.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/CONTRIBUTING.md +2 -2
- data/Cargo.lock +13 -13
- data/Gemfile +1 -0
- data/README.md +16 -11
- data/Rakefile +9 -13
- data/docs/cheat_sheet.md +11 -11
- data/docs/faq.md +2 -2
- data/ext/ruby_wasm/Cargo.toml +1 -1
- data/ext/ruby_wasm/src/lib.rs +62 -102
- data/lib/ruby_wasm/build/executor.rb +10 -0
- data/lib/ruby_wasm/build/product/crossruby.rb +19 -1
- data/lib/ruby_wasm/build/toolchain.rb +144 -50
- data/lib/ruby_wasm/build.rb +1 -1
- data/lib/ruby_wasm/cli.rb +88 -44
- data/lib/ruby_wasm/packager/core.rb +1 -1
- data/lib/ruby_wasm/packager.rb +1 -1
- data/lib/ruby_wasm/version.rb +1 -1
- data/package-lock.json +26 -12
- data/rakelib/ci.rake +4 -2
- data/rakelib/packaging.rake +11 -9
- data/sig/ruby_wasm/build.rbs +34 -13
- data/sig/ruby_wasm/cli.rbs +2 -2
- data/sig/ruby_wasm/packager.rbs +2 -11
- metadata +3 -6
|
@@ -204,7 +204,7 @@ module RubyWasm
|
|
|
204
204
|
def build(executor, remake: false, reconfigure: false)
|
|
205
205
|
executor.mkdir_p dest_dir
|
|
206
206
|
executor.mkdir_p build_dir
|
|
207
|
-
@toolchain.install
|
|
207
|
+
@toolchain.install(executor)
|
|
208
208
|
[@source, @baseruby, @libyaml, @zlib, @openssl, @wasi_vfs].each do |prod|
|
|
209
209
|
next unless prod
|
|
210
210
|
executor.begin_section prod.class, prod.name, "Building"
|
|
@@ -322,6 +322,10 @@ module RubyWasm
|
|
|
322
322
|
File.join(@baseruby.install_dir, "bin/ruby")
|
|
323
323
|
end
|
|
324
324
|
|
|
325
|
+
def dump_ast_path
|
|
326
|
+
File.join(@baseruby.product_build_dir, "dump_ast")
|
|
327
|
+
end
|
|
328
|
+
|
|
325
329
|
def configure_args(build_triple, toolchain)
|
|
326
330
|
target = @params.target.triple
|
|
327
331
|
default_exts = @params.default_exts
|
|
@@ -336,6 +340,9 @@ module RubyWasm
|
|
|
336
340
|
args << %Q(--with-zlib-dir=#{@zlib.install_root})
|
|
337
341
|
args << %Q(--with-openssl-dir=#{@openssl.install_root}) if @openssl
|
|
338
342
|
args << %Q(--with-baseruby=#{baseruby_path})
|
|
343
|
+
# Use the host-built dump_ast so cross builds don't try to execute the
|
|
344
|
+
# target-side wasm dump_ast while generating .rbinc files.
|
|
345
|
+
args << %Q(--with-dump-ast=#{dump_ast_path})
|
|
339
346
|
|
|
340
347
|
case target
|
|
341
348
|
when /^wasm32-unknown-wasi/
|
|
@@ -345,6 +352,17 @@ module RubyWasm
|
|
|
345
352
|
wasi_sdk_path = @toolchain
|
|
346
353
|
args << %Q(WASMOPT=#{wasi_sdk_path.wasm_opt})
|
|
347
354
|
args << %Q(WASI_SDK_PATH=#{wasi_sdk_path.wasi_sdk_path})
|
|
355
|
+
# NOTE: wasi-libc 22 and later defines stubs for fchmod and chmod
|
|
356
|
+
# but they just return ENOTSUP, and ruby's configure doesn't check
|
|
357
|
+
# the runtime behavior. So we need to tell configure that
|
|
358
|
+
# these functions are not available.
|
|
359
|
+
# https://github.com/WebAssembly/wasi-libc/pull/463
|
|
360
|
+
args << %Q(ac_cv_func_fchmod=no)
|
|
361
|
+
args << %Q(ac_cv_func_chmod=no)
|
|
362
|
+
# TODO: wasi-libc 22 and later started using musl's realpath impl but
|
|
363
|
+
# it broke Kernel#require on @bjorn3/browser_wasi_shim setup for some
|
|
364
|
+
# reason. So we disable it for now.
|
|
365
|
+
args << %Q(ac_cv_func_realpath=no)
|
|
348
366
|
when "wasm32-unknown-emscripten"
|
|
349
367
|
ldflags.concat(%w[-s MODULARIZE=1])
|
|
350
368
|
env_emcc_ldflags = ENV["RUBY_WASM_EMCC_LDFLAGS"] || ""
|
|
@@ -16,10 +16,15 @@ module RubyWasm
|
|
|
16
16
|
raise "missing environment variable: #{name}" if ENV[name].nil?
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def self.get(target, build_dir = nil)
|
|
19
|
+
def self.get(target, options, build_dir = nil)
|
|
20
20
|
case target
|
|
21
21
|
when /^wasm32-unknown-wasi/
|
|
22
|
-
return
|
|
22
|
+
return(
|
|
23
|
+
RubyWasm::WASISDK.new(
|
|
24
|
+
build_dir: build_dir,
|
|
25
|
+
version: options[:wasi_sdk_version]
|
|
26
|
+
)
|
|
27
|
+
)
|
|
23
28
|
when "wasm32-unknown-emscripten"
|
|
24
29
|
return RubyWasm::Emscripten.new
|
|
25
30
|
else
|
|
@@ -56,32 +61,24 @@ module RubyWasm
|
|
|
56
61
|
def initialize(
|
|
57
62
|
wasi_sdk_path = ENV["WASI_SDK_PATH"],
|
|
58
63
|
build_dir: nil,
|
|
59
|
-
|
|
60
|
-
version_minor: 0,
|
|
64
|
+
version: "23.0",
|
|
61
65
|
binaryen_version: 108
|
|
62
66
|
)
|
|
63
|
-
@wasm_opt_path = Toolchain.find_path("wasm-opt")
|
|
64
67
|
@need_fetch_wasi_sdk = wasi_sdk_path.nil?
|
|
65
|
-
@need_fetch_binaryen = @wasm_opt_path.nil?
|
|
66
|
-
|
|
67
68
|
if @need_fetch_wasi_sdk
|
|
68
69
|
if build_dir.nil?
|
|
69
70
|
raise "build_dir is required when WASI_SDK_PATH is not set"
|
|
70
71
|
end
|
|
71
|
-
wasi_sdk_path = File.join(build_dir, "toolchain", "wasi-sdk")
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
if @need_fetch_binaryen
|
|
77
|
-
if build_dir.nil?
|
|
78
|
-
raise "build_dir is required when wasm-opt not installed in PATH"
|
|
72
|
+
wasi_sdk_path = File.join(build_dir, "toolchain", "wasi-sdk-#{version}")
|
|
73
|
+
if version.nil?
|
|
74
|
+
raise "version is required when WASI_SDK_PATH is not set"
|
|
79
75
|
end
|
|
80
|
-
@
|
|
81
|
-
@binaryen_version = binaryen_version
|
|
82
|
-
@wasm_opt_path = File.join(@binaryen_path, "bin", "wasm-opt")
|
|
76
|
+
@version = version
|
|
83
77
|
end
|
|
84
78
|
|
|
79
|
+
@binaryen =
|
|
80
|
+
Binaryen.new(build_dir: build_dir, binaryen_version: binaryen_version)
|
|
81
|
+
|
|
85
82
|
@tools = {
|
|
86
83
|
cc: "#{wasi_sdk_path}/bin/clang",
|
|
87
84
|
cxx: "#{wasi_sdk_path}/bin/clang++",
|
|
@@ -101,27 +98,127 @@ module RubyWasm
|
|
|
101
98
|
end
|
|
102
99
|
|
|
103
100
|
def wasm_opt
|
|
104
|
-
@
|
|
101
|
+
@binaryen.wasm_opt
|
|
105
102
|
end
|
|
106
103
|
|
|
107
104
|
def wasi_sdk_path
|
|
108
105
|
@wasi_sdk_path
|
|
109
106
|
end
|
|
110
107
|
|
|
111
|
-
def download_url
|
|
112
|
-
|
|
108
|
+
def download_url
|
|
109
|
+
major, _ = @version.split(".").map(&:to_i)
|
|
110
|
+
# @type var assets: Array[[Regexp, Array[String]]]
|
|
113
111
|
assets = [
|
|
114
|
-
[
|
|
115
|
-
|
|
112
|
+
[
|
|
113
|
+
/x86_64-linux/,
|
|
114
|
+
[
|
|
115
|
+
"wasi-sdk-#{@version}-x86_64-linux.tar.gz",
|
|
116
|
+
# For wasi-sdk version < 23.0
|
|
117
|
+
"wasi-sdk-#{@version}-linux.tar.gz"
|
|
118
|
+
]
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
/arm64e?-darwin/,
|
|
122
|
+
[
|
|
123
|
+
"wasi-sdk-#{@version}-arm64-macos.tar.gz",
|
|
124
|
+
# For wasi-sdk version < 23.0
|
|
125
|
+
"wasi-sdk-#{@version}-macos.tar.gz"
|
|
126
|
+
]
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
/x86_64-darwin/,
|
|
130
|
+
[
|
|
131
|
+
"wasi-sdk-#{@version}-x86_64-macos.tar.gz",
|
|
132
|
+
# For wasi-sdk version < 23.0
|
|
133
|
+
"wasi-sdk-#{@version}-macos.tar.gz"
|
|
134
|
+
]
|
|
135
|
+
]
|
|
116
136
|
]
|
|
117
|
-
asset = assets.find { |os,
|
|
137
|
+
asset = assets.find { |os, candidates| os =~ RUBY_PLATFORM }
|
|
118
138
|
if asset.nil?
|
|
119
139
|
raise "unsupported platform for fetching WASI SDK: #{RUBY_PLATFORM}"
|
|
120
140
|
end
|
|
121
|
-
|
|
141
|
+
_, candidates = asset
|
|
142
|
+
candidates_urls =
|
|
143
|
+
candidates.map do |candidate|
|
|
144
|
+
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-#{major}/#{candidate}"
|
|
145
|
+
end
|
|
146
|
+
require "net/http"
|
|
147
|
+
# Find an asset that exists by checking HEAD response to see if the asset exists
|
|
148
|
+
candidates_urls.each do |url_str|
|
|
149
|
+
# @type var url: URI::HTTPS
|
|
150
|
+
url = URI.parse(url_str)
|
|
151
|
+
ok =
|
|
152
|
+
__skip__ = Net::HTTP.start(
|
|
153
|
+
url.host,
|
|
154
|
+
url.port,
|
|
155
|
+
use_ssl: url.scheme == "https"
|
|
156
|
+
) do |http|
|
|
157
|
+
response = http.head(url.request_uri)
|
|
158
|
+
next response.code == "302"
|
|
159
|
+
end
|
|
160
|
+
return url_str if ok
|
|
161
|
+
end
|
|
162
|
+
raise "WASI SDK asset not found: #{candidates_urls.join(", ")}"
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def install_wasi_sdk(executor)
|
|
166
|
+
return unless @need_fetch_wasi_sdk
|
|
167
|
+
wasi_sdk_tarball =
|
|
168
|
+
File.join(File.dirname(@wasi_sdk_path), "wasi-sdk-#{@version}.tar.gz")
|
|
169
|
+
unless File.exist? wasi_sdk_tarball
|
|
170
|
+
FileUtils.mkdir_p File.dirname(wasi_sdk_tarball)
|
|
171
|
+
executor.system "curl",
|
|
172
|
+
"-fsSL",
|
|
173
|
+
"-o",
|
|
174
|
+
wasi_sdk_tarball,
|
|
175
|
+
self.download_url
|
|
176
|
+
end
|
|
177
|
+
unless File.exist? @wasi_sdk_path
|
|
178
|
+
FileUtils.mkdir_p @wasi_sdk_path
|
|
179
|
+
executor.system "tar",
|
|
180
|
+
"-C",
|
|
181
|
+
@wasi_sdk_path,
|
|
182
|
+
"--strip-component",
|
|
183
|
+
"1",
|
|
184
|
+
"-xzf",
|
|
185
|
+
wasi_sdk_tarball
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def install(executor)
|
|
190
|
+
install_wasi_sdk(executor)
|
|
191
|
+
@binaryen.install(executor)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
class Binaryen
|
|
196
|
+
def initialize(build_dir: nil, binaryen_version: 108)
|
|
197
|
+
@wasm_opt_path = Toolchain.find_path("wasm-opt")
|
|
198
|
+
@need_fetch_binaryen = @wasm_opt_path.nil?
|
|
199
|
+
if @need_fetch_binaryen
|
|
200
|
+
if build_dir.nil?
|
|
201
|
+
raise "build_dir is required when wasm-opt not installed in PATH"
|
|
202
|
+
end
|
|
203
|
+
@binaryen_path = File.join(build_dir, "toolchain", "binaryen")
|
|
204
|
+
@binaryen_version = binaryen_version
|
|
205
|
+
@wasm_opt_path = File.join(@binaryen_path, "bin", "wasm-opt")
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def wasm_opt
|
|
210
|
+
@wasm_opt_path
|
|
122
211
|
end
|
|
123
212
|
|
|
124
|
-
def
|
|
213
|
+
def binaryen_path
|
|
214
|
+
@binaryen_path
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def binaryen_version
|
|
218
|
+
@binaryen_version
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def download_url(version)
|
|
125
222
|
assets = [
|
|
126
223
|
[
|
|
127
224
|
/x86_64-linux/,
|
|
@@ -143,47 +240,44 @@ module RubyWasm
|
|
|
143
240
|
"https://github.com/WebAssembly/binaryen/releases/download/version_#{@binaryen_version}/#{asset}"
|
|
144
241
|
end
|
|
145
242
|
|
|
146
|
-
def
|
|
147
|
-
return unless @need_fetch_wasi_sdk
|
|
148
|
-
wasi_sdk_tarball =
|
|
149
|
-
File.join(File.dirname(@wasi_sdk_path), "wasi-sdk.tar.gz")
|
|
150
|
-
unless File.exist? wasi_sdk_tarball
|
|
151
|
-
FileUtils.mkdir_p File.dirname(wasi_sdk_tarball)
|
|
152
|
-
system "curl -L -o #{wasi_sdk_tarball} #{self.download_url(@version_major, @version_minor)}"
|
|
153
|
-
end
|
|
154
|
-
unless File.exist? @wasi_sdk_path
|
|
155
|
-
FileUtils.mkdir_p @wasi_sdk_path
|
|
156
|
-
system "tar -C #{@wasi_sdk_path} --strip-component 1 -xzf #{wasi_sdk_tarball}"
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def install_binaryen
|
|
243
|
+
def install(executor)
|
|
161
244
|
return unless @need_fetch_binaryen
|
|
162
245
|
binaryen_tarball = File.expand_path("../binaryen.tar.gz", @binaryen_path)
|
|
163
246
|
unless File.exist? binaryen_tarball
|
|
164
247
|
FileUtils.mkdir_p File.dirname(binaryen_tarball)
|
|
165
|
-
system "curl
|
|
248
|
+
executor.system "curl",
|
|
249
|
+
"-L",
|
|
250
|
+
"-o",
|
|
251
|
+
binaryen_tarball,
|
|
252
|
+
self.download_url(@binaryen_version)
|
|
166
253
|
end
|
|
167
254
|
|
|
168
255
|
unless File.exist? @binaryen_path
|
|
169
256
|
FileUtils.mkdir_p @binaryen_path
|
|
170
|
-
system "tar
|
|
257
|
+
executor.system "tar",
|
|
258
|
+
"-C",
|
|
259
|
+
@binaryen_path,
|
|
260
|
+
"--strip-component",
|
|
261
|
+
"1",
|
|
262
|
+
"-xzf",
|
|
263
|
+
binaryen_tarball
|
|
171
264
|
end
|
|
172
265
|
end
|
|
173
|
-
|
|
174
|
-
def install
|
|
175
|
-
install_wasi_sdk
|
|
176
|
-
install_binaryen
|
|
177
|
-
end
|
|
178
266
|
end
|
|
179
267
|
|
|
180
268
|
class Emscripten < Toolchain
|
|
181
269
|
def initialize
|
|
182
|
-
@tools = {
|
|
270
|
+
@tools = {
|
|
271
|
+
cc: "emcc",
|
|
272
|
+
cxx: "em++",
|
|
273
|
+
ld: "emcc",
|
|
274
|
+
ar: "emar",
|
|
275
|
+
ranlib: "emranlib"
|
|
276
|
+
}
|
|
183
277
|
@name = "emscripten"
|
|
184
278
|
end
|
|
185
279
|
|
|
186
|
-
def install
|
|
280
|
+
def install(executor)
|
|
187
281
|
end
|
|
188
282
|
|
|
189
283
|
def find_tool(name)
|
data/lib/ruby_wasm/build.rb
CHANGED
|
@@ -43,7 +43,7 @@ class RubyWasm::Build
|
|
|
43
43
|
@target = target
|
|
44
44
|
@build_dir = build_dir
|
|
45
45
|
@rubies_dir = rubies_dir
|
|
46
|
-
@toolchain =
|
|
46
|
+
@toolchain = toolchain || raise("toolchain is required")
|
|
47
47
|
|
|
48
48
|
@libyaml = RubyWasm::LibYAMLProduct.new(@build_dir, @target, @toolchain)
|
|
49
49
|
@zlib = RubyWasm::ZlibProduct.new(@build_dir, @target, @toolchain)
|
data/lib/ruby_wasm/cli.rb
CHANGED
|
@@ -181,12 +181,12 @@ module RubyWasm
|
|
|
181
181
|
private
|
|
182
182
|
|
|
183
183
|
def build_config(options)
|
|
184
|
-
build_source, all_default_exts = compute_build_source(options)
|
|
185
184
|
# @type var config: Packager::build_config
|
|
186
|
-
config =
|
|
185
|
+
config = compute_build_alias(options)
|
|
186
|
+
config[:target] = options[:target_triplet]
|
|
187
187
|
case options[:profile]
|
|
188
188
|
when "full"
|
|
189
|
-
config[:default_exts] = all_default_exts || ""
|
|
189
|
+
config[:default_exts] = config[:all_default_exts] || ""
|
|
190
190
|
env_additional_exts = ENV["RUBY_WASM_ADDITIONAL_EXTS"] || ""
|
|
191
191
|
unless env_additional_exts.empty?
|
|
192
192
|
config[:default_exts] += "," + env_additional_exts
|
|
@@ -201,24 +201,32 @@ module RubyWasm
|
|
|
201
201
|
config
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
-
def
|
|
204
|
+
def compute_build_alias(options)
|
|
205
205
|
src_name = options[:ruby_version]
|
|
206
|
-
aliases = self.class.
|
|
207
|
-
|
|
208
|
-
if
|
|
206
|
+
aliases = self.class.build_config_aliases(root)
|
|
207
|
+
config = aliases[src_name]
|
|
208
|
+
if config.nil?
|
|
209
209
|
if File.directory?(src_name)
|
|
210
210
|
# Treat as a local source if the given name is a source directory.
|
|
211
211
|
RubyWasm.logger.debug "Using local source: #{src_name}"
|
|
212
212
|
if options[:patches].any?
|
|
213
213
|
RubyWasm.logger.warn "Patches specified through --patch are ignored for local sources"
|
|
214
214
|
end
|
|
215
|
-
# @type var local_source: RubyWasm::Packager::build_source_local
|
|
216
|
-
local_source = { type: "local", path: src_name }
|
|
217
|
-
# @type var local_source: RubyWasm::Packager::build_source
|
|
218
|
-
local_source = local_source.merge(name: "local", patches: [])
|
|
219
215
|
# FIXME: We should have a way to specify extensions to be included by users.
|
|
220
216
|
# For now, assume all default extensions available in the head revision are available.
|
|
221
|
-
|
|
217
|
+
# @type var patches: Array[String]
|
|
218
|
+
patches = []
|
|
219
|
+
return(
|
|
220
|
+
{
|
|
221
|
+
name: "local",
|
|
222
|
+
src: {
|
|
223
|
+
type: "local",
|
|
224
|
+
path: src_name,
|
|
225
|
+
patches: patches
|
|
226
|
+
},
|
|
227
|
+
all_default_exts: RubyWasm::Packager::ALL_DEFAULT_EXTS
|
|
228
|
+
}
|
|
229
|
+
)
|
|
222
230
|
end
|
|
223
231
|
# Otherwise, it's an unknown source.
|
|
224
232
|
raise(
|
|
@@ -226,64 +234,100 @@ module RubyWasm
|
|
|
226
234
|
)
|
|
227
235
|
end
|
|
228
236
|
# Apply user-specified patches in addition to bundled patches.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
__skip__ = all_default_exts = source[:all_default_exts]
|
|
232
|
-
[source, all_default_exts]
|
|
237
|
+
config[:src][:patches].concat(options[:patches])
|
|
238
|
+
config
|
|
233
239
|
end
|
|
234
240
|
|
|
235
241
|
# Retrieves the alias definitions for the Ruby sources.
|
|
236
|
-
def self.
|
|
237
|
-
# @type var
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
def self.build_config_aliases(root)
|
|
243
|
+
# @type var aliases: Array[RubyWasm::Packager::build_source]
|
|
244
|
+
aliases = [
|
|
245
|
+
{
|
|
246
|
+
name: "head",
|
|
247
|
+
src: {
|
|
248
|
+
type: "github",
|
|
249
|
+
repo: "ruby/ruby",
|
|
250
|
+
rev: "master"
|
|
251
|
+
},
|
|
243
252
|
all_default_exts: RubyWasm::Packager::ALL_DEFAULT_EXTS,
|
|
253
|
+
wasi_sdk_version: "24.0"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "4.0",
|
|
257
|
+
src: {
|
|
258
|
+
type: "tarball",
|
|
259
|
+
url: "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0.tar.gz"
|
|
260
|
+
},
|
|
261
|
+
all_default_exts:
|
|
262
|
+
"cgi/escape,continuation,coverage,date,digest/bubblebabble,digest,digest/md5,digest/rmd160,digest/sha1,digest/sha2,etc,fcntl,json,json/generator,json/parser,objspace,pathname,psych,rbconfig/sizeof,ripper,stringio,strscan,monitor,zlib,openssl",
|
|
263
|
+
wasi_sdk_version: "24.0"
|
|
244
264
|
},
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
265
|
+
{
|
|
266
|
+
name: "3.4",
|
|
267
|
+
src: {
|
|
268
|
+
type: "tarball",
|
|
269
|
+
url: "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.1.tar.gz"
|
|
270
|
+
},
|
|
271
|
+
all_default_exts:
|
|
272
|
+
"cgi/escape,continuation,coverage,date,digest/bubblebabble,digest,digest/md5,digest/rmd160,digest/sha1,digest/sha2,etc,fcntl,json,json/generator,json/parser,objspace,pathname,psych,rbconfig/sizeof,ripper,stringio,strscan,monitor,zlib,openssl",
|
|
273
|
+
wasi_sdk_version: "22.0"
|
|
249
274
|
},
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
275
|
+
{
|
|
276
|
+
name: "3.3",
|
|
277
|
+
src: {
|
|
278
|
+
type: "tarball",
|
|
279
|
+
url: "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.3.tar.gz"
|
|
280
|
+
},
|
|
281
|
+
all_default_exts:
|
|
282
|
+
"bigdecimal,cgi/escape,continuation,coverage,date,dbm,digest/bubblebabble,digest,digest/md5,digest/rmd160,digest/sha1,digest/sha2,etc,fcntl,fiber,gdbm,json,json/generator,json/parser,nkf,objspace,pathname,psych,racc/cparse,rbconfig/sizeof,ripper,stringio,strscan,monitor,zlib,openssl",
|
|
283
|
+
wasi_sdk_version: "22.0"
|
|
254
284
|
},
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
285
|
+
{
|
|
286
|
+
name: "3.2",
|
|
287
|
+
src: {
|
|
288
|
+
type: "tarball",
|
|
289
|
+
url: "https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.4.tar.gz"
|
|
290
|
+
},
|
|
291
|
+
all_default_exts:
|
|
292
|
+
"bigdecimal,cgi/escape,continuation,coverage,date,dbm,digest/bubblebabble,digest,digest/md5,digest/rmd160,digest/sha1,digest/sha2,etc,fcntl,fiber,gdbm,json,json/generator,json/parser,nkf,objspace,pathname,psych,racc/cparse,rbconfig/sizeof,ripper,stringio,strscan,monitor,zlib,openssl",
|
|
293
|
+
wasi_sdk_version: "22.0"
|
|
259
294
|
}
|
|
260
|
-
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
# Set the name in the source config.
|
|
298
|
+
aliases.each { |config| config[:src][:name] = config[:name] }
|
|
261
299
|
|
|
262
300
|
# Apply bundled and user-specified `<root>/patches` directories.
|
|
263
|
-
|
|
264
|
-
source[:name] = name
|
|
301
|
+
aliases.each do |config|
|
|
265
302
|
patches_dirs = [bundled_patches_path, File.join(root, "patches")]
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
.map
|
|
269
|
-
|
|
303
|
+
config[:src][:patches] = patches_dirs
|
|
304
|
+
.flat_map do |patches_dir|
|
|
305
|
+
Dir[File.join(patches_dir, config[:name], "*.patch")].map do |p|
|
|
306
|
+
File.expand_path(p)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
.uniq
|
|
270
310
|
end
|
|
271
311
|
|
|
312
|
+
aliases_by_name = aliases.to_h { |config| [config[:name], config] }
|
|
313
|
+
|
|
314
|
+
# Pin the revisions based on build_manifest.json if available.
|
|
272
315
|
build_manifest = File.join(root, "build_manifest.json")
|
|
273
316
|
if File.exist?(build_manifest)
|
|
274
317
|
begin
|
|
275
318
|
manifest = JSON.parse(File.read(build_manifest))
|
|
276
319
|
manifest["ruby_revisions"].each do |name, rev|
|
|
277
|
-
source =
|
|
320
|
+
source = aliases_by_name[name][:src]
|
|
278
321
|
next unless source[:type] == "github"
|
|
279
322
|
# @type var source: RubyWasm::Packager::build_source_github
|
|
280
323
|
source[:rev] = rev
|
|
281
324
|
end
|
|
282
325
|
rescue StandardError => e
|
|
283
326
|
RubyWasm.logger.warn "Failed to load build_manifest.json: #{e}"
|
|
327
|
+
raise e
|
|
284
328
|
end
|
|
285
329
|
end
|
|
286
|
-
|
|
330
|
+
aliases_by_name
|
|
287
331
|
end
|
|
288
332
|
|
|
289
333
|
# Retrieves the root directory of the Ruby project.
|
|
@@ -179,7 +179,7 @@ class RubyWasm::Packager::Core
|
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
def _build_gem_exts(executor, build, gem_home)
|
|
182
|
-
build.toolchain.install
|
|
182
|
+
build.toolchain.install(executor)
|
|
183
183
|
baseruby = build.baseruby
|
|
184
184
|
unless Dir.exist?(baseruby.install_dir)
|
|
185
185
|
baseruby.build(executor)
|
data/lib/ruby_wasm/packager.rb
CHANGED
|
@@ -111,7 +111,7 @@ class RubyWasm::Packager
|
|
|
111
111
|
options = build_options
|
|
112
112
|
build_dir = File.join(@root, "build")
|
|
113
113
|
rubies_dir = File.join(@root, "rubies")
|
|
114
|
-
toolchain = RubyWasm::Toolchain.get(options[:target], build_dir)
|
|
114
|
+
toolchain = RubyWasm::Toolchain.get(options[:target], options, build_dir)
|
|
115
115
|
options.merge(
|
|
116
116
|
toolchain: toolchain,
|
|
117
117
|
build_dir: build_dir,
|
data/lib/ruby_wasm/version.rb
CHANGED
data/package-lock.json
CHANGED
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"typedoc": "^0.28.8"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
+
"node_modules/@bjorn3/browser_wasi_shim": {
|
|
21
|
+
"version": "0.4.2",
|
|
22
|
+
"resolved": "https://registry.npmjs.org/@bjorn3/browser_wasi_shim/-/browser_wasi_shim-0.4.2.tgz",
|
|
23
|
+
"integrity": "sha512-/iHkCVUG3VbcbmEHn5iIUpIrh7a7WPiwZ3sHy4HZKZzBdSadwdddYDZAII2zBvQYV0Lfi8naZngPCN7WPHI/hA==",
|
|
24
|
+
"license": "MIT OR Apache-2.0"
|
|
25
|
+
},
|
|
20
26
|
"node_modules/@bytecodealliance/componentize-js": {
|
|
21
27
|
"version": "0.14.0",
|
|
22
28
|
"resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.14.0.tgz",
|
|
@@ -1479,6 +1485,10 @@
|
|
|
1479
1485
|
"resolved": "packages/npm-packages/ruby-3.4-wasm-wasi",
|
|
1480
1486
|
"link": true
|
|
1481
1487
|
},
|
|
1488
|
+
"node_modules/@ruby/4.0-wasm-wasi": {
|
|
1489
|
+
"resolved": "packages/npm-packages/ruby-4.0-wasm-wasi",
|
|
1490
|
+
"link": true
|
|
1491
|
+
},
|
|
1482
1492
|
"node_modules/@ruby/head-wasm-emscripten": {
|
|
1483
1493
|
"resolved": "packages/npm-packages/ruby-head-wasm-emscripten",
|
|
1484
1494
|
"link": true
|
|
@@ -3576,7 +3586,7 @@
|
|
|
3576
3586
|
},
|
|
3577
3587
|
"packages/npm-packages/ruby-3.2-wasm-wasi": {
|
|
3578
3588
|
"name": "@ruby/3.2-wasm-wasi",
|
|
3579
|
-
"version": "2.
|
|
3589
|
+
"version": "2.9.0",
|
|
3580
3590
|
"license": "MIT",
|
|
3581
3591
|
"dependencies": {
|
|
3582
3592
|
"@ruby/wasm-wasi": "^2.0.0"
|
|
@@ -3584,7 +3594,7 @@
|
|
|
3584
3594
|
},
|
|
3585
3595
|
"packages/npm-packages/ruby-3.3-wasm-wasi": {
|
|
3586
3596
|
"name": "@ruby/3.3-wasm-wasi",
|
|
3587
|
-
"version": "2.
|
|
3597
|
+
"version": "2.9.0",
|
|
3588
3598
|
"license": "MIT",
|
|
3589
3599
|
"dependencies": {
|
|
3590
3600
|
"@ruby/wasm-wasi": "^2.0.0"
|
|
@@ -3592,7 +3602,15 @@
|
|
|
3592
3602
|
},
|
|
3593
3603
|
"packages/npm-packages/ruby-3.4-wasm-wasi": {
|
|
3594
3604
|
"name": "@ruby/3.4-wasm-wasi",
|
|
3595
|
-
"version": "2.
|
|
3605
|
+
"version": "2.9.0",
|
|
3606
|
+
"license": "MIT",
|
|
3607
|
+
"dependencies": {
|
|
3608
|
+
"@ruby/wasm-wasi": "^2.0.0"
|
|
3609
|
+
}
|
|
3610
|
+
},
|
|
3611
|
+
"packages/npm-packages/ruby-4.0-wasm-wasi": {
|
|
3612
|
+
"name": "@ruby/4.0-wasm-wasi",
|
|
3613
|
+
"version": "2.9.0",
|
|
3596
3614
|
"license": "MIT",
|
|
3597
3615
|
"dependencies": {
|
|
3598
3616
|
"@ruby/wasm-wasi": "^2.0.0"
|
|
@@ -3600,12 +3618,12 @@
|
|
|
3600
3618
|
},
|
|
3601
3619
|
"packages/npm-packages/ruby-head-wasm-emscripten": {
|
|
3602
3620
|
"name": "@ruby/head-wasm-emscripten",
|
|
3603
|
-
"version": "2.
|
|
3621
|
+
"version": "2.9.0",
|
|
3604
3622
|
"license": "MIT"
|
|
3605
3623
|
},
|
|
3606
3624
|
"packages/npm-packages/ruby-head-wasm-wasi": {
|
|
3607
3625
|
"name": "@ruby/head-wasm-wasi",
|
|
3608
|
-
"version": "2.
|
|
3626
|
+
"version": "2.9.0",
|
|
3609
3627
|
"license": "MIT",
|
|
3610
3628
|
"dependencies": {
|
|
3611
3629
|
"@ruby/wasm-wasi": "^2.0.0"
|
|
@@ -3613,7 +3631,7 @@
|
|
|
3613
3631
|
},
|
|
3614
3632
|
"packages/npm-packages/ruby-head-wasm-wasip2": {
|
|
3615
3633
|
"name": "@ruby/head-wasm-wasip2",
|
|
3616
|
-
"version": "2.
|
|
3634
|
+
"version": "2.9.0",
|
|
3617
3635
|
"license": "MIT",
|
|
3618
3636
|
"dependencies": {
|
|
3619
3637
|
"@bytecodealliance/preview2-shim": "^0.17.2",
|
|
@@ -3630,10 +3648,10 @@
|
|
|
3630
3648
|
},
|
|
3631
3649
|
"packages/npm-packages/ruby-wasm-wasi": {
|
|
3632
3650
|
"name": "@ruby/wasm-wasi",
|
|
3633
|
-
"version": "2.
|
|
3651
|
+
"version": "2.9.0",
|
|
3634
3652
|
"license": "MIT",
|
|
3635
3653
|
"dependencies": {
|
|
3636
|
-
"@bjorn3/browser_wasi_shim": "^0.
|
|
3654
|
+
"@bjorn3/browser_wasi_shim": "^0.4.2",
|
|
3637
3655
|
"tslib": "^2.8.1"
|
|
3638
3656
|
},
|
|
3639
3657
|
"devDependencies": {
|
|
@@ -3645,10 +3663,6 @@
|
|
|
3645
3663
|
"vitest": "^3.2.4"
|
|
3646
3664
|
}
|
|
3647
3665
|
},
|
|
3648
|
-
"packages/npm-packages/ruby-wasm-wasi/node_modules/@bjorn3/browser_wasi_shim": {
|
|
3649
|
-
"version": "0.3.0",
|
|
3650
|
-
"license": "MIT OR Apache-2.0"
|
|
3651
|
-
},
|
|
3652
3666
|
"packages/npm-packages/ruby-wasm-wasi/node_modules/@bytecodealliance/jco": {
|
|
3653
3667
|
"version": "1.8.1",
|
|
3654
3668
|
"resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.8.1.tgz",
|
data/rakelib/ci.rake
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
def latest_build_sources
|
|
2
2
|
BUILD_SOURCES
|
|
3
3
|
.filter_map do |name|
|
|
4
|
-
|
|
4
|
+
config = RubyWasm::CLI.build_config_aliases(LIB_ROOT)[name]
|
|
5
|
+
src = config[:src]
|
|
5
6
|
case src[:type]
|
|
6
7
|
when "github"
|
|
7
8
|
url = "repos/#{src[:repo]}/commits/#{src[:rev]}"
|
|
@@ -23,7 +24,8 @@ def release_note
|
|
|
23
24
|
EOS
|
|
24
25
|
|
|
25
26
|
BUILD_SOURCES.each do |name|
|
|
26
|
-
|
|
27
|
+
config = RubyWasm::CLI.build_config_aliases(LIB_ROOT)[name]
|
|
28
|
+
source = config[:src]
|
|
27
29
|
case source[:type]
|
|
28
30
|
when "github"
|
|
29
31
|
output +=
|