mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add -s option to mrbc for make variable static
This commit is contained in:
@@ -328,13 +328,16 @@ module MRuby
|
||||
@compile_options = "-B%{funcname} -o-"
|
||||
end
|
||||
|
||||
def run(out, infiles, funcname, cdump = true)
|
||||
def run(out, infiles, funcname, cdump: true, static: false)
|
||||
@command ||= @build.mrbcfile
|
||||
infiles = [infiles].flatten
|
||||
infiles.each_with_index do |f, i|
|
||||
_pp i == 0 ? "MRBC" : "", f.relative_path, indent: 2
|
||||
end
|
||||
cmd = %Q["#{filename @command}" #{cdump ? "-S" : ""} #{@compile_options % {:funcname => funcname}} #{filename(infiles).map{|f| %Q["#{f}"]}.join(' ')}]
|
||||
opt = @compile_options % {funcname: funcname}
|
||||
opt << " -S" if cdump
|
||||
opt << " -s" if static
|
||||
cmd = %["#{filename @command}" #{opt} #{filename(infiles).map{|f| %["#{f}"]}.join(' ')}]
|
||||
puts cmd if Rake.verbose
|
||||
IO.popen(cmd, 'r+') do |io|
|
||||
out.puts io.read
|
||||
|
||||
+3
-2
@@ -198,10 +198,11 @@ module MRuby
|
||||
open(fname, 'w') do |f|
|
||||
print_gem_init_header f
|
||||
unless rbfiles.empty?
|
||||
opts = {cdump: cdump?, static: true}
|
||||
if cdump?
|
||||
build.mrbc.run f, rbfiles, "gem_mrblib_#{funcname}_proc"
|
||||
build.mrbc.run f, rbfiles, "gem_mrblib_#{funcname}_proc", **opts
|
||||
else
|
||||
build.mrbc.run f, rbfiles, "gem_mrblib_irep_#{funcname}", false
|
||||
build.mrbc.run f, rbfiles, "gem_mrblib_irep_#{funcname}", **opts
|
||||
end
|
||||
end
|
||||
f.puts %Q[void mrb_#{funcname}_gem_init(mrb_state *mrb);]
|
||||
|
||||
Reference in New Issue
Block a user