Update build process for both host and cross compile.
MODIFY
lib/mruby/build.rb
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?
@@ -248,7 +248,8 @@ EOS
return @mrbcfile if @mrbcfile
unless gems.detect {|v| v.name == 'mruby-bin-mrbc' }
- gem :core => "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

MODIFY
lib/mruby/build/load_gems.rb
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)

MODIFY
lib/mruby/gem.rb
lib/mruby/gem.rb
@@ -47,6 +47,8 @@ module MRuby
@version = "0.0.0"
@mrblib_dir = "mrblib"
@objs_dir = "src"
+ @dependencies = []
+ @conflicts = []
MRuby::Gem.current = self
end
@@ -75,7 +77,6 @@ module MRuby
@bins = []
@requirements = []
- @dependencies, @conflicts = [], []
@export_include_paths = []
@export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include"

Update build process for both host and cross compile.