44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/ruby_wasm/cli.rb', line 44
def build(args)
options = {
save_temps: false,
optimize: false,
remake: false,
reconfigure: false,
clean: false,
ruby_version: "3.3",
target_triplet: "wasm32-unknown-wasip1",
profile: "full",
stdlib: true,
without_stdlib_components: [],
dest_dir: nil,
disable_gems: false,
gemfile: nil,
patches: [],
}
OptionParser
.new do |opts|
opts.banner = "Usage: rbwasm build [options]"
opts.on("-h", "--help", "Prints this help") do
@stdout.puts opts
exit
end
opts.on("--save-temps", "Save temporary files") do
options[:save_temps] = true
end
opts.on("--ruby-version VERSION", "Ruby version") do |version|
options[:ruby_version] = version
end
opts.on("--target TRIPLET", "Target triplet") do |triplet|
options[:target_triplet] = triplet
end
opts.on(
"--build-profile PROFILE",
"Build profile. full or minimal"
) { |profile| options[:profile] = profile }
opts.on("--optimize", "Optimize the output") do
options[:optimize] = true
end
opts.on("--remake", "Re-execute make for Ruby") do
options[:remake] = true
end
opts.on("--reconfigure", "Re-execute configure for Ruby") do
options[:reconfigure] = true
end
opts.on("--clean", "Clean build artifacts") { options[:clean] = true }
opts.on("-o", "--output FILE", "Output file") do |file|
options[:output] = file
end
opts.on("--[no-]stdlib", "Include stdlib") do |stdlib|
options[:stdlib] = stdlib
end
opts.on("--without-stdlib COMPONENT", "Exclude stdlib component") do |component|
options[:without_stdlib_components] << component
end
opts.on("--disable-gems", "Disable gems") do
options[:disable_gems] = true
end
opts.on("--dest-dir PATH", "(Experimental) Destination directory") do |path|
options[:dest_dir] = path
end
opts.on("-p", "--patch PATCH", "Apply a patch") do |patch|
options[:patches] << patch
end
opts.on("--format FORMAT", "Output format") do |format|
options[:format] = format
end
opts.on("--print-ruby-cache-key", "Print Ruby cache key") do
options[:print_ruby_cache_key] = true
end
end
.parse!(args)
__skip__ = if defined?(Bundler)
Bundler.settings.temporary(force_ruby_platform: true) do
do_build_with_force_ruby_platform(options)
end
else
do_build_with_force_ruby_platform(options)
end
end
|