Class: Tebako::RubyBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/tebako/ruby_builder.rb

Overview

Tebako packaging support (ruby builder)

Instance Method Summary collapse

Constructor Details

#initialize(ruby_ver, src_dir) ⇒ RubyBuilder

Returns a new instance of RubyBuilder.



37
38
39
40
41
# File 'lib/tebako/ruby_builder.rb', line 37

def initialize(ruby_ver, src_dir)
  @ruby_ver = ruby_ver
  @src_dir = src_dir
  @ncores = ScenarioManagerBase.new.ncores
end

Instance Method Details

#make_target(*args) ⇒ Object

Ruby's parallel build can race on ext/extinit.o: the ruby link step can start before extinit.o is (re)built after configure-ext.mk is regenerated, giving "clang: error: no such file or directory: 'ext/extinit.o'". A second, serial pass is mostly cached and builds the raced target deterministically, so retry once serially.



47
48
49
50
51
# File 'lib/tebako/ruby_builder.rb', line 47

def make_target(*args)
  BuildHelpers.run_with_capture(["make", *args, "-j#{@ncores}"])
rescue Tebako::Error
  BuildHelpers.run_with_capture(["make", *args])
end

#target_build(output_type) ⇒ Object

Final build of tebako package



63
64
65
66
67
68
69
# File 'lib/tebako/ruby_builder.rb', line 63

def target_build(output_type)
  puts "   ... building tebako #{output_type}"
  Dir.chdir(@src_dir) do
    make_target("ruby") if @ruby_ver.ruby3x?
    make_target
  end
end

#toolchain_buildObject

Final build of tebako package



54
55
56
57
58
59
60
# File 'lib/tebako/ruby_builder.rb', line 54

def toolchain_build
  puts "   ... building toolchain Ruby"
  Dir.chdir(@src_dir) do
    make_target
    make_target("install")
  end
end