Add `big_endian` and `little_endian` methods to `CrossBuild`; ref #3922

When your target machine is big endian, specify as following in the
`build_config.rb`:

```ruby
MRuby::CrossBuild.new('32bit') do |conf|
  toolchain :gcc

  conf.big_endian
end
```
parent 3ff56a8e
......@@ -334,6 +334,7 @@ EOS
attr_accessor :host_target, :build_target
def initialize(name, build_dir=nil, &block)
@endian = nil
@test_runner = Command::CrossTestRunner.new(self)
super
end
......@@ -351,5 +352,26 @@ EOS
@test_runner.run(mrbtest)
end
end
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
def little_endian
if @endian
puts "Endian has already specified as #{@endian}."
return
end
@endian = :little
@mrbc.compile_options += ' -e'
end
end # CrossBuild
end # MRuby
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment