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, #gem_dir_to_repo_url, #gems, #libmruby_objs, #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, #debug_enabled?, #define_rules, #disable_cxx_exception, #disable_lock, #enable_cxx_abi, #enable_cxx_exception, #enable_debug, #exefile, #filename, #libfile, #libmruby_core_static, #libmruby_static, #libraries, #lock_enabled?, #locks, #objfile, #primary_toolchain, #print_build_summary, #root, #run_bintest, #test_enabled?, #toolchain, #verbose_flag

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.



378
379
380
381
382
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 378

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



376
377
378
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 376

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



376
377
378
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 376

def host_target
  @host_target
end

Instance Method Details

#big_endianObject



399
400
401
402
403
404
405
406
407
408
409
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 399

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



411
412
413
414
415
416
417
418
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 411

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

#mrbcfileObject



384
385
386
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 384

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

#run_testObject



388
389
390
391
392
393
394
395
396
397
# File 'ext/enterprise_script_service/mruby/lib/mruby/build.rb', line 388

def run_test
  @test_runner.runner_options << ' -v' if $verbose
  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