diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-01-24 21:34:18 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-01-24 21:42:25 +0900 |
| commit | dfb56074d6d0908c76bf618d526990497ca0271e (patch) | |
| tree | e8d0c916a1adfb3ff62a0c0dad067de55ff3dd2b /lib | |
| parent | 3ff56a8e55d661900a96c897c7a04bdf3a7e3839 (diff) | |
| download | mruby-dfb56074d6d0908c76bf618d526990497ca0271e.tar.gz mruby-dfb56074d6d0908c76bf618d526990497ca0271e.zip | |
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
```
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mruby/build.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 7d6aa49e1..c06a62282 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -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 |
