Skip to content

Commit 8788d54

Browse files
Merge pull request #15 from ruby/katei/fix-gem-default-dir
build: build with baseruby that is compiled from the same source
2 parents c2ee698 + 1e1f70c commit 8788d54

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

Rakefile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,17 @@ class BuildPlan
105105
"#{ext_build_dir}/extinit.o"
106106
end
107107

108+
def baseruby_name
109+
"baseruby-#{@params[:src]}"
110+
end
111+
112+
def baseruby_path
113+
"#{@base_dir}/build/deps/#{RbConfig::CONFIG["host"]}/opt/#{baseruby_name}/bin/ruby"
114+
end
115+
108116
def dep_tasks
109-
return [] if @params[:profile] == "minimal"
110-
["deps:libyaml-#{@params[:target]}"]
117+
return [baseruby_name] if @params[:profile] == "minimal"
118+
[baseruby_name, "deps:libyaml-#{@params[:target]}"]
111119
end
112120

113121
def check_deps
@@ -149,6 +157,7 @@ class BuildPlan
149157
args << "--with-static-linked-ext"
150158
args << %Q(--with-ext="#{default_exts}")
151159
args << %Q(--with-libyaml-dir="#{deps_install_dir}/libyaml/usr/local")
160+
args << %Q(--with-baseruby="#{baseruby_path}")
152161

153162
case target
154163
when "wasm32-unknown-wasi"
@@ -226,6 +235,18 @@ namespace :build do
226235
file source.configure_file => [source.src_dir] do
227236
sh "./autogen.sh", chdir: source.src_dir
228237
end
238+
239+
baseruby_install_dir = File.join(Dir.pwd, "/build/deps/#{RbConfig::CONFIG["host"]}/opt/baseruby-#{name}")
240+
baseruby_build_dir = File.join(Dir.pwd, "/build/deps/#{RbConfig::CONFIG["host"]}/baseruby-#{name}")
241+
242+
directory baseruby_build_dir
243+
244+
desc "build baseruby #{name}"
245+
task "baseruby-#{name}" => [source.src_dir, source.configure_file, baseruby_build_dir] do
246+
next if Dir.exist?(baseruby_install_dir)
247+
sh "#{source.configure_file} --prefix=#{baseruby_install_dir} --disable-install-doc", chdir: baseruby_build_dir
248+
sh "make install", chdir: baseruby_build_dir
249+
end
229250
end
230251

231252
BUILDS.each do |params|

builders/wasm32-unknown-emscripten/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM emscripten/emsdk:2.0.13
22

33
RUN set -eux; \
44
apt-get update; \
5-
apt-get install ruby bison make autoconf git curl -y; \
5+
apt-get install ruby bison make autoconf git curl build-essential libyaml-dev -y; \
66
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -; \
77
apt-get install nodejs -y; \
88
apt-get clean; \

builders/wasm32-unknown-wasi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ENV WASI_SDK_PATH="/opt/wasi-sdk"
1717

1818
RUN set -eux; \
1919
apt-get update; \
20-
apt-get install ruby bison make autoconf git curl -y; \
20+
apt-get install ruby bison make autoconf git curl build-essential libyaml-dev -y; \
2121
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -; \
2222
apt-get install nodejs -y; \
2323
apt-get clean; \

0 commit comments

Comments
 (0)