summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/libmruby.rake8
-rw-r--r--tasks/mrbgem_spec.rake69
-rw-r--r--tasks/mrbgems_test.rake93
-rw-r--r--tasks/mruby_build.rake52
-rw-r--r--tasks/mruby_build_commands.rake20
-rw-r--r--tasks/mruby_build_gem.rake14
-rw-r--r--tasks/toolchains/clang.rake3
-rw-r--r--tasks/toolchains/gcc.rake14
-rw-r--r--tasks/toolchains/visualcpp.rake (renamed from tasks/toolchains/vs2012.rake)24
-rw-r--r--tasks/toolchains/vs2010.rake3
10 files changed, 226 insertions, 74 deletions
diff --git a/tasks/libmruby.rake b/tasks/libmruby.rake
index d7c4ce706..887cc69aa 100644
--- a/tasks/libmruby.rake
+++ b/tasks/libmruby.rake
@@ -2,17 +2,17 @@ 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 'MRUBY_CFLAGS = %s' % cc.all_flags.gsub('"', '\\"')
+ f.puts "MRUBY_CFLAGS = #{cc.all_flags.gsub('"', '\\"')}"
gem_flags = gems.map { |g| g.linker.flags }
gem_library_paths = gems.map { |g| g.linker.library_paths }
- f.puts 'MRUBY_LDFLAGS = %s' % linker.all_flags(gem_library_paths, gem_flags).gsub('"', '\\"')
+ f.puts "MRUBY_LDFLAGS = #{linker.all_flags(gem_library_paths, gem_flags).gsub('"', '\\"')} #{linker.option_library_path % "#{build_dir}/lib"}"
gem_flags_before_libraries = gems.map { |g| g.linker.flags_before_libraries }
- f.puts 'MRUBY_LDFLAGS_BEFORE_LIBS = %s' % [linker.flags_before_libraries, gem_flags_before_libraries].flatten.join(' ').gsub('"', '\\"')
+ f.puts "MRUBY_LDFLAGS_BEFORE_LIBS = #{[linker.flags_before_libraries, gem_flags_before_libraries].flatten.join(' ').gsub('"', '\\"')}"
gem_libraries = gems.map { |g| g.linker.libraries }
- f.puts 'MRUBY_LIBS = %s' % linker.library_flags(gem_libraries).gsub('"', '\\"')
+ f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries).gsub('"', '\\"')}"
end
end
end
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake
index f57c5d479..3536594d9 100644
--- a/tasks/mrbgem_spec.rake
+++ b/tasks/mrbgem_spec.rake
@@ -1,5 +1,6 @@
require 'pathname'
require 'forwardable'
+require 'tsort'
module MRuby
module Gem
@@ -39,14 +40,23 @@ module MRuby
@name = name
@initializer = block
@version = "0.0.0"
+ @cxx_abi_enabled = false
MRuby::Gem.current = self
end
+ def run_test_in_other_mrb_state?
+ not test_preload.nil? or not test_objs.empty?
+ end
+
+ def cxx_abi_enabled?
+ @cxx_abi_enabled
+ end
+
def setup
MRuby::Gem.current = self
@build.compilers.each do |compiler|
compiler.include_paths << "#{dir}/include"
- end
+ end if File.directory? "#{dir}/include"
MRuby::Build::COMMANDS.each do |command|
instance_variable_set("@#{command}", @build.send(command).clone)
end
@@ -54,15 +64,17 @@ module MRuby
@rbfiles = Dir.glob("#{dir}/mrblib/*.rb").sort
@objs = Dir.glob("#{dir}/src/*.{c,cpp,cxx,m,asm,S}").map do |f|
+ @cxx_abi_enabled = true if f =~ /(cxx|cpp)$/
objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X"))
end
@objs << objfile("#{build_dir}/gem_init")
@test_rbfiles = Dir.glob("#{dir}/test/*.rb")
@test_objs = Dir.glob("#{dir}/test/*.{c,cpp,cxx,m,asm,S}").map do |f|
+ @cxx_abi_enabled = true if f =~ /(cxx|cpp)$/
objfile(f.relative_path_from(dir).to_s.pathmap("#{build_dir}/%X"))
end
- @test_preload = 'test/assert.rb'
+ @test_preload = nil # 'test/assert.rb'
@test_args = {}
@bins = []
@@ -150,7 +162,7 @@ module MRuby
end
end # generate_gem_init
- def print_gem_init_header(f)
+ def print_gem_comment(f)
f.puts %Q[/*]
f.puts %Q[ * This file is loading the irep]
f.puts %Q[ * Ruby GEM code.]
@@ -159,15 +171,23 @@ module MRuby
f.puts %Q[ * This file was generated!]
f.puts %Q[ * All manual changes will get lost.]
f.puts %Q[ */]
+ end
+
+ def print_gem_init_header(f)
+ print_gem_comment(f)
+ f.puts %Q[#include <stdlib.h>] unless rbfiles.empty?
+ f.puts %Q[#include "mruby.h"]
+ f.puts %Q[#include "mruby/irep.h"] unless rbfiles.empty?
+ end
+
+ def print_gem_test_header(f)
+ print_gem_comment(f)
f.puts %Q[#include <stdlib.h>]
f.puts %Q[#include "mruby.h"]
+ f.puts %Q[#include "mruby/array.h"]
f.puts %Q[#include "mruby/irep.h"]
- f.puts %Q[#include "mruby/dump.h"]
f.puts %Q[#include "mruby/string.h"]
- f.puts %Q[#include "mruby/proc.h"]
f.puts %Q[#include "mruby/variable.h"]
- f.puts %Q[#include "mruby/array.h"]
- f.puts %Q[#include "mruby/hash.h"]
end
def version_ok?(req_versions)
@@ -270,28 +290,39 @@ module MRuby
end
def check
+ gem_table = @ary.reduce({}) { |res,v| res[v.name] = v; res }
+
each do |g|
g.dependencies.each do |dep|
name = dep[:gem]
req_versions = dep[:requirements]
+ dep_g = gem_table[name]
# check each GEM dependency against all available GEMs
- found_dep_gem = false
- each do |dep_g|
- if name == dep_g.name
- unless dep_g.version_ok?(req_versions)
- fail "#{name} version should be #{req_versions.join(' and ')} but was '#{dep_g.version}'"
- end
-
- found_dep_gem = true
- break
- end
+ if dep_g.nil?
+ fail "The GEM '#{g.name}' depends on the GEM '#{name}' but it could not be found"
end
+ unless dep_g.version_ok? req_versions
+ fail "#{name} version should be #{req_versions.join(' and ')} but was '#{dep_g.version}'"
+ end
+ end
+ end
- fail "The GEM '#{g.name}' depends on the GEM '#{name}' but it could not be found" unless found_dep_gem
-
+ class << gem_table
+ include TSort
+ alias tsort_each_node each_key
+ def tsort_each_child(n, &b)
+ fetch(n).dependencies.each do |v|
+ b.call v[:gem]
+ end
end
end
+
+ begin
+ @ary = gem_table.tsort.map { |v| gem_table[v] }
+ rescue TSort::Cyclic => e
+ fail "Circular mrbgem dependency found: #{e.message}"
+ end
end
end # List
end # Gem
diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake
index d74351fe9..bf775ffdd 100644
--- a/tasks/mrbgems_test.rake
+++ b/tasks/mrbgems_test.rake
@@ -1,16 +1,34 @@
MRuby.each_target do
+ no_mrb_open_test_gem = []
+
gems.each do |g|
+ unless g.run_test_in_other_mrb_state?
+ no_mrb_open_test_gem << g
+ next
+ end
+
test_rbobj = g.test_rbireps.ext(exts.object)
file test_rbobj => g.test_rbireps
- file g.test_rbireps => [g.test_rbfiles].flatten + [g.build.mrbcfile, libfile("#{build_dir}/lib/libmruby")] do |t|
+ file g.test_rbireps => [g.test_rbfiles].flatten + [g.build.mrbcfile] do |t|
open(t.name, 'w') do |f|
- g.print_gem_init_header(f)
- test_preload = [g.dir, MRUBY_ROOT].map {|dir|
+ g.print_gem_test_header(f)
+ test_preload = g.test_preload and [g.dir, MRUBY_ROOT].map {|dir|
File.expand_path(g.test_preload, dir)
- }.find {|file| File.exists?(file) }
+ }.find {|file| File.exist?(file) }
- g.build.mrbc.run f, test_preload, "gem_test_irep_#{g.funcname}_preload"
+ f.puts %Q[/*]
+ f.puts %Q[ * This file contains a test code for #{g.name} gem.]
+ 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[ */]
+ if test_preload.nil?
+ f.puts %Q[extern const uint8_t mrbtest_assert_irep[];]
+ else
+ g.build.mrbc.run f, test_preload, "gem_test_irep_#{g.funcname}_preload"
+ end
g.test_rbfiles.flatten.each_with_index do |rbfile, i|
g.build.mrbc.run f, rbfile, "gem_test_irep_#{g.funcname}_#{i}"
end
@@ -27,16 +45,20 @@ MRuby.each_target do
g.test_rbfiles.count.times do |i|
f.puts %Q[ ai = mrb_gc_arena_save(mrb);]
f.puts %Q[ mrb2 = mrb_open();]
- f.puts %Q[ val3 = mrb_gv_get(mrb, mrb_intern_cstr(mrb, "$mrbtest_verbose"));]
+ f.puts %Q[ val3 = mrb_gv_get(mrb, mrb_intern_lit(mrb, "$mrbtest_verbose"));]
f.puts %Q[ if (mrb_test(val3)) {]
- f.puts %Q[ mrb_gv_set(mrb2, mrb_intern_cstr(mrb2, "$mrbtest_verbose"), val3);]
+ f.puts %Q[ mrb_gv_set(mrb2, mrb_intern_lit(mrb2, "$mrbtest_verbose"), val3);]
f.puts %Q[ }]
- f.puts %Q[ mrb_load_irep(mrb2, gem_test_irep_#{g.funcname}_preload);]
+ if test_preload.nil?
+ f.puts %Q[ mrb_load_irep(mrb2, mrbtest_assert_irep);]
+ else
+ f.puts %Q[ mrb_load_irep(mrb2, gem_test_irep_#{g.funcname}_preload);]
+ end
f.puts %Q[ if (mrb2->exc) {]
f.puts %Q[ mrb_p(mrb2, mrb_obj_value(mrb2->exc));]
f.puts %Q[ exit(EXIT_FAILURE);]
f.puts %Q[ }]
- f.puts %Q[ mrb_const_set(mrb2, mrb_obj_value(mrb2->object_class), mrb_intern_cstr(mrb2, "GEMNAME"), mrb_str_new(mrb2, "#{g.name}", #{g.name.length}));]
+ f.puts %Q[ mrb_const_set(mrb2, mrb_obj_value(mrb2->object_class), mrb_intern_lit(mrb2, "GEMNAME"), mrb_str_new(mrb2, "#{g.name}", #{g.name.length}));]
unless g.test_args.empty?
f.puts %Q[ test_args_hash = mrb_hash_new_capa(mrb, #{g.test_args.length}); ]
@@ -45,7 +67,7 @@ MRuby.each_target do
escaped_arg_value = arg_value.gsub('\\', '\\\\\\\\').gsub('"', '\"')
f.puts %Q[ mrb_hash_set(mrb2, test_args_hash, mrb_str_new(mrb2, "#{escaped_arg_name.to_s}", #{escaped_arg_name.to_s.length}), mrb_str_new(mrb2, "#{escaped_arg_value.to_s}", #{escaped_arg_value.to_s.length})); ]
end
- f.puts %Q[ mrb_const_set(mrb2, mrb_obj_value(mrb2->object_class), mrb_intern_cstr(mrb2, "TEST_ARGS"), test_args_hash); ]
+ f.puts %Q[ mrb_const_set(mrb2, mrb_obj_value(mrb2->object_class), mrb_intern_lit(mrb2, "TEST_ARGS"), test_args_hash); ]
end
f.puts %Q[ mrb_#{g.funcname}_gem_test(mrb2);] unless g.test_objs.empty?
@@ -58,21 +80,20 @@ MRuby.each_target do
f.puts %Q[ ]
%w(ok_test ko_test kill_test).each do |vname|
- f.puts %Q[ val2 = mrb_gv_get(mrb2, mrb_intern_cstr(mrb2, "$#{vname}"));]
+ f.puts %Q[ val2 = mrb_gv_get(mrb2, mrb_intern_lit(mrb2, "$#{vname}"));]
f.puts %Q[ if (mrb_fixnum_p(val2)) {]
- f.puts %Q[ val1 = mrb_gv_get(mrb, mrb_intern_cstr(mrb, "$#{vname}"));]
- f.puts %Q[ mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$#{vname}"), mrb_fixnum_value(mrb_fixnum(val1) + mrb_fixnum(val2)));]
+ f.puts %Q[ val1 = mrb_gv_get(mrb, mrb_intern_lit(mrb, "$#{vname}"));]
+ f.puts %Q[ mrb_gv_set(mrb, mrb_intern_lit(mrb, "$#{vname}"), mrb_fixnum_value(mrb_fixnum(val1) + mrb_fixnum(val2)));]
f.puts %Q[ }\n]
end
- f.puts %Q[ ary2 = mrb_gv_get(mrb2, mrb_intern_cstr(mrb2, "$asserts"));]
+ f.puts %Q[ ary2 = mrb_gv_get(mrb2, mrb_intern_lit(mrb2, "$asserts"));]
f.puts %Q[ if (mrb_test(ary2)) {]
- f.puts %Q[ ary1 = mrb_gv_get(mrb, mrb_intern_cstr(mrb, "$asserts"));]
+ f.puts %Q[ ary1 = mrb_gv_get(mrb, mrb_intern_lit(mrb, "$asserts"));]
f.puts %Q[ val2 = mrb_ary_shift(mrb2, ary2);]
f.puts %Q[ ]
f.puts %Q[ while (mrb_test(val2)) {]
- f.puts %Q[ char *str = mrb_string_value_cstr(mrb2, &val2);]
- f.puts %Q[ mrb_ary_push(mrb, ary1, mrb_str_new_cstr(mrb, str));]
+ f.puts %Q[ mrb_ary_push(mrb, ary1, mrb_str_new(mrb, RSTRING_PTR(val2), RSTRING_LEN(val2)));]
f.puts %Q[ val2 = mrb_ary_shift(mrb2, ary2);]
f.puts %Q[ }]
f.puts %Q[ }]
@@ -85,4 +106,42 @@ MRuby.each_target do
end
end
+
+ no_mrb_open_test = "#{build_dir}/test/no_mrb_open_test"
+ no_mrb_open_test_rbfiles = no_mrb_open_test_gem.reduce([]) { |res, v|
+ res += v.test_rbfiles
+ }
+ if no_mrb_open_test_rbfiles.empty?
+ no_mrb_open_test_rbfiles << "#{MRUBY_ROOT}/test/no_mrb_open_test_dummy.rb"
+ end
+
+ no_mrb_open_test_lib = no_mrb_open_test.ext(exts.object)
+ file no_mrb_open_test_lib => "#{no_mrb_open_test}.c"
+ file "#{no_mrb_open_test}.c" => no_mrb_open_test_rbfiles do |t|
+ open(t.name, 'w') do |f|
+ f.puts %Q[/*]
+ f.puts %Q[ * This file contains a test code for following gems:]
+ no_mrb_open_test_gem.each { |g| f.puts %Q[ * #{g.name}] }
+ 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[\#include "mruby/irep.h"]
+
+ f.puts %Q[]
+
+ mrbc.run f, no_mrb_open_test_rbfiles, "no_mrb_open_gem_test_irep"
+
+ f.puts %Q[]
+
+ f.puts %Q[void no_mrb_open_mrbgem_test(mrb_state *mrb) {]
+ f.puts %Q[ mrb_load_irep(mrb, no_mrb_open_gem_test_irep);]
+ f.puts %Q[}]
+ end
+ end
end
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index ff6110884..5877c11cd 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -43,7 +43,7 @@ module MRuby
end
include Rake::DSL
include LoadGems
- attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir
+ attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir, :enable_bintest
attr_reader :libmruby, :gems
COMPILERS = %w(cc cxx objc asm)
@@ -52,7 +52,7 @@ module MRuby
Exts = Struct.new(:object, :executable, :library)
- def initialize(name='host', &block)
+ def initialize(name='host', build_dir=nil, &block)
@name = name.to_s
unless MRuby.targets[@name]
@@ -62,9 +62,11 @@ module MRuby
@exts = Exts.new('.o', '', '.a')
end
+ build_dir = build_dir || ENV['MRUBY_BUILD_DIR'] || "#{MRUBY_ROOT}/build"
+
@file_separator = '/'
- @build_dir = "#{MRUBY_ROOT}/build/#{@name}"
- @gem_clone_dir = "#{MRUBY_ROOT}/build/mrbgems"
+ @build_dir = "#{build_dir}/#{@name}"
+ @gem_clone_dir = "#{build_dir}/mrbgems"
@cc = Command::Compiler.new(self, %w(.c))
@cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp))
@objc = Command::Compiler.new(self, %w(.m))
@@ -79,6 +81,7 @@ module MRuby
@bins = %w(mrbc)
@gems, @libmruby = MRuby::Gem::List.new, []
@build_mrbtest_lib_only = false
+ @cxx_abi_enabled = false
MRuby.targets[@name] = self
end
@@ -87,6 +90,22 @@ module MRuby
MRuby.targets[@name].instance_eval(&block)
end
+ def enable_debug
+ compilers.each { |c| c.defines += %w(MRB_DEBUG) }
+ @mrbc.compile_options += ' -g'
+ end
+
+ def cxx_abi_enabled?
+ @cxx_abi_enabled
+ end
+
+ def enable_cxx_abi
+ return if @cxx_abi_enabled
+ compilers.each { |c| c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) }
+ linker.command = cxx.command
+ @cxx_abi_enabled = true
+ end
+
def toolchain(name)
tc = Toolchain.toolchains[name.to_s]
fail "Unknown #{name} toolchain" unless tc
@@ -98,7 +117,7 @@ module MRuby
end
def mrbcfile
- MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc")
+ MRuby.targets[@name].exefile("#{MRuby.targets[@name].build_dir}/bin/mrbc")
end
def compilers
@@ -170,7 +189,13 @@ module MRuby
puts ">>> Test #{name} <<<"
mrbtest = exefile("#{build_dir}/test/mrbtest")
sh "#{filename mrbtest.relative_path}#{$verbose ? ' -v' : ''}"
- puts
+ puts
+ run_bintest if @enable_bintest
+ end
+
+ def run_bintest
+ targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir }
+ sh "ruby test/bintest.rb #{targets.join ' '}"
end
def print_build_summary
@@ -181,8 +206,9 @@ module MRuby
unless @gems.empty?
puts " Included Gems:"
@gems.map do |gem|
- gem_version = "- #{gem.version}" if gem.version
- puts " #{gem.name} #{gem_version}"
+ gem_version = " - #{gem.version}" if gem.version != '0.0.0'
+ gem_summary = " - #{gem.summary}" if gem.summary
+ puts " #{gem.name}#{gem_version}#{gem_summary}"
puts " - Binaries: #{gem.bins.join(', ')}" unless gem.bins.empty?
end
end
@@ -194,9 +220,13 @@ module MRuby
class CrossBuild < Build
attr_block %w(test_runner)
- def initialize(name, &block)
- @test_runner = Command::CrossTestRunner.new(self)
- super
+ def initialize(name, build_dir=nil, &block)
+ @test_runner = Command::CrossTestRunner.new(self)
+ super
+ end
+
+ def mrbcfile
+ MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc")
end
def run_test
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index 349b8717d..d64b20ff3 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -24,9 +24,17 @@ module MRuby
target
end
+ NotFoundCommands = {}
+
private
def _run(options, params={})
- sh build.filename(command) + ' ' + ( options % params )
+ return sh command + ' ' + ( options % params ) if NotFoundCommands.key? @command
+ begin
+ sh build.filename(command) + ' ' + ( options % params )
+ rescue RuntimeError
+ NotFoundCommands[@command] = true
+ _run options, params
+ end
end
end
@@ -106,11 +114,11 @@ module MRuby
private
def get_dependencies(file)
file = file.ext('d') unless File.extname(file) == '.d'
- if File.exists?(file)
+ if File.exist?(file)
File.read(file).gsub("\\\n ", "").scan(/^\S+:\s+(.+)$/).flatten.map {|s| s.split(' ') }.flatten
else
[]
- end
+ end + [ MRUBY_CONFIG ]
end
end
@@ -225,7 +233,7 @@ module MRuby
def initialize(build)
super
@command = 'git'
- @flags = []
+ @flags = %w[--depth 1]
@clone_options = "clone %{flags} %{url} %{dir}"
@pull_options = "pull"
end
@@ -263,9 +271,9 @@ module MRuby
out.puts io.read
end
# if mrbc execution fail, drop the file
- unless $?.exitstatus
+ if $?.exitstatus != 0
File.delete(out.path)
- exit -1
+ exit(-1)
end
end
end
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index ea1307132..5e4566f8d 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -2,7 +2,7 @@ module MRuby
module LoadGems
def gembox(gemboxfile)
gembox = File.expand_path("#{gemboxfile}.gembox", "#{MRUBY_ROOT}/mrbgems")
- fail "Can't find gembox '#{gembox}'" unless File.exists?(gembox)
+ fail "Can't find gembox '#{gembox}'" unless File.exist?(gembox)
GemBox.config = self
GemBox.path = gembox
@@ -25,11 +25,13 @@ module MRuby
gemrake = File.join(gemdir, "mrbgem.rake")
- fail "Can't find #{gemrake}" unless File.exists?(gemrake)
+ fail "Can't find #{gemrake}" unless File.exist?(gemrake)
Gem.current = nil
load gemrake
return nil unless Gem.current
+ enable_cxx_abi if Gem.current.cxx_abi_enabled?
+
Gem.current.dir = gemdir
Gem.current.build = MRuby::Build.current
Gem.current.build_config_initializer = block
@@ -41,7 +43,11 @@ module MRuby
if params[:github]
params[:git] = "https://github.com/#{params[:github]}.git"
elsif params[:bitbucket]
- params[:git] = "https://bitbucket.org/#{params[:bitbucket]}.git"
+ if params[:method] == "ssh"
+ params[:git] = "[email protected]:#{params[:bitbucket]}.git"
+ else
+ params[:git] = "https://bitbucket.org/#{params[:bitbucket]}.git"
+ end
end
if params[:core]
@@ -50,7 +56,7 @@ module MRuby
url = params[:git]
gemdir = "#{gem_clone_dir}/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}"
- if File.exists?(gemdir)
+ if File.exist?(gemdir)
if $pull_gems
git.run_pull gemdir, url
else
diff --git a/tasks/toolchains/clang.rake b/tasks/toolchains/clang.rake
index d5d2ccd7c..ea92b516d 100644
--- a/tasks/toolchains/clang.rake
+++ b/tasks/toolchains/clang.rake
@@ -1,8 +1,9 @@
MRuby::Toolchain.new(:clang) do |conf|
toolchain :gcc
- [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|
+ [conf.cc, conf.objc, conf.asm].each do |cc|
cc.command = ENV['CC'] || 'clang'
end
+ conf.cxx.command = ENV['CXX'] || 'clang++'
conf.linker.command = ENV['LD'] || 'clang'
end
diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake
index 66fa75dcb..a25f840c5 100644
--- a/tasks/toolchains/gcc.rake
+++ b/tasks/toolchains/gcc.rake
@@ -1,7 +1,7 @@
MRuby::Toolchain.new(:gcc) do |conf|
- [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|
+ [conf.cc, conf.objc, conf.asm].each do |cc|
cc.command = ENV['CC'] || 'gcc'
- cc.flags = [ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration)]
+ cc.flags = [ENV['CFLAGS'] || %w(-g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement)]
cc.include_paths = ["#{MRUBY_ROOT}/include"]
cc.defines = %w(DISABLE_GEMS)
cc.option_include_path = '-I%s'
@@ -9,6 +9,16 @@ MRuby::Toolchain.new(:gcc) do |conf|
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
end
+ [conf.cxx].each do |cxx|
+ cxx.command = ENV['CXX'] || 'g++'
+ cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration)]
+ cxx.include_paths = ["#{MRUBY_ROOT}/include"]
+ cxx.defines = %w(DISABLE_GEMS)
+ cxx.option_include_path = '-I%s'
+ cxx.option_define = '-D%s'
+ cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
+ end
+
conf.linker do |linker|
linker.command = ENV['LD'] || 'gcc'
linker.flags = [ENV['LDFLAGS'] || %w()]
diff --git a/tasks/toolchains/vs2012.rake b/tasks/toolchains/visualcpp.rake
index f4039cc29..0eb04dcba 100644
--- a/tasks/toolchains/vs2012.rake
+++ b/tasks/toolchains/visualcpp.rake
@@ -1,7 +1,7 @@
-MRuby::Toolchain.new(:vs2012) do |conf|
- [conf.cc, conf.cxx].each do |cc|
+MRuby::Toolchain.new(:visualcpp) do |conf|
+ [conf.cc].each do |cc|
cc.command = ENV['CC'] || 'cl.exe'
- cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)]
+ cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /D_CRT_SECURE_NO_WARNINGS)]
cc.include_paths = ["#{MRUBY_ROOT}/include"]
cc.defines = %w(DISABLE_GEMS)
cc.option_include_path = '/I%s'
@@ -9,26 +9,36 @@ MRuby::Toolchain.new(:vs2012) do |conf|
cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
end
+ [conf.cxx].each do |cxx|
+ cxx.command = ENV['CXX'] || 'cl.exe'
+ cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHsc /D_CRT_SECURE_NO_WARNINGS)]
+ cxx.include_paths = ["#{MRUBY_ROOT}/include"]
+ cxx.defines = %w(DISABLE_GEMS)
+ cxx.option_include_path = '/I%s'
+ cxx.option_define = '/D%s'
+ cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
+ end
+
conf.linker do |linker|
linker.command = ENV['LD'] || 'link.exe'
- linker.flags = [ENV['LDFLAGS'] || %w(/nologo)]
+ linker.flags = [ENV['LDFLAGS'] || %w(/NOLOGO /DEBUG /INCREMENTAL:NO /OPT:ICF /OPT:REF)]
linker.libraries = %w()
linker.library_paths = %w()
linker.option_library = '%s.lib'
linker.option_library_path = '/LIBPATH:%s'
linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
end
-
+
conf.archiver do |archiver|
archiver.command = ENV['AR'] || 'lib.exe'
archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
end
-
+
conf.yacc do |yacc|
yacc.command = ENV['YACC'] || 'bison.exe'
yacc.compile_options = '-o %{outfile} %{infile}'
end
-
+
conf.gperf do |gperf|
gperf.command = 'gperf.exe'
gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
diff --git a/tasks/toolchains/vs2010.rake b/tasks/toolchains/vs2010.rake
deleted file mode 100644
index 783dc8831..000000000
--- a/tasks/toolchains/vs2010.rake
+++ /dev/null
@@ -1,3 +0,0 @@
-MRuby::Toolchain.new(:vs2010) do |conf|
- toolchain :vs2012
-end