Skip to content

Commit 5173cdb

Browse files
Remove rake dependency from libyaml product
1 parent 06a9e8e commit 5173cdb

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

lib/ruby_wasm/build_system/product/crossruby.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def build_exts
130130
def build(remake: false, reconfigure: false)
131131
FileUtils.mkdir_p dest_dir
132132
FileUtils.mkdir_p build_dir
133-
[@source, @baseruby].each(&:build)
133+
[@source, @baseruby, @libyaml].each(&:build)
134134
dep_tasks.each(&:invoke)
135135
configure(reconfigure: reconfigure)
136136
build_exts
@@ -160,7 +160,6 @@ def ext_build_dir
160160

161161
def with_libyaml(libyaml)
162162
@libyaml = libyaml
163-
@dep_tasks << libyaml.install_task
164163
end
165164

166165
def with_zlib(zlib)

lib/ruby_wasm/build_system/product/libyaml.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
require "rake"
21
require_relative "./product"
32

43
module RubyWasm
54
class LibYAMLProduct < AutoconfProduct
6-
attr_reader :target, :install_task
5+
attr_reader :target
76

87
LIBYAML_VERSION = "0.2.5"
98

@@ -29,23 +28,20 @@ def name
2928
product_build_dir
3029
end
3130

32-
def define_task
33-
@install_task =
34-
task name => [@toolchain.define_task] do
35-
next if Dir.exist?(install_root)
31+
def build
32+
return if Dir.exist?(install_root)
3633

37-
mkdir_p File.dirname(product_build_dir)
38-
rm_rf product_build_dir
39-
sh "curl -L https://github.com/yaml/libyaml/releases/download/#{LIBYAML_VERSION}/yaml-#{LIBYAML_VERSION}.tar.gz | tar xz",
34+
FileUtils.mkdir_p File.dirname(product_build_dir)
35+
FileUtils.rm_rf product_build_dir
36+
system "curl -L https://github.com/yaml/libyaml/releases/download/#{LIBYAML_VERSION}/yaml-#{LIBYAML_VERSION}.tar.gz | tar xz",
4037
chdir: File.dirname(product_build_dir)
4138

42-
# obtain the latest config.guess and config.sub for Emscripten and WASI triple support
43-
sh "curl -o #{product_build_dir}/config/config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'"
44-
sh "curl -o #{product_build_dir}/config/config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'"
39+
# obtain the latest config.guess and config.sub for Emscripten and WASI triple support
40+
system "curl -o #{product_build_dir}/config/config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'"
41+
system "curl -o #{product_build_dir}/config/config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'"
4542

46-
sh "./configure #{configure_args.join(" ")}", chdir: product_build_dir
47-
sh "make install DESTDIR=#{destdir}", chdir: product_build_dir
48-
end
43+
system "./configure #{configure_args.join(" ")}", chdir: product_build_dir
44+
system "make install DESTDIR=#{destdir}", chdir: product_build_dir
4945
end
5046
end
5147
end

lib/ruby_wasm/rake_task.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ def initialize(
4343
@toolchain =
4444
add_product (toolchain || RubyWasm::Toolchain.get(target, @build_dir))
4545

46-
@libyaml =
47-
add_product RubyWasm::LibYAMLProduct.new(@build_dir, @target, @toolchain)
46+
@libyaml = RubyWasm::LibYAMLProduct.new(@build_dir, @target, @toolchain)
4847
@zlib =
4948
add_product RubyWasm::ZlibProduct.new(@build_dir, @target, @toolchain)
5049
@wasi_vfs = add_product RubyWasm::WasiVfsProduct.new(@build_dir)

0 commit comments

Comments
 (0)