Sha256: cf2603c5f32f521f52ca810a10828cbc7c63ea52e01e882a0b43967c7a2cc1c9

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

MRuby::Build.new do |conf|

  conf.build_dir = '<%= build_directory %>/host'
  
  toolchain :gcc
  
  enable_debug
  
  conf.gembox 'default'
  
end


MRuby::Toolchain.new('emscripten') do |conf|

  toolchain :clang
  
  conf.cc.command = 'emcc'
  conf.cxx.command = 'emcc'
  conf.linker.command = 'emcc'
  conf.archiver.command = 'emar'

end


MRuby::CrossBuild.new('app') do |conf|

  conf.build_dir = '<%= build_directory %>/emscripten'
  
  toolchain :emscripten
  
  conf.compilers.each do |c|
    #c.defines += %w(MRB_GC_FIXED_ARENA)
    c.flags << '-Wall'
    c.flags << '-Wno-warn-absolute-paths'
    c.flags << '--bind'
    c.flags << '<%= optimization_argument %>'
    c.flags << '<%= closure_argument %>'
    c.flags << '<%= debug_argument %>'
    <% for flag in flags %>
    c.flags << '<%= flag %>'
    <% end %>
  end
  
  conf.gem_clone_dir = '<%= project_directory %>/gems'
  conf.gem :github => 'robfors/esruby-esruby'
  <% for gem in gems %>
  conf.gem(<%= gem.inspect %>)
  <% end %>
  
end


# we monkey patch the mruby build process to extract the list of gems
# this allows the esruby config.rb file to accept any format of gem listing that
#   mruby's build_config.rb accepts without reimplementing a bunch of mruby's
#   functionally
# the esruby build process will simply pass each gem entry without interpreting it
module MRuby
  module Gem
    class List
      
      old_check = instance_method(:check)
      define_method(:check) do |build|
        return_value = old_check.bind(self).call(build)
        if build.name == 'app'
          gem_paths = map { |gem| gem.dir }
          require 'json'
          File.write("<%= gem_paths_file %>", gem_paths.to_json)
        end
        return return_value
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
esruby-0.2.0 resources/build_config.eruby