1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Koichi Sasada 2019-12-10 17:39:04 +09:00
parent 9c2807b2df
commit 40026a408d
Notes: git 2019-12-11 11:25:18 +09:00
5 changed files with 40 additions and 18 deletions

View file

@ -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[] = {"
if !ARGV.grep('--cross=yes').empty?
# do nothing
else
ary = []
RubyVM::each_builtin{|feature, iseq|
ary << [feature, iseq]
}
ary.each{|feature, iseq|
print "\n""static const unsigned char #{feature}_bin[] = {"
dump_bin(iseq)
puts "};"
}
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 "};"
}
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}"
puts "#define BUILTIN_BINARY_SIZE #{ary.size}"
end