Unverified Commit ae5463c9 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4148 from take-cheeze/rename_libmruby_stuff

Rename `MRuby::Build#libmruby` stuff to avoid confusion
parents 63fade13 b37b3120
......@@ -65,7 +65,7 @@ MRuby.each_target do |target|
exec = exefile("#{build_dir}/bin/#{bin}")
objs = Dir.glob("#{current_dir}/tools/#{bin}/*.{c,cpp,cxx,cc}").map { |f| objfile(f.pathmap("#{current_build_dir}/tools/#{bin}/%n")) }
file exec => objs + [libfile("#{build_dir}/lib/libmruby")] do |t|
file exec => objs + target.libraries 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 }
......@@ -100,7 +100,7 @@ MRuby.each_target do |target|
end
depfiles += MRuby.targets.map { |n, t|
[t.libfile("#{t.build_dir}/lib/libmruby")]
t.libraries
}.flatten
depfiles += MRuby.targets.reject { |n, t| n == 'host' }.map { |n, t|
......
......@@ -45,9 +45,11 @@ module MRuby
include Rake::DSL
include LoadGems
attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir
attr_reader :libmruby, :gems, :toolchains
attr_reader :libmruby_objs, :gems, :toolchains
attr_writer :enable_bintest, :enable_test
alias libmruby libmruby_objs
COMPILERS = %w(cc cxx objc asm)
COMMANDS = COMPILERS + %w(linker archiver yacc gperf git exts mrbc)
attr_block MRuby::Build::COMMANDS
......@@ -81,7 +83,7 @@ module MRuby
@mrbc = Command::Mrbc.new(self)
@bins = []
@gems, @libmruby = MRuby::Gem::List.new, []
@gems, @libmruby_objs = MRuby::Gem::List.new, []
@build_mrbtest_lib_only = false
@cxx_exception_enabled = false
@cxx_exception_disabled = false
......@@ -327,6 +329,18 @@ EOS
puts "================================================"
puts
end
def libmruby_static
libfile("#{build_dir}/lib/libmruby")
end
def libmruby_core_static
libfile("#{build_dir}/lib/libmruby_core")
end
def libraries
[libmruby_static]
end
end # Build
class CrossBuild < Build
......
......@@ -87,7 +87,7 @@ module MRuby
fail "#{name || dir} required to set name, license(s) and author(s)"
end
build.libmruby << @objs
build.libmruby_objs << @objs
instance_eval(&@build_config_initializer) if @build_config_initializer
end
......
......@@ -8,7 +8,7 @@ MRuby::Gem::Specification.new 'mruby-bin-mrbc' do |spec|
exec = exefile("#{build.build_dir}/bin/mrbc")
mrbc_objs = Dir.glob("#{spec.dir}/tools/mrbc/*.c").map { |f| objfile(f.pathmap("#{spec.build_dir}/tools/mrbc/%n")) }.flatten
file exec => mrbc_objs + [libfile("#{build.build_dir}/lib/libmruby_core")] do |t|
file exec => mrbc_objs + [build.libmruby_core_static] do |t|
build.linker.run t.name, t.prerequisites
end
......
......@@ -20,7 +20,7 @@ MRuby.each_target do
@bins << mruby_config
make_cfg = "#{build_dir}/lib/libmruby.flags.mak"
file mruby_config_path => [libfile("#{build_dir}/lib/libmruby"), make_cfg] do |t|
file mruby_config_path => [libmruby_static, make_cfg] do |t|
FileUtils.copy "#{File.dirname(__FILE__)}/#{mruby_config}", t.name
config = Hash[open(make_cfg).read.split("\n").map {|x| a = x.split(/\s*=\s*/, 2); [a[0], a[1].gsub('\\"', '"') ]}]
IO.write(t.name, File.open(t.name) {|f|
......
......@@ -35,6 +35,6 @@ MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
gperf.run t.name, t.prerequisites.first
end
file libfile("#{build.build_dir}/lib/libmruby_core") => core_objs
file build.libmruby_core_static => core_objs
build.libmruby << core_objs
end
......@@ -16,9 +16,6 @@ MRuby::Gem::Specification.new('mruby-test') do |spec|
mlib = clib.ext(exts.object)
exec = exefile("#{build.build_dir}/bin/mrbtest")
libmruby = libfile("#{build.build_dir}/lib/libmruby")
libmruby_core = libfile("#{build.build_dir}/lib/libmruby_core")
mrbtest_lib = libfile("#{build_dir}/mrbtest")
mrbtest_objs = []
......@@ -140,7 +137,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec|
end
unless build.build_mrbtest_lib_only?
file exec => [driver_obj, mlib, mrbtest_lib, libmruby_core, libmruby] do |t|
file exec => [driver_obj, mlib, mrbtest_lib, build.libmruby_static] do |t|
gem_flags = build.gems.map { |g| g.linker.flags }
gem_flags_before_libraries = build.gems.map { |g| g.linker.flags_before_libraries }
gem_flags_after_libraries = build.gems.map { |g| g.linker.flags_after_libraries }
......
......@@ -3,7 +3,7 @@ MRuby.each_target do
relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT)
current_build_dir = "#{build_dir}/#{relative_from_root}"
self.libmruby << objfile("#{current_build_dir}/mrblib")
self.libmruby_objs << objfile("#{current_build_dir}/mrblib")
file objfile("#{current_build_dir}/mrblib") => "#{current_build_dir}/mrblib.c"
file "#{current_build_dir}/mrblib.c" => [mrbcfile, __FILE__] + Dir.glob("#{current_dir}/*.rb").sort do |t|
......
......@@ -12,9 +12,9 @@ MRuby.each_target do
if cxx_exception_enabled?
objs += %w(vm error).map { |v| compile_as_cxx "#{current_dir}/#{v}.c", "#{current_build_dir}/#{v}.cxx" }
end
self.libmruby << objs
self.libmruby_objs << objs
file libfile("#{build_dir}/lib/libmruby_core") => objs do |t|
file libmruby_core_static => objs do |t|
archiver.run t.name, t.prerequisites
end
end
MRuby.each_target do
file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t|
file libmruby_static => libmruby_objs.flatten do |t|
archiver.run t.name, t.prerequisites
end
file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libfile("#{build_dir}/lib/libmruby")] do |t|
file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libmruby_static] do |t|
FileUtils.mkdir_p File.dirname t.name
open(t.name, 'w') do |f|
f.puts "MRUBY_CFLAGS = #{cc.all_flags}"
......@@ -18,7 +18,7 @@ MRuby.each_target do
gem_libraries = gems.map { |g| g.linker.libraries }
f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries)}"
f.puts "MRUBY_LIBMRUBY_PATH = #{libfile("#{build_dir}/lib/libmruby")}"
f.puts "MRUBY_LIBMRUBY_PATH = #{libmruby_static}"
end
end
task :all => "#{build_dir}/lib/libmruby.flags.mak"
......
......@@ -5,7 +5,7 @@ MRuby.each_target do
gems.check self
# loader all gems
self.libmruby << objfile("#{build_dir}/mrbgems/gem_init")
self.libmruby_objs << objfile("#{build_dir}/mrbgems/gem_init")
file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"]
file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__] do |t|
FileUtils.mkdir_p "#{build_dir}/mrbgems"
......
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