Class: RubyWasm::BaseRubyProduct

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

Instance Method Summary collapse

Constructor Details

#initialize(build_dir, source) ⇒ BaseRubyProduct

Returns a new instance of BaseRubyProduct.



5
6
7
8
9
# File 'lib/ruby_wasm/build/product/baseruby.rb', line 5

def initialize(build_dir, source)
  @build_dir = build_dir
  @source = source
  @channel = source.name
end

Instance Method Details

#build(executor) ⇒ Object



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

def build(executor)
  executor.mkdir_p product_build_dir
  @source.build(executor)
  return if Dir.exist?(install_dir)
  executor.system @source.configure_file,
                  "--prefix=#{install_dir}",
                  "--disable-install-doc",
                  chdir: product_build_dir
  executor.system "make",
                  "-j#{executor.process_count}",
                  "install",
                  chdir: product_build_dir
end

#install_dirObject



15
16
17
# File 'lib/ruby_wasm/build/product/baseruby.rb', line 15

def install_dir
  File.join(product_build_dir, "opt")
end

#nameObject



19
20
21
# File 'lib/ruby_wasm/build/product/baseruby.rb', line 19

def name
  "baseruby-#{@channel}"
end

#product_build_dirObject



11
12
13
# File 'lib/ruby_wasm/build/product/baseruby.rb', line 11

def product_build_dir
  File.join(@build_dir, RbConfig::CONFIG["host"], "baseruby-#{@channel}")
end