Skip to content

Commit 7468a54

Browse files
committed
Make the emscripten build a bit configurable
This changeset introduces two environment variables: * `RUBY_WASM_EMCC_LDFLAGS` allows to specify additional options to `emcc` for linking. * `RUBY_WASM_ADDITIONAL_EXTS` allows to specify default exts to be compiled in addition to `RubyWasm::Packager::ALL_DEFAULT_EXTS`. This should allow for experimental linking with xterm-pty. ``` RUBY_WASM_ADDITIONAL_EXTS=io/console,io/wait RUBY_WASM_EMCC_LDFLAGS="-sASYNCIFY --js-library /home/mame/work/xterm-pty/emscripten-pty.js" rake npm:ruby-head-wasm-emscripten:build ```
1 parent c781b6c commit 7468a54

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/ruby_wasm/build/product/crossruby.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ def configure_args(build_triple, toolchain)
298298
args << %Q(WASI_SDK_PATH=#{wasi_sdk_path.wasi_sdk_path})
299299
when "wasm32-unknown-emscripten"
300300
ldflags.concat(%w[-s MODULARIZE=1])
301+
env_emcc_ldflags = ENV["RUBY_WASM_EMCC_LDFLAGS"] || ""
302+
unless env_emcc_ldflags.empty?
303+
ldflags << env_emcc_ldflags
304+
end
301305
else
302306
raise "unknown target: #{target}"
303307
end

lib/ruby_wasm/cli.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def build_config(options)
156156
case options[:profile]
157157
when "full"
158158
config[:default_exts] = RubyWasm::Packager::ALL_DEFAULT_EXTS
159+
env_additional_exts = ENV["RUBY_WASM_ADDITIONAL_EXTS"] || ""
160+
unless env_additional_exts.empty?
161+
config[:default_exts] += "," + env_additional_exts
162+
end
159163
when "minimal"
160164
config[:default_exts] = ""
161165
else

0 commit comments

Comments
 (0)