ruby_wasm 2.7.1-aarch64-linux-musl → 2.8.1-aarch64-linux-musl
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 +3 -3
- data/Gemfile +1 -1
- data/README.md +10 -5
- data/Rakefile +10 -14
- data/docs/cheat_sheet.md +11 -11
- data/lib/ruby_wasm/3.3/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/3.4/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/build/executor.rb +10 -0
- data/lib/ruby_wasm/build/product/crossruby.rb +12 -1
- data/lib/ruby_wasm/build/toolchain.rb +145 -51
- data/lib/ruby_wasm/build.rb +1 -1
- data/lib/ruby_wasm/cli.rb +88 -44
- data/lib/ruby_wasm/packager/component_adapter.rb +1 -3
- 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 +2415 -1852
- data/package.json +4 -4
- data/rakelib/ci.rake +38 -2
- data/rakelib/packaging.rake +11 -9
- data/sig/ruby_wasm/build.rbs +33 -13
- data/sig/ruby_wasm/cli.rbs +6 -2
- data/sig/ruby_wasm/packager.rbs +6 -11
- metadata +18 -6
- data/lib/ruby_wasm/3.1/ruby_wasm.so +0 -0
- data/lib/ruby_wasm/3.2/ruby_wasm.so +0 -0
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.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
module RubyWasm::Packager::ComponentAdapter
|
|
2
|
-
module_function
|
|
3
|
-
|
|
4
2
|
# The path to the component adapter for the given WASI execution model.
|
|
5
3
|
#
|
|
6
4
|
# @param exec_model [String] "command" or "reactor"
|
|
7
|
-
def wasi_snapshot_preview1(exec_model)
|
|
5
|
+
def self.wasi_snapshot_preview1(exec_model)
|
|
8
6
|
File.join(
|
|
9
7
|
File.dirname(__FILE__),
|
|
10
8
|
"component_adapter",
|
|
@@ -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