Update build process for both host and cross compile.

parent 850e200e
...@@ -81,7 +81,8 @@ module MRuby ...@@ -81,7 +81,8 @@ module MRuby
@mrbc = Command::Mrbc.new(self) @mrbc = Command::Mrbc.new(self)
@bins = [] @bins = []
@gems, @libmruby_objs = MRuby::Gem::List.new, [] @gems = MRuby::Gem::List.new
@libmruby_objs = []
@build_mrbtest_lib_only = false @build_mrbtest_lib_only = false
@cxx_exception_enabled = false @cxx_exception_enabled = false
@cxx_exception_disabled = false @cxx_exception_disabled = false
...@@ -95,11 +96,10 @@ module MRuby ...@@ -95,11 +96,10 @@ module MRuby
MRuby.targets[@name] = self MRuby.targets[@name] = self
end end
MRuby::Build.current = MRuby.targets[@name] current = MRuby.targets[@name]
MRuby.targets[@name].instance_eval(&block) MRuby::Build.current = current
current.instance_eval(&block)
build_mrbc_exec if name == 'host' current.build_mrbtest if current.test_enabled?
build_mrbtest if test_enabled?
end end
def debug_enabled? def debug_enabled?
...@@ -247,8 +247,9 @@ EOS ...@@ -247,8 +247,9 @@ EOS
def mrbcfile def mrbcfile
return @mrbcfile if @mrbcfile return @mrbcfile if @mrbcfile
unless gems.detect { |v| v.name == 'mruby-bin-mrbc' } 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 end
@mrbcfile = self.exefile("#{self.build_dir}/bin/mrbc") @mrbcfile = self.exefile("#{self.build_dir}/bin/mrbc")
end end
......
...@@ -28,18 +28,19 @@ module MRuby ...@@ -28,18 +28,19 @@ module MRuby
Gem.current = nil Gem.current = nil
load gemrake load gemrake
return nil unless Gem.current return nil unless Gem.current
current = Gem.current
Gem.current.dir = gemdir current.dir = gemdir
Gem.current.build = self.is_a?(MRuby::Build) ? self : MRuby::Build.current current.build = self.is_a?(MRuby::Build) ? self : MRuby::Build.current
Gem.current.build_config_initializer = block current.build_config_initializer = block
gems << Gem.current gems << current
cxx_srcs = ['src', 'test', 'tools'].map do |subdir| 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 end.flatten
enable_cxx_exception unless cxx_srcs.empty? enable_cxx_exception unless cxx_srcs.empty?
Gem.current current
end end
def load_special_path_gem(params) def load_special_path_gem(params)
......
...@@ -47,12 +47,14 @@ module MRuby ...@@ -47,12 +47,14 @@ module MRuby
@version = "0.0.0" @version = "0.0.0"
@mrblib_dir = "mrblib" @mrblib_dir = "mrblib"
@objs_dir = "src" @objs_dir = "src"
@dependencies = []
@conflicts = []
MRuby::Gem.current = self MRuby::Gem.current = self
end end
def setup def setup
return if defined?(@linker) # return if already set up return if defined?(@linker) # return if already set up
MRuby::Gem.current = self MRuby::Gem.current = self
MRuby::Build::COMMANDS.each do |command| MRuby::Build::COMMANDS.each do |command|
instance_variable_set("@#{command}", @build.send(command).clone) instance_variable_set("@#{command}", @build.send(command).clone)
...@@ -75,7 +77,6 @@ module MRuby ...@@ -75,7 +77,6 @@ module MRuby
@bins = [] @bins = []
@requirements = [] @requirements = []
@dependencies, @conflicts = [], []
@export_include_paths = [] @export_include_paths = []
@export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include" @export_include_paths << "#{dir}/include" if File.directory? "#{dir}/include"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment