Skip to content

Commit ea36739

Browse files
Merge pull request #481 from ruby/katei/remove-build-hack
Build baseruby before building extensions for PIC target
2 parents 73d3d5a + f3ed2a5 commit ea36739

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

lib/ruby_wasm/build/product/crossruby.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def do_extconf(executor, crossruby)
7171
return
7272
end
7373
objdir = product_build_dir crossruby
74-
source = crossruby.source
7574
rbconfig_rb = Dir.glob(File.join(crossruby.dest_dir, "usr/local/lib/ruby/*/wasm32-wasi/rbconfig.rb")).first
7675
raise "rbconfig.rb not found" unless rbconfig_rb
7776
extconf_args = [
@@ -359,6 +358,10 @@ def configure_args(build_triple, toolchain)
359358
args << %Q(wasmoptflags=#{@wasmoptflags.join(" ")})
360359
end
361360
args << "--disable-install-doc"
361+
unless @params.target.pic?
362+
# TODO: Remove this hack after dropping Ruby 3.2 support
363+
args << "ac_cv_func_dlopen=no"
364+
end
362365
args
363366
end
364367
end

lib/ruby_wasm/packager/core.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ def _link_gem_exts(executor, build, ruby_root, gem_home, module_bytes)
181181
end
182182

183183
def _build_gem_exts(executor, build, gem_home)
184+
build.toolchain.install
185+
baseruby = build.baseruby
186+
unless Dir.exist?(baseruby.install_dir)
187+
baseruby.build(executor)
188+
end
189+
184190
exts = specs_with_extensions.flat_map do |spec, exts|
185191
exts.map do |ext|
186192
ext_feature = File.dirname(ext) # e.g. "ext/cgi/escape"

rakelib/packaging.rake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ def npm_pkg_build_command(pkg)
2525
end
2626

2727
def npm_pkg_rubies_cache_key(pkg)
28-
# FIXME: Now CrossRubyExtProduct depends on just built baseruby, and exts can be
29-
# built after restoring the tarball cache. So it can fail to find baseruby when the
30-
# cache hit. We need to orchestrate the build dependency graph properly.
31-
return nil if pkg[:name] == "ruby-head-wasm-wasi"
3228
build_command = npm_pkg_build_command(pkg)
3329
return nil unless build_command
3430
require "open3"

sig/ruby_wasm/build.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module RubyWasm
3333
@source: BuildSource
3434

3535
attr_reader toolchain: Toolchain
36+
attr_reader baseruby: BaseRubyProduct
3637

3738
def initialize: (
3839
string name,

0 commit comments

Comments
 (0)