diff --git a/Rakefile b/Rakefile index 0033b6b54..f975b7af7 100644 --- a/Rakefile +++ b/Rakefile @@ -105,9 +105,17 @@ class BuildPlan "#{ext_build_dir}/extinit.o" end + def baseruby_name + "baseruby-#{@params[:src]}" + end + + def baseruby_path + "#{@base_dir}/build/deps/#{RbConfig::CONFIG["host"]}/opt/#{baseruby_name}/bin/ruby" + end + def dep_tasks - return [] if @params[:profile] == "minimal" - ["deps:libyaml-#{@params[:target]}"] + return [baseruby_name] if @params[:profile] == "minimal" + [baseruby_name, "deps:libyaml-#{@params[:target]}"] end def check_deps @@ -149,6 +157,7 @@ class BuildPlan args << "--with-static-linked-ext" args << %Q(--with-ext="#{default_exts}") args << %Q(--with-libyaml-dir="#{deps_install_dir}/libyaml/usr/local") + args << %Q(--with-baseruby="#{baseruby_path}") case target when "wasm32-unknown-wasi" @@ -226,6 +235,18 @@ namespace :build do file source.configure_file => [source.src_dir] do sh "./autogen.sh", chdir: source.src_dir end + + baseruby_install_dir = File.join(Dir.pwd, "/build/deps/#{RbConfig::CONFIG["host"]}/opt/baseruby-#{name}") + baseruby_build_dir = File.join(Dir.pwd, "/build/deps/#{RbConfig::CONFIG["host"]}/baseruby-#{name}") + + directory baseruby_build_dir + + desc "build baseruby #{name}" + task "baseruby-#{name}" => [source.src_dir, source.configure_file, baseruby_build_dir] do + next if Dir.exist?(baseruby_install_dir) + sh "#{source.configure_file} --prefix=#{baseruby_install_dir} --disable-install-doc", chdir: baseruby_build_dir + sh "make install", chdir: baseruby_build_dir + end end BUILDS.each do |params| diff --git a/builders/wasm32-unknown-emscripten/Dockerfile b/builders/wasm32-unknown-emscripten/Dockerfile index 601659690..c14de5de9 100644 --- a/builders/wasm32-unknown-emscripten/Dockerfile +++ b/builders/wasm32-unknown-emscripten/Dockerfile @@ -2,7 +2,7 @@ FROM emscripten/emsdk:2.0.13 RUN set -eux; \ apt-get update; \ - apt-get install ruby bison make autoconf git curl -y; \ + apt-get install ruby bison make autoconf git curl build-essential libyaml-dev -y; \ curl -fsSL https://deb.nodesource.com/setup_16.x | bash -; \ apt-get install nodejs -y; \ apt-get clean; \ diff --git a/builders/wasm32-unknown-wasi/Dockerfile b/builders/wasm32-unknown-wasi/Dockerfile index c7b527339..3b924380e 100644 --- a/builders/wasm32-unknown-wasi/Dockerfile +++ b/builders/wasm32-unknown-wasi/Dockerfile @@ -17,7 +17,7 @@ ENV WASI_SDK_PATH="/opt/wasi-sdk" RUN set -eux; \ apt-get update; \ - apt-get install ruby bison make autoconf git curl -y; \ + apt-get install ruby bison make autoconf git curl build-essential libyaml-dev -y; \ curl -fsSL https://deb.nodesource.com/setup_16.x | bash -; \ apt-get install nodejs -y; \ apt-get clean; \