Skip to content

Commit e5fa660

Browse files
build: Split command arguments at Ruby level
1 parent 90ab43d commit e5fa660

File tree

3 files changed

+64
-15
lines changed

3 files changed

+64
-15
lines changed

lib/ruby_wasm/build/product/openssl.rb

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,28 @@ def build(executor)
5959

6060
executor.mkdir_p File.dirname(product_build_dir)
6161
executor.rm_rf product_build_dir
62-
executor.system "curl -L https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz | tar xz",
63-
chdir: File.dirname(product_build_dir)
62+
executor.mkdir_p product_build_dir
63+
tarball_path =
64+
File.join(product_build_dir, "openssl-#{OPENSSL_VERSION}.tar.gz")
65+
executor.system "curl",
66+
"-o",
67+
tarball_path,
68+
"-L",
69+
"https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
70+
executor.system "tar",
71+
"xzf",
72+
tarball_path,
73+
"-C",
74+
product_build_dir,
75+
"--strip-components=1"
6476

65-
executor.system "./Configure #{configure_args.join(" ")}",
66-
chdir: product_build_dir
77+
executor.system "./Configure", *configure_args, chdir: product_build_dir
6778
# Use "install_sw" instead of "install" because it tries to install docs and it's very slow.
6879
# OpenSSL build system doesn't have well support for parallel build, so force -j1.
69-
executor.system "make -j1 install_sw DESTDIR=#{destdir}",
80+
executor.system "make",
81+
"-j1",
82+
"install_sw",
83+
"DESTDIR=#{destdir}",
7084
chdir: product_build_dir
7185
end
7286
end

lib/ruby_wasm/build/product/ruby_source.rb

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,26 @@ def fetch(executor)
3636
when "github"
3737
repo_url = "https://github.com/#{@params[:repo]}.git"
3838
executor.mkdir_p src_dir
39-
executor.system "git init", chdir: src_dir
40-
executor.system "git remote add origin #{repo_url}", chdir: src_dir
39+
executor.system "git", "init", chdir: src_dir
40+
executor.system "git",
41+
"remote",
42+
"add",
43+
"origin",
44+
repo_url,
45+
chdir: src_dir
4146
executor.system(
42-
"git fetch --depth 1 origin #{@params[:rev]}:origin/#{@params[:rev]}",
47+
"git",
48+
"fetch",
49+
"--depth",
50+
"1",
51+
"origin",
52+
"#{@params[:rev]}:origin/#{@params[:rev]}",
4353
chdir: src_dir
4454
) or raise "failed to clone #{repo_url}"
4555
executor.system(
46-
"git checkout origin/#{@params[:rev]}",
56+
"git",
57+
"checkout",
58+
"origin/#{@params[:rev]}",
4759
chdir: src_dir
4860
) or raise "failed to checkout #{@params[:rev]}"
4961
when "local"
@@ -53,15 +65,22 @@ def fetch(executor)
5365
raise "unknown source type: #{@params[:type]}"
5466
end
5567
(@params[:patches] || []).each do |patch_path|
56-
executor.system "patch -p1 < #{patch_path}", chdir: src_dir
68+
executor.system "patch", "-p1", patch_path, chdir: src_dir
5769
end
5870
end
5971

6072
def build(executor)
6173
fetch(executor) unless File.exist?(src_dir)
6274
unless File.exist?(configure_file)
6375
Dir.chdir(src_dir) do
64-
executor.system "ruby tool/downloader.rb -d tool -e gnu config.guess config.sub" or
76+
executor.system "ruby",
77+
"tool/downloader.rb",
78+
"-d",
79+
"tool",
80+
"-e",
81+
"gnu",
82+
"config.guess",
83+
"config.sub" or
6584
raise "failed to download config.guess and config.sub"
6685
executor.system "./autogen.sh" or raise "failed to run autogen.sh"
6786
end

lib/ruby_wasm/build/product/zlib.rb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,29 @@ def build(executor)
3939

4040
executor.mkdir_p File.dirname(product_build_dir)
4141
executor.rm_rf product_build_dir
42+
executor.mkdir_p product_build_dir
4243

43-
executor.system "curl -L https://zlib.net/zlib-#{ZLIB_VERSION}.tar.gz | tar xz",
44-
chdir: File.dirname(product_build_dir)
44+
tarball_path = File.join(product_build_dir, "zlib-#{ZLIB_VERSION}.tar.gz")
45+
executor.system "curl",
46+
"-o",
47+
tarball_path,
48+
"-L",
49+
"https://zlib.net/zlib-#{ZLIB_VERSION}.tar.gz"
50+
executor.system "tar",
51+
"xzf",
52+
tarball_path,
53+
"-C",
54+
product_build_dir,
55+
"--strip-components=1"
4556

46-
executor.system "#{configure_args.join(" ")} ./configure --static",
57+
executor.system "env",
58+
*configure_args,
59+
"./configure",
60+
"--static",
4761
chdir: product_build_dir
48-
executor.system "make install DESTDIR=#{destdir}",
62+
executor.system "make",
63+
"install",
64+
"DESTDIR=#{destdir}",
4965
chdir: product_build_dir
5066
end
5167
end

0 commit comments

Comments
 (0)