ruby_wasm 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +7 -7
- data/Cargo.lock +91 -6
- data/Gemfile +1 -1
- data/README.md +9 -9
- data/Rakefile +8 -7
- data/docs/cheat_sheet.md +8 -8
- data/ext/ruby_wasm/Cargo.toml +3 -1
- data/ext/ruby_wasm/src/lib.rs +198 -8
- data/lib/ruby_wasm/build/executor.rb +4 -0
- data/lib/ruby_wasm/build/product/crossruby.rb +53 -23
- data/lib/ruby_wasm/build/product/libyaml.rb +5 -3
- data/lib/ruby_wasm/build/product/openssl.rb +7 -2
- data/lib/ruby_wasm/build/product/product.rb +3 -3
- data/lib/ruby_wasm/build/product/ruby_source.rb +3 -3
- data/lib/ruby_wasm/build/product/wasi_vfs.rb +1 -1
- data/lib/ruby_wasm/build/product/zlib.rb +3 -1
- data/lib/ruby_wasm/build/target.rb +24 -0
- data/lib/ruby_wasm/build/toolchain.rb +1 -1
- data/lib/ruby_wasm/build.rb +7 -3
- data/lib/ruby_wasm/cli.rb +147 -11
- data/lib/ruby_wasm/feature_set.rb +30 -0
- data/lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.command.wasm +0 -0
- data/lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.reactor.wasm +0 -0
- data/lib/ruby_wasm/packager/component_adapter.rb +14 -0
- data/lib/ruby_wasm/packager/core.rb +192 -4
- data/lib/ruby_wasm/packager/file_system.rb +5 -3
- data/lib/ruby_wasm/packager.rb +21 -83
- data/lib/ruby_wasm/rake_task.rb +1 -0
- data/lib/ruby_wasm/version.rb +1 -1
- data/lib/ruby_wasm.rb +2 -0
- data/package-lock.json +410 -133
- data/package.json +3 -3
- data/rakelib/ci.rake +3 -3
- data/rakelib/packaging.rake +26 -12
- data/sig/ruby_wasm/build.rbs +36 -27
- data/sig/ruby_wasm/cli.rbs +27 -3
- data/sig/ruby_wasm/ext.rbs +25 -2
- data/sig/ruby_wasm/feature_set.rbs +12 -0
- data/sig/ruby_wasm/packager.rbs +44 -7
- metadata +9 -7
- data/builders/wasm32-unknown-emscripten/Dockerfile +0 -43
- data/builders/wasm32-unknown-emscripten/entrypoint.sh +0 -7
- data/builders/wasm32-unknown-wasi/Dockerfile +0 -47
- data/builders/wasm32-unknown-wasi/entrypoint.sh +0 -7
data/package.json
CHANGED
data/rakelib/ci.rake
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
def latest_build_sources
|
2
2
|
BUILD_SOURCES
|
3
3
|
.filter_map do |name|
|
4
|
-
src = RubyWasm::
|
4
|
+
src = RubyWasm::CLI.build_source_aliases(LIB_ROOT)[name]
|
5
5
|
case src[:type]
|
6
6
|
when "github"
|
7
7
|
url = "repos/#{src[:repo]}/commits/#{src[:rev]}"
|
@@ -23,7 +23,7 @@ def release_note
|
|
23
23
|
EOS
|
24
24
|
|
25
25
|
BUILD_SOURCES.each do |name|
|
26
|
-
source = RubyWasm::
|
26
|
+
source = RubyWasm::CLI.build_source_aliases(LIB_ROOT)[name]
|
27
27
|
case source[:type]
|
28
28
|
when "github"
|
29
29
|
output +=
|
@@ -86,7 +86,7 @@ def rake_task_matrix
|
|
86
86
|
task: "standalone:#{pkg[:name]}",
|
87
87
|
artifact: "packages/standalone/#{pkg[:name]}/dist",
|
88
88
|
artifact_name: "standalone-#{pkg[:name]}",
|
89
|
-
builder: "wasm32-unknown-
|
89
|
+
builder: "wasm32-unknown-wasip1",
|
90
90
|
rubies_cache_key: ruby_cache_keys[pkg[:build]]
|
91
91
|
}
|
92
92
|
end
|
data/rakelib/packaging.rake
CHANGED
@@ -51,8 +51,9 @@ namespace :npm do
|
|
51
51
|
# Share ./build and ./rubies in the same workspace
|
52
52
|
"RUBY_WASM_ROOT" => base_dir
|
53
53
|
}
|
54
|
+
cwd = nil
|
54
55
|
if gemfile_path = pkg[:gemfile]
|
55
|
-
|
56
|
+
cwd = File.dirname(gemfile_path)
|
56
57
|
else
|
57
58
|
# Explicitly disable rubygems integration since Bundler finds
|
58
59
|
# Gemfile in the repo root directory.
|
@@ -60,16 +61,18 @@ namespace :npm do
|
|
60
61
|
end
|
61
62
|
dist_dir = File.join(pkg_dir, "dist")
|
62
63
|
mkdir_p dist_dir
|
63
|
-
if pkg[:target]
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
64
|
+
if pkg[:target].start_with?("wasm32-unknown-wasi")
|
65
|
+
Dir.chdir(cwd || base_dir) do
|
66
|
+
sh env,
|
67
|
+
*build_command,
|
68
|
+
"--no-stdlib",
|
69
|
+
"-o",
|
70
|
+
File.join(dist_dir, "ruby.wasm")
|
71
|
+
sh env,
|
72
|
+
*build_command,
|
73
|
+
"-o",
|
74
|
+
File.join(dist_dir, "ruby.debug+stdlib.wasm")
|
75
|
+
end
|
73
76
|
sh wasi_sdk.wasm_opt,
|
74
77
|
"--strip-debug",
|
75
78
|
File.join(dist_dir, "ruby.wasm"),
|
@@ -81,7 +84,9 @@ namespace :npm do
|
|
81
84
|
"-o",
|
82
85
|
File.join(dist_dir, "ruby+stdlib.wasm")
|
83
86
|
elsif pkg[:target] == "wasm32-unknown-emscripten"
|
84
|
-
|
87
|
+
Dir.chdir(cwd || base_dir) do
|
88
|
+
sh env, *build_command, "-o", "/dev/null"
|
89
|
+
end
|
85
90
|
end
|
86
91
|
end
|
87
92
|
|
@@ -149,3 +154,12 @@ namespace :standalone do
|
|
149
154
|
end
|
150
155
|
end
|
151
156
|
end
|
157
|
+
|
158
|
+
namespace :gem do
|
159
|
+
task :update_component_adapters do
|
160
|
+
["command", "reactor"].each do |exec_model|
|
161
|
+
sh "curl", "-L", "-o", "lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.#{exec_model}.wasm",
|
162
|
+
"https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.1/wasi_snapshot_preview1.#{exec_model}.wasm"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
data/sig/ruby_wasm/build.rbs
CHANGED
@@ -5,17 +5,29 @@ module RubyWasm
|
|
5
5
|
def cache_key: (Digest::SHA256 digest) -> void
|
6
6
|
end
|
7
7
|
|
8
|
+
class Target
|
9
|
+
include _Cacheable
|
10
|
+
|
11
|
+
@triple: String
|
12
|
+
@pic: bool
|
13
|
+
|
14
|
+
attr_reader triple: String
|
15
|
+
|
16
|
+
def initialize: (String triple, ?pic: bool) -> void
|
17
|
+
def pic?: -> bool
|
18
|
+
end
|
19
|
+
|
8
20
|
class Build
|
9
21
|
include _Cacheable
|
10
22
|
|
11
|
-
@target:
|
23
|
+
@target: Target
|
12
24
|
@build_dir: String
|
13
25
|
@rubies_dir: String
|
14
26
|
@toolchain: Toolchain
|
15
27
|
@libyaml: LibYAMLProduct
|
16
28
|
@zlib: ZlibProduct
|
17
29
|
@openssl: OpenSSLProduct
|
18
|
-
@wasi_vfs: WasiVfsProduct
|
30
|
+
@wasi_vfs: WasiVfsProduct?
|
19
31
|
@baseruby: BaseRubyProduct
|
20
32
|
@crossruby: CrossRubyProduct
|
21
33
|
@source: BuildSource
|
@@ -24,11 +36,12 @@ module RubyWasm
|
|
24
36
|
|
25
37
|
def initialize: (
|
26
38
|
string name,
|
27
|
-
target:
|
39
|
+
target: Target,
|
28
40
|
src: Packager::build_source,
|
29
41
|
toolchain: Toolchain?,
|
30
42
|
build_dir: string,
|
31
43
|
rubies_dir: string,
|
44
|
+
?wasi_vfs: :default | WasiVfsProduct?,
|
32
45
|
**untyped
|
33
46
|
) -> void
|
34
47
|
def crossruby: () -> CrossRubyProduct
|
@@ -36,10 +49,10 @@ module RubyWasm
|
|
36
49
|
|
37
50
|
class BuildParams
|
38
51
|
attr_accessor name: String
|
39
|
-
attr_accessor target:
|
52
|
+
attr_accessor target: Target
|
40
53
|
attr_accessor default_exts: String
|
41
54
|
|
42
|
-
def initialize: (name: string, target:
|
55
|
+
def initialize: (name: string, target: Target, default_exts: string) -> void
|
43
56
|
end
|
44
57
|
|
45
58
|
class BuildProduct
|
@@ -47,10 +60,10 @@ module RubyWasm
|
|
47
60
|
end
|
48
61
|
|
49
62
|
class AutoconfProduct < BuildProduct
|
50
|
-
@target:
|
63
|
+
@target: Target
|
51
64
|
@toolchain: Toolchain
|
52
65
|
|
53
|
-
def initialize: (
|
66
|
+
def initialize: (Target target, Toolchain toolchain) -> void
|
54
67
|
def system_triplet_args: -> Array[String]
|
55
68
|
| -> Array[String]
|
56
69
|
def tools_args: -> Array[String]
|
@@ -88,8 +101,8 @@ module RubyWasm
|
|
88
101
|
ZLIB_VERSION: String
|
89
102
|
@build_dir: String
|
90
103
|
|
91
|
-
attr_reader target:
|
92
|
-
def initialize: (String build_dir,
|
104
|
+
attr_reader target: Target
|
105
|
+
def initialize: (String build_dir, Target target, Toolchain toolchain) -> void
|
93
106
|
def product_build_dir: -> String
|
94
107
|
def destdir: -> String
|
95
108
|
def install_root: -> String
|
@@ -102,8 +115,8 @@ module RubyWasm
|
|
102
115
|
LIBYAML_VERSION: String
|
103
116
|
@build_dir: String
|
104
117
|
|
105
|
-
attr_reader target:
|
106
|
-
def initialize: (String build_dir,
|
118
|
+
attr_reader target: Target
|
119
|
+
def initialize: (String build_dir, Target target, Toolchain toolchain) -> void
|
107
120
|
def product_build_dir: -> String
|
108
121
|
def destdir: -> String
|
109
122
|
def install_root: -> String
|
@@ -115,8 +128,8 @@ module RubyWasm
|
|
115
128
|
OPENSSL_VERSION: String
|
116
129
|
@build_dir: String
|
117
130
|
|
118
|
-
attr_reader target:
|
119
|
-
def initialize: (String build_dir,
|
131
|
+
attr_reader target: Target
|
132
|
+
def initialize: (String build_dir, Target target, Toolchain toolchain) -> void
|
120
133
|
def product_build_dir: -> String
|
121
134
|
def destdir: -> String
|
122
135
|
def install_root: -> String
|
@@ -157,6 +170,8 @@ module RubyWasm
|
|
157
170
|
def build: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
158
171
|
def do_extconf: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
159
172
|
def do_install_rb: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
173
|
+
|
174
|
+
private def do_legacy_extconf: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
|
160
175
|
end
|
161
176
|
|
162
177
|
class CrossRubyProduct < AutoconfProduct
|
@@ -171,6 +186,7 @@ module RubyWasm
|
|
171
186
|
@openssl: OpenSSLProduct
|
172
187
|
@wasi_vfs: WasiVfsProduct
|
173
188
|
|
189
|
+
attr_reader target: Target
|
174
190
|
attr_reader source: BuildSource
|
175
191
|
attr_reader toolchain: Toolchain
|
176
192
|
attr_accessor user_exts: Array[CrossRubyExtProduct]
|
@@ -183,6 +199,8 @@ module RubyWasm
|
|
183
199
|
attr_accessor xldflags: Array[String]
|
184
200
|
def initialize: (BuildParams params, String build_dir, String rubies_dir, BaseRubyProduct baseruby, BuildSource source, Toolchain toolchain) -> void
|
185
201
|
def configure: (BuildExecutor executor, ?reconfigure: bool) -> void
|
202
|
+
def need_exts_build?: -> bool
|
203
|
+
def need_extinit_obj?: -> bool
|
186
204
|
def build_exts: (BuildExecutor executor) -> void
|
187
205
|
def build: (BuildExecutor executor, ?remake: bool, ?reconfigure: bool) -> void
|
188
206
|
def clean: (BuildExecutor executor) -> void
|
@@ -191,7 +209,7 @@ module RubyWasm
|
|
191
209
|
def ext_build_dir: -> String
|
192
210
|
def with_libyaml: (LibYAMLProduct libyaml) -> LibYAMLProduct
|
193
211
|
def with_zlib: (ZlibProduct zlib) -> ZlibProduct
|
194
|
-
def with_wasi_vfs: (WasiVfsProduct wasi_vfs) -> WasiVfsProduct
|
212
|
+
def with_wasi_vfs: (WasiVfsProduct? wasi_vfs) -> WasiVfsProduct?
|
195
213
|
def with_openssl: (OpenSSLProduct openssl) -> OpenSSLProduct
|
196
214
|
def dest_dir: -> String
|
197
215
|
def artifact: -> String
|
@@ -219,7 +237,7 @@ module RubyWasm
|
|
219
237
|
def initialize: -> void
|
220
238
|
def find_tool: (Symbol name) -> String
|
221
239
|
def check_envvar: (untyped name) -> void
|
222
|
-
def self.get: (
|
240
|
+
def self.get: (Target target, ?String? build_dir) -> (Toolchain)
|
223
241
|
def self.find_path: (String command) -> String?
|
224
242
|
def self.check_executable: (String command) -> String
|
225
243
|
def cc: -> String
|
@@ -273,6 +291,7 @@ module RubyWasm
|
|
273
291
|
def cp_r: (FileUtils::pathlist src, path dest) -> void
|
274
292
|
def mv: (FileUtils::pathlist src, path dest) -> void
|
275
293
|
def mkdir_p: (FileUtils::pathlist list) -> void
|
294
|
+
def ln_s: (String src, String dest) -> void
|
276
295
|
def write: (String path, _ToS data) -> void
|
277
296
|
|
278
297
|
def begin_section: (Class klass, String name, String note) -> void
|
@@ -299,19 +318,9 @@ module RubyWasm
|
|
299
318
|
end
|
300
319
|
|
301
320
|
class BuildTask
|
302
|
-
@
|
303
|
-
@rubies_dir: String
|
304
|
-
@openssl: OpenSSLProduct
|
305
|
-
|
321
|
+
@build: Build
|
306
322
|
attr_accessor name: String
|
307
|
-
|
308
|
-
attr_reader target: String
|
309
|
-
attr_reader toolchain: Toolchain
|
310
|
-
attr_reader libyaml: LibYAMLProduct
|
311
|
-
attr_reader zlib: ZlibProduct
|
312
|
-
attr_reader wasi_vfs: WasiVfsProduct
|
313
|
-
attr_reader baseruby: BaseRubyProduct
|
314
|
-
attr_reader crossruby: CrossRubyProduct
|
323
|
+
|
315
324
|
def initialize: (String name, target: String, src: untyped, ?toolchain: Toolchain?, ?build_dir: String?, ?rubies_dir: String?, **untyped) -> void
|
316
325
|
def hexdigest: -> String
|
317
326
|
end
|
data/sig/ruby_wasm/cli.rbs
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
module RubyWasm
|
2
2
|
class CLI
|
3
|
+
type cli_options = {
|
4
|
+
print_ruby_cache_key: bool,
|
5
|
+
save_temps: bool,
|
6
|
+
output: String,
|
7
|
+
|
8
|
+
optimize: bool,
|
9
|
+
remake: bool,
|
10
|
+
reconfigure: bool,
|
11
|
+
clean: bool,
|
12
|
+
|
13
|
+
ruby_version: String,
|
14
|
+
target_triplet: String,
|
15
|
+
profile: String,
|
16
|
+
stdlib: bool,
|
17
|
+
disable_gems: bool,
|
18
|
+
gemfile: String?,
|
19
|
+
patches: Array[String],
|
20
|
+
format: String,
|
21
|
+
}
|
22
|
+
|
3
23
|
DEFAULT_RUBIES_DIR: string
|
4
24
|
|
5
25
|
@stdout: IO
|
@@ -12,11 +32,15 @@ module RubyWasm
|
|
12
32
|
|
13
33
|
private
|
14
34
|
|
15
|
-
def build_config: (
|
35
|
+
def build_config: (cli_options options) -> Packager::build_config
|
36
|
+
def compute_build_source: (cli_options options) -> [Packager::build_source, String?]
|
37
|
+
def self.build_source_aliases: (string root) -> Hash[string, Packager::build_source]
|
38
|
+
def self.bundled_patches_path: () -> string
|
39
|
+
def root: () -> string
|
16
40
|
|
17
|
-
def derive_packager: (
|
41
|
+
def derive_packager: (cli_options options) -> Packager
|
18
42
|
def do_print_ruby_cache_key: (Packager) -> void
|
19
|
-
def do_build: (BuildExecutor, string tmpdir, Packager,
|
43
|
+
def do_build: (BuildExecutor, string tmpdir, Packager, cli_options options) -> void
|
20
44
|
|
21
45
|
def require_extension: () -> void
|
22
46
|
end
|
data/sig/ruby_wasm/ext.rbs
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module RubyWasmExt
|
2
|
-
|
2
|
+
type bytes = String
|
3
|
+
|
4
|
+
def self.preinitialize: (bytes module_bytes) -> bytes
|
3
5
|
|
4
6
|
class WasiVfs
|
5
7
|
def initialize: () -> void
|
@@ -8,6 +10,27 @@ module RubyWasmExt
|
|
8
10
|
|
9
11
|
def map_dir: (String guest_path, String host_path) -> void
|
10
12
|
|
11
|
-
def pack: (
|
13
|
+
def pack: (bytes module_bytes) -> bytes
|
14
|
+
end
|
15
|
+
|
16
|
+
class ComponentLink
|
17
|
+
def initialize: () -> void
|
18
|
+
def library: (String name, bytes module, bool dl_openable) -> void
|
19
|
+
def adapter: (String name, bytes module) -> void
|
20
|
+
def validate: (bool) -> void
|
21
|
+
def stack_size: (Integer) -> void
|
22
|
+
def stub_missing_functions: (bool) -> void
|
23
|
+
def use_built_in_libdl: (bool) -> void
|
24
|
+
def encode: () -> bytes
|
25
|
+
end
|
26
|
+
|
27
|
+
class ComponentEncode
|
28
|
+
def initialize: () -> void
|
29
|
+
def validate: (bool) -> void
|
30
|
+
def adapter: (String name, bytes module) -> void
|
31
|
+
def module: (bytes module) -> void
|
32
|
+
def realloc_via_memory_grow: (bool) -> void
|
33
|
+
def import_name_map: (Hash[String, String] map) -> void
|
34
|
+
def encode: () -> bytes
|
12
35
|
end
|
13
36
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RubyWasm::FeatureSet
|
2
|
+
@features: Hash[Symbol, bool]
|
3
|
+
|
4
|
+
def initialize: (Hash[Symbol, bool]) -> void
|
5
|
+
|
6
|
+
FEATURES: Hash[Symbol, String]
|
7
|
+
|
8
|
+
def self.derive_from_env: () -> RubyWasm::FeatureSet
|
9
|
+
|
10
|
+
def support_dynamic_linking?: () -> bool
|
11
|
+
def support_component_model?: () -> bool
|
12
|
+
end
|
data/sig/ruby_wasm/packager.rbs
CHANGED
@@ -1,11 +1,39 @@
|
|
1
1
|
|
2
2
|
class RubyWasm::Packager
|
3
|
+
type build_source_github = {
|
4
|
+
type: "github",
|
5
|
+
repo: String,
|
6
|
+
rev: String,
|
7
|
+
}
|
8
|
+
type build_source_tarball = {
|
9
|
+
type: "tarball",
|
10
|
+
url: String,
|
11
|
+
}
|
12
|
+
type build_source_local = {
|
13
|
+
type: "local",
|
14
|
+
path: String,
|
15
|
+
}
|
16
|
+
type build_source = (build_source_github | build_source_tarball | build_source_local) & {
|
17
|
+
name: string,
|
18
|
+
patches: Array[String],
|
19
|
+
}
|
20
|
+
|
21
|
+
type build_config = {
|
22
|
+
target: String,
|
23
|
+
src: RubyWasm::Packager::build_source,
|
24
|
+
default_exts: String,
|
25
|
+
suffix: String,
|
26
|
+
}
|
27
|
+
|
28
|
+
type bytes = String
|
29
|
+
|
3
30
|
@definition: untyped
|
4
|
-
@config:
|
31
|
+
@config: build_config
|
32
|
+
@features: RubyWasm::FeatureSet
|
5
33
|
|
6
|
-
def initialize: (
|
34
|
+
def initialize: (string root, build_config?, untyped? definition, features: RubyWasm::FeatureSet) -> void
|
7
35
|
|
8
|
-
def package: (RubyWasm::BuildExecutor, string dest_dir, untyped options) ->
|
36
|
+
def package: (RubyWasm::BuildExecutor, string dest_dir, untyped options) -> bytes
|
9
37
|
|
10
38
|
@ruby_core_build: RubyWasm::Packager::Core?
|
11
39
|
def ruby_core_build: () -> RubyWasm::Packager::Core
|
@@ -13,13 +41,10 @@ class RubyWasm::Packager
|
|
13
41
|
EXCLUDED_GEMS: Array[string]
|
14
42
|
|
15
43
|
def specs: () -> Array[untyped]
|
16
|
-
def
|
44
|
+
def features: () -> RubyWasm::FeatureSet
|
17
45
|
|
18
46
|
def root: () -> string
|
19
47
|
|
20
|
-
type build_source = Hash[Symbol, (String | Array[String])]
|
21
|
-
def self.build_source_aliases: (string root) -> Hash[string, build_source]
|
22
|
-
|
23
48
|
ALL_DEFAULT_EXTS: string
|
24
49
|
|
25
50
|
def build_options: () -> Hash[Symbol, untyped]
|
@@ -31,6 +56,7 @@ class RubyWasm::Packager
|
|
31
56
|
@packager: RubyWasm::Packager
|
32
57
|
def initialize: (RubyWasm::Packager) -> void
|
33
58
|
def build: (RubyWasm::BuildExecutor, untyped options) -> String
|
59
|
+
def build_and_link_exts: (RubyWasm::BuildExecutor) -> bytes
|
34
60
|
|
35
61
|
extend Forwardable
|
36
62
|
|
@@ -46,9 +72,16 @@ class RubyWasm::Packager
|
|
46
72
|
def initialize: (RubyWasm::Packager) -> void
|
47
73
|
def build: (RubyWasm::BuildExecutor, untyped options) -> String
|
48
74
|
def specs_with_extensions: () -> Array[[untyped, Array[string]]]
|
75
|
+
def build_and_link_exts: (RubyWasm::BuildExecutor) -> bytes
|
49
76
|
end
|
50
77
|
|
51
78
|
class DynamicLinking < RubyWasm::Packager::Core::BuildStrategy
|
79
|
+
@build: RubyWasm::Build
|
80
|
+
def derive_build: () -> RubyWasm::Build
|
81
|
+
def build_exts: (RubyWasm::BuildExecutor, RubyWasm::Build) -> void
|
82
|
+
def name: () -> string
|
83
|
+
|
84
|
+
private def link_exts: (RubyWasm::BuildExecutor, RubyWasm::Build) -> bytes
|
52
85
|
end
|
53
86
|
|
54
87
|
class StaticLinking < RubyWasm::Packager::Core::BuildStrategy
|
@@ -88,4 +121,8 @@ class RubyWasm::Packager
|
|
88
121
|
def ruby_version: () -> String
|
89
122
|
def rubyarchdir: () -> String
|
90
123
|
end
|
124
|
+
|
125
|
+
module ComponentAdapter
|
126
|
+
def self.wasi_snapshot_preview1: (String exec_model) -> String
|
127
|
+
end
|
91
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_wasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuta Saito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby to WebAssembly toolkit. This gem takes Ruby code and Gemfile, and
|
14
14
|
packages them with Ruby runtime into a WebAssembly binary.
|
@@ -31,10 +31,6 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- Steepfile
|
33
33
|
- benchmarks/vm_deep_call.rb
|
34
|
-
- builders/wasm32-unknown-emscripten/Dockerfile
|
35
|
-
- builders/wasm32-unknown-emscripten/entrypoint.sh
|
36
|
-
- builders/wasm32-unknown-wasi/Dockerfile
|
37
|
-
- builders/wasm32-unknown-wasi/entrypoint.sh
|
38
34
|
- docs/api.md
|
39
35
|
- docs/cheat_sheet.md
|
40
36
|
- docs/faq.md
|
@@ -59,10 +55,15 @@ files:
|
|
59
55
|
- lib/ruby_wasm/build/product/ruby_source.rb
|
60
56
|
- lib/ruby_wasm/build/product/wasi_vfs.rb
|
61
57
|
- lib/ruby_wasm/build/product/zlib.rb
|
58
|
+
- lib/ruby_wasm/build/target.rb
|
62
59
|
- lib/ruby_wasm/build/toolchain.rb
|
63
60
|
- lib/ruby_wasm/build/toolchain/wit_bindgen.rb
|
64
61
|
- lib/ruby_wasm/cli.rb
|
62
|
+
- lib/ruby_wasm/feature_set.rb
|
65
63
|
- lib/ruby_wasm/packager.rb
|
64
|
+
- lib/ruby_wasm/packager/component_adapter.rb
|
65
|
+
- lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.command.wasm
|
66
|
+
- lib/ruby_wasm/packager/component_adapter/wasi_snapshot_preview1.reactor.wasm
|
66
67
|
- lib/ruby_wasm/packager/core.rb
|
67
68
|
- lib/ruby_wasm/packager/file_system.rb
|
68
69
|
- lib/ruby_wasm/rake_task.rb
|
@@ -81,6 +82,7 @@ files:
|
|
81
82
|
- sig/ruby_wasm/build.rbs
|
82
83
|
- sig/ruby_wasm/cli.rbs
|
83
84
|
- sig/ruby_wasm/ext.rbs
|
85
|
+
- sig/ruby_wasm/feature_set.rbs
|
84
86
|
- sig/ruby_wasm/packager.rbs
|
85
87
|
- sig/ruby_wasm/util.rbs
|
86
88
|
- tools/clang-format-diff.sh
|
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
- !ruby/object:Gem::Version
|
108
110
|
version: '0'
|
109
111
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.4.19
|
111
113
|
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: Ruby to WebAssembly toolkit
|
@@ -1,43 +0,0 @@
|
|
1
|
-
FROM emscripten/emsdk:3.1.31
|
2
|
-
|
3
|
-
ARG NODE_MAJOR_VERSION=20
|
4
|
-
|
5
|
-
RUN set -eux; \
|
6
|
-
apt-get update; \
|
7
|
-
apt-get install -y ca-certificates curl gnupg; \
|
8
|
-
mkdir -p /etc/apt/keyrings; \
|
9
|
-
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
|
10
|
-
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
|
11
|
-
apt-get update; \
|
12
|
-
apt-get install ruby ruby-dev ruby-bundler nodejs \
|
13
|
-
bison make autoconf git curl build-essential \
|
14
|
-
libyaml-dev zlib1g-dev gosu \
|
15
|
-
libclang-13-dev -y; \
|
16
|
-
apt-get clean; \
|
17
|
-
rm -r /var/lib/apt/lists/*
|
18
|
-
|
19
|
-
# Prefer apt-installed nodejs instead of emsdk's old one.
|
20
|
-
ENV PATH=/usr/bin:$PATH
|
21
|
-
|
22
|
-
ENV RUSTUP_HOME=/usr/local/rustup \
|
23
|
-
CARGO_HOME=/usr/local/cargo \
|
24
|
-
PATH=/usr/local/cargo/bin:$PATH \
|
25
|
-
RUST_VERSION=1.75
|
26
|
-
|
27
|
-
RUN set -eux pipefail; \
|
28
|
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
29
|
-
sh -s -- -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
|
30
|
-
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
|
31
|
-
|
32
|
-
ENV BUNDLE_PATH=/usr/local/gems
|
33
|
-
RUN set -eux; \
|
34
|
-
mkdir -p $BUNDLE_PATH; \
|
35
|
-
chmod -R 777 $BUNDLE_PATH
|
36
|
-
|
37
|
-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
38
|
-
RUN chmod +x /usr/local/bin/entrypoint.sh
|
39
|
-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
40
|
-
# Build with non-root user because `@npmcli/promise-spawn` sets `uid` and `gid` to cwd owner when the current user is root.
|
41
|
-
# This permission demotion results in EACCES error at reading `$HOME/.node_modules` in `resolve` package, which is used by `@rollup/plugin-node-resolve`.
|
42
|
-
# * https://github.com/npm/cli/blob/32336f6efe06bd52de1dc67c0f812d4705533ef2/node_modules/%40npmcli/promise-spawn/lib/index.js#L13
|
43
|
-
RUN adduser --disabled-password --gecos '' me
|
@@ -1,47 +0,0 @@
|
|
1
|
-
FROM debian:bullseye
|
2
|
-
|
3
|
-
ARG WASI_PRESET_ARGS_VERSION=0.1.1
|
4
|
-
ARG NODE_MAJOR_VERSION=20
|
5
|
-
|
6
|
-
RUN set -eux; \
|
7
|
-
apt-get update; \
|
8
|
-
apt-get install -y ca-certificates curl gnupg; \
|
9
|
-
mkdir -p /etc/apt/keyrings; \
|
10
|
-
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
|
11
|
-
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
|
12
|
-
apt-get update; \
|
13
|
-
apt-get install ruby ruby-dev ruby-bundler nodejs \
|
14
|
-
bison make autoconf git curl build-essential \
|
15
|
-
libyaml-dev zlib1g-dev gosu \
|
16
|
-
libclang-13-dev -y; \
|
17
|
-
apt-get clean; \
|
18
|
-
rm -r /var/lib/apt/lists/*
|
19
|
-
|
20
|
-
RUN set -eux pipefail; \
|
21
|
-
wasi_preset_args_url="https://github.com/kateinoigakukun/wasi-preset-args/releases/download/v${WASI_PRESET_ARGS_VERSION}/wasi-preset-args-x86_64-unknown-linux-gnu.zip"; \
|
22
|
-
curl -LO "$wasi_preset_args_url"; \
|
23
|
-
unzip wasi-preset-args-x86_64-unknown-linux-gnu.zip; \
|
24
|
-
mv wasi-preset-args /usr/local/bin/wasi-preset-args
|
25
|
-
|
26
|
-
ENV RUSTUP_HOME=/usr/local/rustup \
|
27
|
-
CARGO_HOME=/usr/local/cargo \
|
28
|
-
PATH=/usr/local/cargo/bin:$PATH \
|
29
|
-
RUST_VERSION=1.75
|
30
|
-
|
31
|
-
RUN set -eux pipefail; \
|
32
|
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
33
|
-
sh -s -- -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
|
34
|
-
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
|
35
|
-
|
36
|
-
ENV BUNDLE_PATH=/usr/local/gems
|
37
|
-
RUN set -eux; \
|
38
|
-
mkdir -p $BUNDLE_PATH; \
|
39
|
-
chmod -R 777 $BUNDLE_PATH
|
40
|
-
|
41
|
-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
42
|
-
RUN chmod +x /usr/local/bin/entrypoint.sh
|
43
|
-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
44
|
-
# Build with non-root user because `@npmcli/promise-spawn` sets `uid` and `gid` to cwd owner when the current user is root.
|
45
|
-
# This permission demotion results in EACCES error at reading `$HOME/.node_modules` in `resolve` package, which is used by `@rollup/plugin-node-resolve`.
|
46
|
-
# * https://github.com/npm/cli/blob/32336f6efe06bd52de1dc67c0f812d4705533ef2/node_modules/%40npmcli/promise-spawn/lib/index.js#L13
|
47
|
-
RUN adduser --disabled-password --gecos '' me
|