Class: RubyWasm::AutoconfProduct

Inherits:
BuildProduct show all
Defined in:
lib/ruby_wasm/build/product/product.rb

Instance Method Summary collapse

Methods inherited from BuildProduct

#name

Constructor Details

#initialize(target, toolchain) ⇒ AutoconfProduct

Returns a new instance of AutoconfProduct.



9
10
11
12
# File 'lib/ruby_wasm/build/product/product.rb', line 9

def initialize(target, toolchain)
  @target = target
  @toolchain = toolchain
end

Instance Method Details

#configure_argsObject



36
37
38
# File 'lib/ruby_wasm/build/product/product.rb', line 36

def configure_args
  system_triplet_args + tools_args
end

#system_triplet_argsObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby_wasm/build/product/product.rb', line 13

def system_triplet_args
  args = []
  case @target.triple
  when /^wasm32-unknown-wasi/
    args.concat(%W[--host wasm32-wasi])
  when "wasm32-unknown-emscripten"
    args.concat(%W[--host wasm32-emscripten])
  else
    raise "unknown target: #{@target.triple}"
  end
  args
end

#tools_argsObject



26
27
28
29
30
31
32
33
34
# File 'lib/ruby_wasm/build/product/product.rb', line 26

def tools_args
  args = []
  args << "CC=#{@toolchain.cc}"
  args << "CXX=#{@toolchain.cxx}"
  args << "LD=#{@toolchain.ld}"
  args << "AR=#{@toolchain.ar}"
  args << "RANLIB=#{@toolchain.ranlib}"
  args
end