mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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
```
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user