Class: RubyWasm::Toolchain
- Inherits:
-
Object
- Object
- RubyWasm::Toolchain
- Defined in:
- lib/ruby_wasm/build/toolchain.rb,
sig/ruby_wasm/build.rbs
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .check_executable(command) ⇒ String
- .find_path(command) ⇒ String?
- .get(target, options, build_dir = nil) ⇒ Toolchain
Instance Method Summary collapse
- #ar ⇒ String
- #cc ⇒ String
- #check_envvar(name) ⇒ void
- #cxx ⇒ String
- #find_tool(name) ⇒ String
-
#initialize ⇒ Toolchain
constructor
A new instance of Toolchain.
- #install ⇒ void
- #ld ⇒ String
- #ranlib ⇒ String
Constructor Details
#initialize ⇒ Toolchain
Returns a new instance of Toolchain.
7 8 9 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 7 def initialize @tools = {} end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 5 def name @name end |
Class Method Details
.check_executable(command) ⇒ String
45 46 47 48 49 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 45 def self.check_executable(command) tool = find_path(command) raise "missing executable: #{command}" unless tool tool end |
.find_path(command) ⇒ String?
35 36 37 38 39 40 41 42 43 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 35 def self.find_path(command) (ENV["PATH"] || "") .split(File::PATH_SEPARATOR) .each do |path_dir| bin_path = File.join(path_dir, command) return bin_path if File.executable?(bin_path) end nil end |
.get(target, options, build_dir = nil) ⇒ Toolchain
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 19 def self.get(target, , build_dir = nil) case target when /^wasm32-unknown-wasi/ return( RubyWasm::WASISDK.new( build_dir: build_dir, version: [:wasi_sdk_version] ) ) when "wasm32-unknown-emscripten" return RubyWasm::Emscripten.new else raise "unknown target: #{target}" end end |
Instance Method Details
#ar ⇒ String
251 |
# File 'sig/ruby_wasm/build.rbs', line 251
def ar: -> String
|
#cc ⇒ String
247 |
# File 'sig/ruby_wasm/build.rbs', line 247
def cc: -> String
|
#check_envvar(name) ⇒ void
This method returns an undefined value.
15 16 17 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 15 def check_envvar(name) raise "missing environment variable: #{name}" if ENV[name].nil? end |
#cxx ⇒ String
248 |
# File 'sig/ruby_wasm/build.rbs', line 248
def cxx: -> String
|
#find_tool(name) ⇒ String
11 12 13 |
# File 'lib/ruby_wasm/build/toolchain.rb', line 11 def find_tool(name) raise "not implemented" end |
#install ⇒ void
This method returns an undefined value.
253 |
# File 'sig/ruby_wasm/build.rbs', line 253
def install: (_CommandExecutor executor) -> void
|
#ld ⇒ String
250 |
# File 'sig/ruby_wasm/build.rbs', line 250
def ld: -> String
|
#ranlib ⇒ String
249 |
# File 'sig/ruby_wasm/build.rbs', line 249
def ranlib: -> String
|