diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-12-05 14:08:29 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-05 14:08:29 +0900 |
| commit | 63d82142a8d3915d977fd97fc2ee82b5951065ed (patch) | |
| tree | c501616276d35505525aa3532361552d3ed84c3b /lib | |
| parent | 00d1fd0e6fee6cef2565c4a3b2dd428b0d59f4bf (diff) | |
| parent | 73b4152574f0dd6747488662751f59f8c4c0b50d (diff) | |
| download | mruby-63d82142a8d3915d977fd97fc2ee82b5951065ed.tar.gz mruby-63d82142a8d3915d977fd97fc2ee82b5951065ed.zip | |
Merge pull request #5212 from shuujii/make-it-possible-that-libmruby.a-is-not-created
Make it possible that `libmruby.a` is not created
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mruby/build.rb | 33 | ||||
| -rw-r--r-- | lib/mruby/gem.rb | 4 |
2 files changed, 24 insertions, 13 deletions
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index a9e84effe..c4ed79fb1 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -53,7 +53,7 @@ module MRuby include Rake::DSL include LoadGems attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir - attr_reader :libmruby_objs, :gems, :toolchains, :gem_dir_to_repo_url + attr_reader :libmruby_core_objs, :libmruby_objs, :gems, :toolchains, :gem_dir_to_repo_url alias libmruby libmruby_objs @@ -66,7 +66,7 @@ module MRuby def initialize(name='host', build_dir=nil, &block) @name = name.to_s - unless MRuby.targets[@name] + unless current = MRuby.targets[@name] if ENV['OS'] == 'Windows_NT' @exts = Exts.new('.o', '.exe', '.a') else @@ -91,7 +91,9 @@ module MRuby @bins = [] @gems = MRuby::Gem::List.new - @libmruby_objs = [] + @libmruby_core_objs = [] + @libmruby_objs = [@libmruby_core_objs] + @enable_libmruby = true @build_mrbtest_lib_only = false @cxx_exception_enabled = false @cxx_exception_disabled = false @@ -102,15 +104,22 @@ module MRuby @toolchains = [] @gem_dir_to_repo_url = {} - MRuby.targets[@name] = self + MRuby.targets[@name] = self.class.current = current = self end - current = MRuby.targets[@name] - MRuby::Build.current = current current.instance_eval(&block) + current.build_mrbc_exec if current.libmruby_enabled? && @name == "host" current.build_mrbtest if current.test_enabled? end + def libmruby_enabled? + @enable_libmruby + end + + def disable_libmruby + @enable_libmruby = false + end + def debug_enabled? @enable_debug end @@ -255,11 +264,9 @@ EOS def mrbcfile return @mrbcfile if @mrbcfile - unless gems.detect {|v| v.name == 'mruby-bin-mrbc' } - build_mrbc_exec - gems.detect {|v| v.name == 'mruby-bin-mrbc' }.setup - end - @mrbcfile = self.exefile("#{self.build_dir}/bin/mrbc") + gem_name = "mruby-bin-mrbc" + gem = gems[gem_name] || MRuby.targets["host"].gems[gem_name] + @mrbcfile = exefile("#{gem.build.build_dir}/bin/mrbc") end def compilers @@ -392,6 +399,7 @@ EOS toolchain :gcc end conf.gem :core => 'mruby-bin-mrbc' + conf.disable_libmruby end end @endian = nil @@ -400,8 +408,7 @@ EOS end def mrbcfile - host = MRuby.targets['host'] - host.exefile("#{host.build_dir}/bin/mrbc") + MRuby.targets['host'].mrbcfile end def run_test diff --git a/lib/mruby/gem.rb b/lib/mruby/gem.rb index eb94c9eda..e3b758f4f 100644 --- a/lib/mruby/gem.rb +++ b/lib/mruby/gem.rb @@ -353,6 +353,10 @@ module MRuby @ary.each(&b) end + def [](name) + @ary.detect {|g| g.name == name} + end + def <<(gem) unless @ary.detect {|g| g.dir == gem.dir } @ary << gem |
