diff options
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/mrbgem_spec.rake | 18 | ||||
| -rw-r--r-- | tasks/mrbgems_test.rake | 6 | ||||
| -rw-r--r-- | tasks/mruby_build.rake | 11 | ||||
| -rw-r--r-- | tasks/mruby_build_commands.rake | 4 | ||||
| -rw-r--r-- | tasks/mruby_build_gem.rake | 6 | ||||
| -rw-r--r-- | tasks/toolchains/gcc.rake | 14 | ||||
| -rw-r--r-- | tasks/toolchains/visualcpp.rake (renamed from tasks/toolchains/vs2012.rake) | 2 | ||||
| -rw-r--r-- | tasks/toolchains/vs2010.rake | 3 |
8 files changed, 44 insertions, 20 deletions
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake index 70c44ed5e..e9caf1d3a 100644 --- a/tasks/mrbgem_spec.rake +++ b/tasks/mrbgem_spec.rake @@ -149,7 +149,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.] @@ -158,15 +158,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) diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake index d74351fe9..36c8e84b7 100644 --- a/tasks/mrbgems_test.rake +++ b/tasks/mrbgems_test.rake @@ -3,12 +3,12 @@ MRuby.each_target do 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) + g.print_gem_test_header(f) test_preload = [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" g.test_rbfiles.flatten.each_with_index do |rbfile, i| diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake index e1aae502a..c92400cf9 100644 --- a/tasks/mruby_build.rake +++ b/tasks/mruby_build.rake @@ -87,6 +87,11 @@ 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 toolchain(name) tc = Toolchain.toolchains[name.to_s] fail "Unknown #{name} toolchain" unless tc @@ -98,7 +103,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 @@ -204,6 +209,10 @@ module MRuby super end + def mrbcfile + MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc") + end + def run_test mrbtest = exefile("#{build_dir}/test/mrbtest") if (@test_runner.command == nil) diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake index 349b8717d..d7b87514e 100644 --- a/tasks/mruby_build_commands.rake +++ b/tasks/mruby_build_commands.rake @@ -106,7 +106,7 @@ 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 [] @@ -265,7 +265,7 @@ module MRuby # if mrbc execution fail, drop the file unless $?.exitstatus 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..0f920dbc8 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,7 +25,7 @@ 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 @@ -50,7 +50,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/gcc.rake b/tasks/toolchains/gcc.rake index 66fa75dcb..dec502732 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)] 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..fc51dbc02 100644 --- a/tasks/toolchains/vs2012.rake +++ b/tasks/toolchains/visualcpp.rake @@ -1,4 +1,4 @@ -MRuby::Toolchain.new(:vs2012) do |conf| +MRuby::Toolchain.new(:visualcpp) do |conf| [conf.cc, conf.cxx].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)] 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 |
