diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-02-17 12:43:45 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-17 12:43:45 +0900 |
| commit | cb43dda009475c2d56398630f2c4f0a59a8ff9de (patch) | |
| tree | 54743d2cea988d7b84be729a6f1d1863fdad80fe /lib | |
| parent | dee9168882bfa04900db9a640da5a460f9b2c4ec (diff) | |
| parent | a6a76d8fd2d7bb89c6034302bb416beb50ef5346 (diff) | |
| download | mruby-cb43dda009475c2d56398630f2c4f0a59a8ff9de.tar.gz mruby-cb43dda009475c2d56398630f2c4f0a59a8ff9de.zip | |
Merge pull request #5347 from shuujii/add--s-option-to-mrbc-for-make-variable-static
Add `-s` option to `mrbc` for make variable static
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mruby/build/command.rb | 7 | ||||
| -rw-r--r-- | lib/mruby/gem.rb | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/mruby/build/command.rb b/lib/mruby/build/command.rb index 9d70ac086..dbe3763d9 100644 --- a/lib/mruby/build/command.rb +++ b/lib/mruby/build/command.rb @@ -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 diff --git a/lib/mruby/gem.rb b/lib/mruby/gem.rb index 3a40fbbfc..716f21286 100644 --- a/lib/mruby/gem.rb +++ b/lib/mruby/gem.rb @@ -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);] |
