Commit 122770d1 authored by Xuejie "Rafael" Xiao's avatar Xuejie "Rafael" Xiao

Allow programmers to specify build path manually

parent 18c167b8
...@@ -43,7 +43,7 @@ module MRuby ...@@ -43,7 +43,7 @@ module MRuby
end end
include Rake::DSL include Rake::DSL
include LoadGems include LoadGems
attr_accessor :name, :bins, :exts, :file_separator attr_accessor :name, :bins, :exts, :file_separator, :build_dir
attr_reader :libmruby, :gems attr_reader :libmruby, :gems
COMPILERS = %w(cc cxx objc asm) COMPILERS = %w(cc cxx objc asm)
...@@ -63,6 +63,7 @@ module MRuby ...@@ -63,6 +63,7 @@ module MRuby
end end
@file_separator = '/' @file_separator = '/'
@build_dir = "#{MRUBY_ROOT}/build/#{@name}"
@cc = Command::Compiler.new(self, %w(.c)) @cc = Command::Compiler.new(self, %w(.c))
@cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp)) @cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp))
@objc = Command::Compiler.new(self, %w(.m)) @objc = Command::Compiler.new(self, %w(.m))
...@@ -95,10 +96,6 @@ module MRuby ...@@ -95,10 +96,6 @@ module MRuby
MRUBY_ROOT MRUBY_ROOT
end end
def build_dir
"#{MRUBY_ROOT}/build/#{self.name}"
end
def mrbcfile def mrbcfile
MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc") MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc")
end end
......
...@@ -39,18 +39,18 @@ module MRuby ...@@ -39,18 +39,18 @@ module MRuby
gemdir = "#{root}/mrbgems/#{params[:core]}" gemdir = "#{root}/mrbgems/#{params[:core]}"
elsif params[:git] elsif params[:git]
url = params[:git] url = params[:git]
gemdir = "build/mrbgems/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}" gemdir = "#{build_dir}/mrbgems/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}"
if File.exists?(gemdir) if File.exists?(gemdir)
if $pull_gems if $pull_gems
git.run_pull gemdir, url git.run_pull gemdir, url
else else
gemdir gemdir
end end
else else
options = [params[:options]] || [] options = [params[:options]] || []
options << "--branch \"#{params[:branch]}\"" if params[:branch] options << "--branch \"#{params[:branch]}\"" if params[:branch]
FileUtils.mkdir_p "build/mrbgems" FileUtils.mkdir_p "#{build_dir}/mrbgems"
git.run_clone gemdir, url, options git.run_clone gemdir, url, options
end end
else else
......
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