Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions mrbgems/mruby-bin-mrbc/mrbgem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@ MRuby::Gem::Specification.new 'mruby-bin-mrbc' do |spec|
build.bins << exe_name

build_settings do
# The compiler gem is set up by the time this block runs, whatever order
# the gems were processed in.
compiler = build.gems['mruby-compiler']

spec.cc.include_paths << "#{MRUBY_ROOT}/mrbgems/mruby-compiler/lib/prism/include"

# The layout of struct mrc_ccontext depends on MRC_TARGET_*; the tool's own
# translation units must use the same target define as mruby-compiler,
# otherwise field offsets (e.g. diagnostic_list) disagree across the link.
spec.cc.defines.flatten!
if spec.cc.defines.include?('PICORB_VM_MRUBY')
spec.cc.defines << 'MRC_TARGET_MRUBY'
elsif spec.cc.defines.include?('PICORB_VM_MRUBYC')
spec.cc.defines << 'MRC_TARGET_MRUBYC'
elsif !spec.cc.defines.include?('MRB_NO_GEMS')
spec.cc.defines << 'MRC_TARGET_MRUBY'
end
# Copy the one that gem settled on rather than deriving it a second time
# from the same build: two derivations can disagree, a copy cannot.
spec.cc.defines += compiler.cc.defines.flatten.grep(/\AMRC_TARGET_/)

mrbc_prism_objs = Dir.glob("#{dir}/tools/mrbc/*.c").map { |f| objfile(f.pathmap("#{build_dir}/tools/mrbc/%n")) }
# Ensure the compiler gem is set up so its objs are available regardless of
# the order in which gems are processed (setup is idempotent).
compiler = build.gems['mruby-compiler']
mrbc_prism_objs += compiler.objs
mrbc_prism_objs.delete_if { |o| o.include?('gem_init') || o.include?('mruby_compat') }

Expand Down
Loading