diff options
| author | Yuichiro MASUI <[email protected]> | 2013-01-20 22:48:42 +0900 |
|---|---|---|
| committer | Yuichiro MASUI <[email protected]> | 2013-01-20 22:48:42 +0900 |
| commit | ced80d2b4b1ed4ef0752a8bbaf0dbfe7aa6c6a95 (patch) | |
| tree | d49c0d0f0b6139ad4c79c3e4b417d65941e97a4f /tasks/mrbgems.rake | |
| parent | 583983385b81c21f82704b116eab52d606a609f4 (diff) | |
| download | mruby-ced80d2b4b1ed4ef0752a8bbaf0dbfe7aa6c6a95.tar.gz mruby-ced80d2b4b1ed4ef0752a8bbaf0dbfe7aa6c6a95.zip | |
Improved build scripts and config files
Diffstat (limited to 'tasks/mrbgems.rake')
| -rw-r--r-- | tasks/mrbgems.rake | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake index 07e412b53..dc5e67eef 100644 --- a/tasks/mrbgems.rake +++ b/tasks/mrbgems.rake @@ -1,35 +1,34 @@ -dir = File.dirname(__FILE__).sub(%r|^\./|, '') - MRuby.each_target do - if enable_gems? - self.libmruby << "#{build_dir}/mrbgems/gem_init.o" + dir = File.dirname(__FILE__).relative_path_from(root) - file "#{build_dir}/mrbgems/gem_init.o" => "#{build_dir}/mrbgems/gem_init.c" - file "#{build_dir}/mrbgems/gem_init.c" do |t| + if enable_gems? + # set up all gems + gems.each(&:setup) + + # loader all gems + self.libmruby << objfile("#{build_dir}/mrbgems/gem_init") + file objfile("#{build_dir}/mrbgems/gem_init") => "#{build_dir}/mrbgems/gem_init.c" + file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG] do |t| FileUtils.mkdir_p "#{build_dir}/mrbgems" open(t.name, 'w') do |f| - f.puts <<__EOF__ -/* - * This file contains a list of all - * initializing methods which are - * necessary to bootstrap all gems. - * - * IMPORTANT: - * This file was generated! - * All manual changes will get lost. - */ - -#include "mruby.h" - -#{gems.map{|gem| "void GENERATED_TMP_mrb_%s_gem_init(mrb_state* mrb);" % [gem.funcname]}.join("\n")} -void -mrb_init_mrbgems(mrb_state *mrb) { -#{gems.map{|gem| "GENERATED_TMP_mrb_%s_gem_init(mrb);" % [gem.funcname]}.join("\n")} -} -__EOF__ + f.puts %Q[/*] + f.puts %Q[ * This file contains a list of all] + f.puts %Q[ * initializing methods which are] + f.puts %Q[ * necessary to bootstrap all gems.] + f.puts %Q[ *] + f.puts %Q[ * IMPORTANT:] + f.puts %Q[ * This file was generated!] + f.puts %Q[ * All manual changes will get lost.] + f.puts %Q[ */] + f.puts %Q[] + f.puts %Q[#include "mruby.h"] + f.puts %Q[] + f.puts %Q[#{gems.map{|g| "void GENERATED_TMP_mrb_%s_gem_init(mrb_state* mrb);" % g.funcname}.join("\n")}] + f.puts %Q[void] + f.puts %Q[mrb_init_mrbgems(mrb_state *mrb) {] + f.puts %Q[#{gems.map{|g| "GENERATED_TMP_mrb_%s_gem_init(mrb);" % g.funcname}.join("\n")}] + f.puts %Q[}] end end - - file "#{build_dir}/mrbgems/gem_init.c" => MRUBY_CONFIG end end |
