File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -344,8 +344,7 @@ def configure_args(build_triple, toolchain)
344344 # target-side wasm dump_ast while generating .rbinc files.
345345 args << %Q(--with-dump-ast=#{ dump_ast_path } )
346346
347- case target
348- when /^wasm32-unknown-wasi/
347+ if @toolchain . wasi_sysroot?
349348 xldflags << @wasi_vfs . lib_wasi_vfs_a if @wasi_vfs
350349 # TODO: Find a way to force cast or update API
351350 # @type var wasi_sdk_path: untyped
@@ -363,14 +362,17 @@ def configure_args(build_triple, toolchain)
363362 # it broke Kernel#require on @bjorn3/browser_wasi_shim setup for some
364363 # reason. So we disable it for now.
365364 args << %Q(ac_cv_func_realpath=no)
365+ end
366+
367+ case target
366368 when "wasm32-unknown-emscripten"
367369 ldflags . concat ( %w[ -s MODULARIZE=1 ] )
368370 env_emcc_ldflags = ENV [ "RUBY_WASM_EMCC_LDFLAGS" ] || ""
369371 unless env_emcc_ldflags . empty?
370372 ldflags << env_emcc_ldflags
371373 end
372374 else
373- raise "unknown target: #{ target } "
375+ raise "unknown target: #{ target } " unless @toolchain . wasi_sysroot?
374376 end
375377
376378 args . concat ( self . tools_args )
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def configure_args
4242 --libdir=lib
4343 -Wl,--allow-undefined
4444 ]
45- if @target . triple . start_with? ( "wasm32-unknown-wasi" )
45+ if @toolchain . wasi_sysroot?
4646 args . concat %w[
4747 -D_WASI_EMULATED_SIGNAL
4848 -D_WASI_EMULATED_PROCESS_CLOCKS
Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ def initialize
88 @tools = { }
99 end
1010
11+ # If this toolchain compiles against wasi-libc, it needs
12+ # wasi-libc's emulation feature flags.
13+ def wasi_sysroot?
14+ false
15+ end
16+
1117 def find_tool ( name )
1218 raise "not implemented"
1319 end
@@ -90,6 +96,10 @@ def initialize(
9096 @name = "wasi-sdk"
9197 end
9298
99+ def wasi_sysroot?
100+ true
101+ end
102+
93103 def find_tool ( name )
94104 if !File . exist? ( @tools [ name ] ) && !ENV [ "WASI_SDK_PATH" ] . nil?
95105 raise "missing tool '#{ name } ' at #{ @tools [ name ] } "
You can’t perform that action at this time.
0 commit comments