diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-26 17:38:58 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 16:21:52 +0900 |
| commit | 2bb84f1f1ae4bfca49bd92d8d0102a5773d3270f (patch) | |
| tree | 4168038ee9fe29f1a1189e2e018c3033e37c3e31 /lib | |
| parent | 850e200e845be30ba18da8eedc5a50d33566523d (diff) | |
| download | mruby-2bb84f1f1ae4bfca49bd92d8d0102a5773d3270f.tar.gz mruby-2bb84f1f1ae4bfca49bd92d8d0102a5773d3270f.zip | |
Update build process for both host and cross compile.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mruby/build.rb | 17 | ||||
| -rw-r--r-- | lib/mruby/build/load_gems.rb | 13 | ||||
| -rw-r--r-- | lib/mruby/gem.rb | 5 |
3 files changed, 19 insertions, 16 deletions
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 3ad7f3c4c..fa3853342 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -81,7 +81,8 @@ module MRuby @mrbc = Command::Mrbc.new(self) @bins = [] - @gems, @libmruby_objs = MRuby::Gem::List.new, [] + @gems = MRuby::Gem::List.new + @libmruby_objs = [] @build_mrbtest_lib_only = false @cxx_exception_enabled = false @cxx_exception_disabled = false @@ -95,11 +96,10 @@ module MRuby MRuby.targets[@name] = self end - MRuby::Build.current = MRuby.targets[@name] - MRuby.targets[@name].instance_eval(&block) - - build_mrbc_exec if name == 'host' - build_mrbtest if test_enabled? + current = MRuby.targets[@name] + MRuby::Build.current = current + current.instance_eval(&block) + current.build_mrbtest if current.test_enabled? end def debug_enabled? @@ -247,8 +247,9 @@ EOS def mrbcfile return @mrbcfile if @mrbcfile - unless gems.detect { |v| v.name == 'mruby-bin-mrbc' } - gem :core => "mruby-bin-mrbc" + 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") end diff --git a/lib/mruby/build/load_gems.rb b/lib/mruby/build/load_gems.rb index 522b8a17e..4f5bde7af 100644 --- a/lib/mruby/build/load_gems.rb +++ b/lib/mruby/build/load_gems.rb @@ -28,18 +28,19 @@ module MRuby Gem.current = nil load gemrake return nil unless Gem.current + current = Gem.current - Gem.current.dir = gemdir - Gem.current.build = self.is_a?(MRuby::Build) ? self : MRuby::Build.current - Gem.current.build_config_initializer = block - gems << Gem.current + current.dir = gemdir + current.build = self.is_a?(MRuby::Build) ? self : MRuby::Build.current + current.build_config_initializer = block + gems << current cxx_srcs = ['src', 'test', 'tools'].map do |subdir| - Dir.glob("#{Gem.current.dir}/#{subdir}/*.{cpp,cxx,cc}") + Dir.glob("#{current.dir}/#{subdir}/*.{cpp,cxx,cc}") end.flatten enable_cxx_exception unless cxx_srcs.empty? - Gem.current + current end def load_special_path_gem(params) diff --git a/lib/mruby/gem.rb b/lib/mruby/gem.rb index d6b1a6851..d4b43b094 100644 --- a/lib/mruby/gem.rb +++ b/lib/mruby/gem.rb @@ -47,12 +47,14 @@ module MRuby @version = "0.0.0" @mrblib_dir = "mrblib" @objs_dir = "src" + @dependencies = [] + @conflicts = [] MRuby::Gem.current = self end def setup return if defined?(@linker) # return if already set up - + MRuby::Gem.current = self MRuby::Build::COMMANDS.each do |command| instance_variable_set("@#{command}", @build.send(command).clone) @@ -75,7 +77,6 @@ module MRuby @bins = [] @requirements = [] - @dependencies, @conflicts = [], [] @export_include_paths = [] @export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include" |
