diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-12-10 17:39:04 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-12-11 11:24:42 +0900 |
commit | 40026a408df5e3576380f6c1d8bf6c119fa2e32b (patch) | |
tree | 5946811b38d5b70aaa0c5a4ab983fef19478ded9 /tool | |
parent | 9c2807b2df14984e3c81d72a381d9a4d288b3fbe (diff) |
support cross-compilation.
On cross-compilation, compiled binary can no be created because
compiled binary should be created by same interpreter (on cross-
compilation, host ruby is used to build ruby (BASERUBY)).
So that cross-compilation system loads required scripts in text.
It is same as miniruby.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2735
Diffstat (limited to 'tool')
-rw-r--r-- | tool/mk_builtin_binary.rb | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/tool/mk_builtin_binary.rb b/tool/mk_builtin_binary.rb index 416c6ef17e..dabc149d62 100644 --- a/tool/mk_builtin_binary.rb +++ b/tool/mk_builtin_binary.rb @@ -11,11 +11,6 @@ def dump_bin iseq print "\n" end -ary = [] -RubyVM::each_builtin{|feature, iseq| - ary << [feature, iseq] -} - $stdout = open('builtin_binary.inc', 'wb') puts <<H @@ -25,17 +20,25 @@ puts <<H H -ary.each{|feature, iseq| - print "\n""static const unsigned char #{feature}_bin[] = {" - dump_bin(iseq) - puts "};" -} +if !ARGV.grep('--cross=yes').empty? + # do nothing +else + ary = [] + RubyVM::each_builtin{|feature, iseq| + ary << [feature, iseq] + } -print "\n""static const struct builtin_binary builtin_binary[] = {\n" -ary.each{|feature, iseq| - puts " {#{feature.dump}, #{feature}_bin, sizeof(#{feature}_bin)}," -} -puts " {NULL}," # dummy sentry -puts "};" + ary.each{|feature, iseq| + print "\n""static const unsigned char #{feature}_bin[] = {" + dump_bin(iseq) + puts "};" + } -puts "#define BUILTIN_BINARY_SIZE #{ary.size}" + print "\n""static const struct builtin_binary builtin_binary[] = {\n" + ary.each{|feature, iseq| + puts " {#{feature.dump}, #{feature}_bin, sizeof(#{feature}_bin)}," + } + puts " {NULL}," # dummy sentry + puts "};" + puts "#define BUILTIN_BINARY_SIZE #{ary.size}" +end |