summaryrefslogtreecommitdiffhomepage
path: root/Rakefile
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-03-07 06:20:24 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-03-07 06:20:24 -0800
commit9736d44d5ccde8f20cd03b76032e72ecaae4a02e (patch)
tree4d4bbbd1603a968a214702293d1e20ec37747f46 /Rakefile
parent2e95f638cd01a92a83f3808d745f69f46b64db10 (diff)
parenta0102317b448f3bb8c69019fe9732f9d9f07f087 (diff)
downloadmruby-9736d44d5ccde8f20cd03b76032e72ecaae4a02e.tar.gz
mruby-9736d44d5ccde8f20cd03b76032e72ecaae4a02e.zip
Merge pull request #961 from monaka/pr-support-user-defined-loadable-build
Add Support to build loadable modules defined in mrbgems.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 633c50385..b910e824a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -48,6 +48,30 @@ depfiles = MRuby.targets['host'].bins.map do |bin|
install_path
end
+MRuby.each_target do
+ gems.map do | gem |
+ current_dir = gem.dir.relative_path_from(Dir.pwd)
+ relative_from_root = gem.dir.relative_path_from(MRUBY_ROOT)
+ current_build_dir = "#{build_dir}/#{relative_from_root}"
+
+ gem.bins.each do | bin |
+ exec = exefile("#{build_dir}/bin/#{bin}")
+ objs = Dir.glob("#{current_dir}/tool/#{bin}/*.c").map { |f| objfile(f.pathmap("#{current_build_dir}/tool/#{bin}/%n")) }
+
+ file exec => objs + [libfile("#{build_dir}/lib/libmruby")] do |t|
+ gem_flags = gems.map { |g| g.linker.flags }
+ gem_flags_before_libraries = gems.map { |g| g.linker.flags_before_libraries }
+ gem_flags_after_libraries = gems.map { |g| g.linker.flags_after_libraries }
+ gem_libraries = gems.map { |g| g.linker.libraries }
+ gem_library_paths = gems.map { |g| g.linker.library_paths }
+ linker.run t.name, t.prerequisites, gem_libraries, gem_library_paths, gem_flags, gem_flags_before_libraries
+ end
+
+ depfiles += [ exec ]
+ end
+ end
+end
+
depfiles += MRuby.targets.reject { |n, t| n == 'host' }.map { |n, t|
[t.libfile("#{t.build_dir}/lib/libmruby")] + t.bins.map { |bin| t.exefile("#{t.build_dir}/bin/#{bin}") }
}.flatten