Class: MRuby::CrossBuild

Inherits:
Build show all
Defined in:
ext/enterprise_script_service/mruby/lib/mruby/build.rb

Overview

Build

Constant Summary

Constants inherited from Build

Build::COMMANDS, Build::COMPILERS

Instance Attribute Summary collapse

Attributes inherited from Build

#bins, #build_dir, #enable_bintest, #enable_test, #exts, #file_separator, #gem_clone_dir, #gems, #libmruby, #name, #toolchains

Instance Method Summary collapse

Methods inherited from Build

#bintest_enabled?, #build_mrbc_exec, #build_mrbtest, #build_mrbtest_lib_only, #build_mrbtest_lib_only?, #compile_as_cxx, #compilers, #cxx_abi_enabled?, #cxx_exception_enabled?, #cygwin_filename, #define_rules, #disable_cxx_exception, #enable_cxx_abi, #enable_cxx_exception, #enable_debug, #exefile, #filename, #libfile, #objfile, #primary_toolchain, #print_build_summary, #root, #run_bintest, #test_enabled?, #toolchain

Methods included from LoadGems

#enable_gems?, #gem, #gembox, #load_special_path_gem

Constructor Details

#initialize(name, build_dir = nil, &block) ⇒ CrossBuild

Returns a new instance of CrossBuild.



336
337
338
339
340
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 336

def initialize(name, build_dir=nil, &block)
  @endian = nil
  @test_runner = Command::CrossTestRunner.new(self)
  super
end

Instance Attribute Details

#build_targetObject

cross compiling targets for building native extensions. host - arch of where the built binary will run build - arch of the machine building the binary



334
335
336
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 334

def build_target
  @build_target
end

#host_targetObject

cross compiling targets for building native extensions. host - arch of where the built binary will run build - arch of the machine building the binary



334
335
336
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 334

def host_target
  @host_target
end

Instance Method Details

#big_endianObject



356
357
358
359
360
361
362
363
364
365
366
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 356

def big_endian
  if @endian
    puts "Endian has already specified as #{@endian}."
    return
  end
  @endian = :big
  @mrbc.compile_options += ' -E'
  compilers.each do |c|
    c.defines += %w(MRB_ENDIAN_BIG)
  end
end

#little_endianObject



368
369
370
371
372
373
374
375
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 368

def little_endian
  if @endian
    puts "Endian has already specified as #{@endian}."
    return
  end
  @endian = :little
  @mrbc.compile_options += ' -e'
end

#mrbcfileObject



342
343
344
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 342

def mrbcfile
  MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/mrbc")
end

#run_testObject



346
347
348
349
350
351
352
353
354
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 346

def run_test
  mrbtest = exefile("#{build_dir}/bin/mrbtest")
  if (@test_runner.command == nil)
    puts "You should run #{mrbtest} on target device."
    puts
  else
    @test_runner.run(mrbtest)
  end
end