mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge branch 'master' of github.com:mruby/mruby
This commit is contained in:
+3
-3
@@ -2,14 +2,14 @@ MRuby.each_target do
|
||||
file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t|
|
||||
archiver.run t.name, t.prerequisites
|
||||
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_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 }
|
||||
f.puts 'LIBS = "%s"' % linker.library_flags(gem_libraries).gsub('"', '\\"')
|
||||
f.puts 'MRUBY_LIBS = "%s"' % linker.library_flags(gem_libraries).gsub('"', '\\"')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,10 +29,6 @@ module MRuby
|
||||
conf.instance_eval(&@initializer)
|
||||
end
|
||||
|
||||
def toolchain(name)
|
||||
@@toolchains[name.to_s].setup(self)
|
||||
end
|
||||
|
||||
def self.load
|
||||
Dir.glob("#{File.dirname(__FILE__)}/toolchains/*.rake").each do |file|
|
||||
Kernel.load file
|
||||
@@ -63,12 +59,11 @@ module MRuby
|
||||
|
||||
if ENV['OS'] == 'Windows_NT'
|
||||
@exts = Exts.new('.o', '.exe', '.a')
|
||||
@file_separator = '\\'
|
||||
else
|
||||
@exts = Exts.new('.o', '', '.a')
|
||||
@file_separator = '/'
|
||||
end
|
||||
|
||||
@file_separator = '/'
|
||||
@cc = Command::Compiler.new(self, %w(.c))
|
||||
@cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp))
|
||||
@objc = Command::Compiler.new(self, %w(.m))
|
||||
@@ -94,7 +89,9 @@ module MRuby
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def build_dir
|
||||
|
||||
@@ -2,7 +2,11 @@ module MRuby
|
||||
module LoadGems
|
||||
def gem(gemdir, &block)
|
||||
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.build = MRuby::Build.current
|
||||
Gem.current.build_config_initializer = block
|
||||
|
||||
+5
-1
@@ -22,7 +22,11 @@ class String
|
||||
end
|
||||
str
|
||||
else
|
||||
sprintf(self, params)
|
||||
if params.is_a?(Array)
|
||||
sprintf(self, *params)
|
||||
else
|
||||
sprintf(self, params)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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.include_paths = ["#{root}/include"]
|
||||
cc.defines = %w(DISABLE_GEMS)
|
||||
cc.option_include_path = '-I%s'
|
||||
cc.option_define = '-D%s'
|
||||
cc.compile_options = "%{flags} /Fo%{outfile} -c %{infile}"
|
||||
cc.option_include_path = '/I%s'
|
||||
cc.option_define = '/D%s'
|
||||
cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
|
||||
end
|
||||
|
||||
conf.linker do |linker|
|
||||
linker.command = ENV['LD'] || 'link.exe'
|
||||
linker.flags = [ENV['LDFLAGS'] || %w(/nologo)]
|
||||
linker.libraries = %w(kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32)
|
||||
linker.library_paths = []
|
||||
linker.option_library = '-l%s'
|
||||
linker.option_library_path = '-L%s'
|
||||
linker.libraries = %w()
|
||||
linker.library_paths = %w()
|
||||
linker.option_library = '%s'
|
||||
linker.option_library_path = '/LIBPATH:%s'
|
||||
linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{libs}"
|
||||
end
|
||||
|
||||
conf.archiver do |archiver|
|
||||
archiver.command = ENV['AR'] || 'lib.exe'
|
||||
archiver.archive_options = '/OUT:%{outfile} %{objs}'
|
||||
archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
|
||||
end
|
||||
|
||||
conf.yacc do |yacc|
|
||||
|
||||
Reference in New Issue
Block a user