Skip to content

Commit f4741bd

Browse files
build: Allow to exclude libwasi_vfs.a from link
1 parent 45ebafc commit f4741bd

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/ruby_wasm/build.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def initialize(
3636
toolchain:,
3737
build_dir:,
3838
rubies_dir:,
39+
wasi_vfs: :default,
3940
**options
4041
)
4142
@target = target
@@ -45,7 +46,7 @@ def initialize(
4546

4647
@libyaml = RubyWasm::LibYAMLProduct.new(@build_dir, @target, @toolchain)
4748
@zlib = RubyWasm::ZlibProduct.new(@build_dir, @target, @toolchain)
48-
@wasi_vfs = RubyWasm::WasiVfsProduct.new(@build_dir)
49+
@wasi_vfs = wasi_vfs == :default ? RubyWasm::WasiVfsProduct.new(@build_dir) : wasi_vfs
4950
@source = RubyWasm::BuildSource.new(src, @build_dir)
5051
@baseruby = RubyWasm::BaseRubyProduct.new(@build_dir, @source)
5152
@openssl = RubyWasm::OpenSSLProduct.new(@build_dir, @target, @toolchain)
@@ -83,6 +84,8 @@ def cache_key(digest)
8384
digest << @libyaml.name
8485
digest << @zlib.name
8586
digest << @openssl.name
86-
digest << @wasi_vfs.name
87+
if wasi_vfs = @wasi_vfs
88+
digest << wasi_vfs.name
89+
end
8790
end
8891
end

lib/ruby_wasm/build/product/crossruby.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def build(executor, remake: false, reconfigure: false)
169169
executor.mkdir_p build_dir
170170
@toolchain.install
171171
[@source, @baseruby, @libyaml, @zlib, @openssl, @wasi_vfs].each do |prod|
172+
next unless prod
172173
executor.begin_section prod.class, prod.name, "Building"
173174
prod.build(executor)
174175
executor.end_section prod.class, prod.name

sig/ruby_wasm/build.rbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module RubyWasm
1515
@libyaml: LibYAMLProduct
1616
@zlib: ZlibProduct
1717
@openssl: OpenSSLProduct
18-
@wasi_vfs: WasiVfsProduct
18+
@wasi_vfs: WasiVfsProduct?
1919
@baseruby: BaseRubyProduct
2020
@crossruby: CrossRubyProduct
2121
@source: BuildSource
@@ -29,6 +29,7 @@ module RubyWasm
2929
toolchain: Toolchain?,
3030
build_dir: string,
3131
rubies_dir: string,
32+
?wasi_vfs: :default | WasiVfsProduct?,
3233
**untyped
3334
) -> void
3435
def crossruby: () -> CrossRubyProduct
@@ -192,7 +193,7 @@ module RubyWasm
192193
def ext_build_dir: -> String
193194
def with_libyaml: (LibYAMLProduct libyaml) -> LibYAMLProduct
194195
def with_zlib: (ZlibProduct zlib) -> ZlibProduct
195-
def with_wasi_vfs: (WasiVfsProduct wasi_vfs) -> WasiVfsProduct
196+
def with_wasi_vfs: (WasiVfsProduct? wasi_vfs) -> WasiVfsProduct?
196197
def with_openssl: (OpenSSLProduct openssl) -> OpenSSLProduct
197198
def dest_dir: -> String
198199
def artifact: -> String

0 commit comments

Comments
 (0)