summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2020-12-05 09:16:08 +0900
committerKOBAYASHI Shuji <[email protected]>2020-12-05 09:16:08 +0900
commit73b4152574f0dd6747488662751f59f8c4c0b50d (patch)
tree276b3dd985af38345c4561f43d7961b4c13a1a9f /mrbgems
parent4cd349373779bb643444f85fa1d04b0769c58c63 (diff)
downloadmruby-73b4152574f0dd6747488662751f59f8c4c0b50d.tar.gz
mruby-73b4152574f0dd6747488662751f59f8c4c0b50d.zip
Make it possible that `libmruby.a` is not created
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.
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/default.gembox3
-rw-r--r--mrbgems/mruby-bin-mrbc/mrbgem.rake7
-rw-r--r--mrbgems/mruby-compiler/mrbgem.rake27
3 files changed, 17 insertions, 20 deletions
diff --git a/mrbgems/default.gembox b/mrbgems/default.gembox
index de169906b..ca8938e87 100644
--- a/mrbgems/default.gembox
+++ b/mrbgems/default.gembox
@@ -78,6 +78,9 @@ MRuby::GemBox.new do |conf|
conf.gem :core => "mruby-rational"
conf.gem :core => "mruby-complex"
+ # Generate mrbc command
+ conf.gem :core => "mruby-bin-mrbc"
+
# Generate mirb command
conf.gem :core => "mruby-bin-mirb"
diff --git a/mrbgems/mruby-bin-mrbc/mrbgem.rake b/mrbgems/mruby-bin-mrbc/mrbgem.rake
index 48b67aedb..67200b3f0 100644
--- a/mrbgems/mruby-bin-mrbc/mrbgem.rake
+++ b/mrbgems/mruby-bin-mrbc/mrbgem.rake
@@ -2,15 +2,14 @@ MRuby::Gem::Specification.new 'mruby-bin-mrbc' do |spec|
spec.license = 'MIT'
spec.author = 'mruby developers'
spec.summary = 'mruby compiler executable'
-
spec.add_dependency 'mruby-compiler', :core => 'mruby-compiler'
exec = exefile("#{build.build_dir}/bin/mrbc")
- mrbc_objs = Dir.glob("#{spec.dir}/tools/mrbc/*.c").map { |f| objfile(f.pathmap("#{spec.build_dir}/tools/mrbc/%n")) }.flatten
+ mrbc_objs = Dir.glob("#{spec.dir}/tools/mrbc/*.c").map { |f| objfile(f.pathmap("#{spec.build_dir}/tools/mrbc/%n")) }
- file exec => mrbc_objs + [build.libmruby_core_static] do |t|
+ file exec => mrbc_objs << build.libmruby_core_static do |t|
build.linker.run t.name, t.prerequisites
end
- build.bins << 'mrbc' unless build.bins.find { |v| v == 'mrbc' }
+ build.bins << 'mrbc'
end
diff --git a/mrbgems/mruby-compiler/mrbgem.rake b/mrbgems/mruby-compiler/mrbgem.rake
index 9df846abb..70f9e19d8 100644
--- a/mrbgems/mruby-compiler/mrbgem.rake
+++ b/mrbgems/mruby-compiler/mrbgem.rake
@@ -3,20 +3,18 @@ MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
spec.author = 'mruby developers'
spec.summary = 'mruby compiler library'
- lex_def = "#{dir}/core/lex.def"
- core_objs = Dir.glob("#{dir}/core/*.c").map { |f|
- next nil if build.cxx_exception_enabled? and f =~ /(codegen|y\.tab)\.c$/
- objfile(f.pathmap("#{build_dir}/core/%n"))
- }.compact
-
- if build.cxx_exception_enabled?
- core_objs <<
- build.compile_as_cxx("#{dir}/core/y.tab.c", "#{build_dir}/core/y.tab.cxx",
- objfile("#{build_dir}/y.tab"), ["#{dir}/core"]) <<
- build.compile_as_cxx("#{dir}/core/codegen.c", "#{build_dir}/core/codegen.cxx")
- else
- core_objs << objfile("#{build_dir}/core/y.tab")
+ as_cxx_srcs = %w[codegen y.tab].map{|name| "#{dir}/core/#{name}.c"}
+ objs = Dir.glob("#{dir}/core/*.c").map do |src|
+ dst = src.pathmap("#{build_dir}/core/%n")
+ if build.cxx_exception_enabled? && as_cxx_srcs.include?(src)
+ build.compile_as_cxx(src, "#{dst}.cxx")
+ else
+ objfile(dst)
+ end
end
+ build.libmruby_core_objs << objs
+
+ lex_def = "#{dir}/core/lex.def"
# Parser
file "#{dir}/core/y.tab.c" => ["#{dir}/core/parse.y", lex_def] do |t|
@@ -30,9 +28,6 @@ MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
replace_line_directive(t.name)
end
- file build.libmruby_core_static => core_objs
- build.libmruby << core_objs
-
def replace_line_directive(path)
content = File.read(path).gsub(%r{
^\#line\s+\d+\s+"\K.*$ | # #line directive