Commit 3a95e3fb authored by Yukihiro Matz Matsumoto's avatar Yukihiro Matz Matsumoto

Merge branch 'master' of github.com:mruby/mruby

parents 323d8501 461a03ca
...@@ -2,14 +2,14 @@ MRuby.each_target do ...@@ -2,14 +2,14 @@ MRuby.each_target do
file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t| file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t|
archiver.run t.name, t.prerequisites archiver.run t.name, t.prerequisites
open("#{build_dir}/lib/libmruby.flags.mak", 'w') do |f| open("#{build_dir}/lib/libmruby.flags.mak", 'w') do |f|
f.puts 'CFLAGS = "%s"' % cc.all_flags.gsub('"', '\\"') f.puts 'MRUBY_CFLAGS = "%s"' % cc.all_flags.gsub('"', '\\"')
gem_flags = gems.map { |g| g.linker.flags } gem_flags = gems.map { |g| g.linker.flags }
gem_library_paths = gems.map { |g| g.linker.library_paths } gem_library_paths = gems.map { |g| g.linker.library_paths }
f.puts 'LDFLAGS = "%s"' % linker.all_flags(gem_library_paths, gem_flags).gsub('"', '\\"') f.puts 'MRUBY_LDFLAGS = "%s"' % linker.all_flags(gem_library_paths, gem_flags).gsub('"', '\\"')
gem_libraries = gems.map { |g| g.linker.libraries } gem_libraries = gems.map { |g| g.linker.libraries }
f.puts 'LIBS = "%s"' % linker.library_flags(gem_libraries).gsub('"', '\\"') f.puts 'MRUBY_LIBS = "%s"' % linker.library_flags(gem_libraries).gsub('"', '\\"')
end end
end end
end end
...@@ -29,10 +29,6 @@ module MRuby ...@@ -29,10 +29,6 @@ module MRuby
conf.instance_eval(&@initializer) conf.instance_eval(&@initializer)
end end
def toolchain(name)
@@toolchains[name.to_s].setup(self)
end
def self.load def self.load
Dir.glob("#{File.dirname(__FILE__)}/toolchains/*.rake").each do |file| Dir.glob("#{File.dirname(__FILE__)}/toolchains/*.rake").each do |file|
Kernel.load file Kernel.load file
...@@ -63,12 +59,11 @@ module MRuby ...@@ -63,12 +59,11 @@ module MRuby
if ENV['OS'] == 'Windows_NT' if ENV['OS'] == 'Windows_NT'
@exts = Exts.new('.o', '.exe', '.a') @exts = Exts.new('.o', '.exe', '.a')
@file_separator = '\\'
else else
@exts = Exts.new('.o', '', '.a') @exts = Exts.new('.o', '', '.a')
@file_separator = '/'
end end
@file_separator = '/'
@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))
...@@ -94,7 +89,9 @@ module MRuby ...@@ -94,7 +89,9 @@ module MRuby
end end
def toolchain(name) def toolchain(name)
Toolchain.toolchains[name.to_s].setup(self) tc = Toolchain.toolchains[name.to_s]
fail "Unknown #{name} toolchain" unless tc
tc.setup(self)
end end
def build_dir def build_dir
......
...@@ -2,7 +2,11 @@ module MRuby ...@@ -2,7 +2,11 @@ module MRuby
module LoadGems module LoadGems
def gem(gemdir, &block) def gem(gemdir, &block)
gemdir = load_external_gem(gemdir) if gemdir.is_a?(Hash) gemdir = load_external_gem(gemdir) if gemdir.is_a?(Hash)
load File.join(gemdir, "mrbgem.rake") gemrake = File.join(gemdir, "mrbgem.rake")
fail "Can't find #{gemrake}" unless File.exists?(gemrake)
load gemrake
Gem.current.dir = gemdir Gem.current.dir = gemdir
Gem.current.build = MRuby::Build.current Gem.current.build = MRuby::Build.current
Gem.current.build_config_initializer = block Gem.current.build_config_initializer = block
......
...@@ -21,10 +21,14 @@ class String ...@@ -21,10 +21,14 @@ class String
str.gsub!("%{#{k}}", v) str.gsub!("%{#{k}}", v)
end end
str str
else
if params.is_a?(Array)
sprintf(self, *params)
else else
sprintf(self, params) sprintf(self, params)
end end
end end
end
end end
class Symbol class Symbol
......
...@@ -4,24 +4,24 @@ MRuby::Toolchain.new(:vs2012) do |conf| ...@@ -4,24 +4,24 @@ MRuby::Toolchain.new(:vs2012) do |conf|
cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DDISABLE_GEMS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)] cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DDISABLE_GEMS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)]
cc.include_paths = ["#{root}/include"] cc.include_paths = ["#{root}/include"]
cc.defines = %w(DISABLE_GEMS) cc.defines = %w(DISABLE_GEMS)
cc.option_include_path = '-I%s' cc.option_include_path = '/I%s'
cc.option_define = '-D%s' cc.option_define = '/D%s'
cc.compile_options = "%{flags} /Fo%{outfile} -c %{infile}" cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
end end
conf.linker do |linker| conf.linker do |linker|
linker.command = ENV['LD'] || 'link.exe' linker.command = ENV['LD'] || 'link.exe'
linker.flags = [ENV['LDFLAGS'] || %w(/nologo)] linker.flags = [ENV['LDFLAGS'] || %w(/nologo)]
linker.libraries = %w(kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32) linker.libraries = %w()
linker.library_paths = [] linker.library_paths = %w()
linker.option_library = '-l%s' linker.option_library = '%s'
linker.option_library_path = '-L%s' linker.option_library_path = '/LIBPATH:%s'
linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{libs}" linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{libs}"
end end
conf.archiver do |archiver| conf.archiver do |archiver|
archiver.command = ENV['AR'] || 'lib.exe' archiver.command = ENV['AR'] || 'lib.exe'
archiver.archive_options = '/OUT:%{outfile} %{objs}' archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
end end
conf.yacc do |yacc| conf.yacc do |yacc|
......
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