mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
73b4152574
Previously, `libmruby.a` was created even if only `mruby-bin-mrbc` or` mruby-compiler` was specified for gem, but by specifying `disable_libmruby`, the creation of `libmruby.a` can be suppressed. ### Note The https://github.com/mruby/mruby/pull/5084#issuecomment-723521971 incompatibility seems to be difficult for users to avoid, so the original behavior has been restored. Therefore, if we need `mrbc` other than the `host` build, we need to explicitly specify `mruby-bin-mrbc` gem. Due to the above changes, `build_config/boxing.rb` etc. will not work, but I have added` mruby-bin-mrbc` to `default.gembox` to fix it. I don't think this change is a big deal because originally `mruby-compiler` was included.
33 lines
809 B
Ruby
33 lines
809 B
Ruby
MRuby.each_target do
|
|
next unless libmruby_enabled?
|
|
|
|
src = "#{build_dir}/mrblib/mrblib.c"
|
|
obj = objfile(src.ext)
|
|
rbfiles = Dir["#{MRUBY_ROOT}/mrblib/*.rb"].sort!
|
|
|
|
self.libmruby_objs << obj
|
|
|
|
file obj => src
|
|
file src => [mrbcfile, __FILE__, *rbfiles] do |t|
|
|
mkdir_p File.dirname(t.name)
|
|
File.open(t.name, 'w') do |f|
|
|
_pp "GEN", "mrblib/*.rb", "#{t.name.relative_path}"
|
|
f.puts %Q[/*]
|
|
f.puts %Q[ * This file is loading the mrblib]
|
|
f.puts %Q[ *]
|
|
f.puts %Q[ * IMPORTANT:]
|
|
f.puts %Q[ * This file was generated!]
|
|
f.puts %Q[ * All manual changes will get lost.]
|
|
f.puts %Q[ */]
|
|
mrbc.run f, rbfiles, 'mrblib_proc'
|
|
f.puts <<INIT_END
|
|
void
|
|
mrb_init_mrblib(mrb_state *mrb)
|
|
{
|
|
mrb_load_proc(mrb, mrblib_proc);
|
|
}
|
|
INIT_END
|
|
end
|
|
end
|
|
end
|