mruby-cliを使えば、mrubyのcliアプリケーションを
- Linux (64-bit)
- Linux (32-bit)
- OS X (64-bit)
- OS X (32-bit)
- Windows (64-bit)
- Windows (32-bit)
で使用できるようにクロスコンパイルできる。
--
hello_worldアプリを作成する
$ mruby-cli --setup hello_world
# created skelton
create .gitignore
create mrbgem.rake
create build_config.rb
create Rakefile
create Dockerfile
create docker-compose.yml
create tools/
create tools/hello_world/
create tools/hello_world/hello_world.c
create mrblib/
create mrblib/hello_world.rb
create bintest/
create bintest/hello_world.rb
create test/
create test/test_hello_world.rb
tree -L 2
├── hello_world
│ ├── Dockerfile
│ ├── Rakefile
│ ├── bintest
│ ├── build_config.rb
│ ├── docker-compose.yml
│ ├── mrbgem.rake
│ ├── mrblib
│ ├── test
│ └── tools
└── mruby-cli
vi mrblib/hello_world.rb
# mrblib/hello_world.rb
def __main__(argv)
puts "Hello World"
end
/testディレクトリのmrubyのテストを実行
docker-compose run mtest
/bintestディレクトリのcRubyのテストを実行
docker-compose run bintest
docker-compose run test
currentディレトリがコンテナの/home/mruby/code にマウントされているので、 コンテナ内で実行して試すことができる
docker-compose run shell
/home/mruby/code# mruby/build/host/bin/hello_world
Hello World
docker-compose run compile
以下のディレクトリにバイナリが置かれる
- Linux (64-bit): mruby/build/host/bin
- Linux (32-bit): mruby/build/i686-pc-linux-gnu/bin
- OS X (64-bit): mruby/build/x86_64-apple-darwin14/bin/
- OS X (32-bit): mruby/build/i386-apple-darwin14/bin
- Windows (64-bit): mruby/build/x86_64-w64-mingw32/bin/
- Windows (32-bit): mruby/build/i686-w64-mingw32/bin
docker-compose run clean
Cleaned up target build folder
Cleaned up mrbgems build folder
rake -T
rake all # build all targets, install (locally) in-repo
rake clean # clean all built and in-repo installed artifacts / cleanup
rake compile # compile binary
rake deep_clean # clean everything!
rake doc # generate document
rake test # run all tests
rake test:bintest # run integration tests
rake test:mtest # run mruby & unit tests
githubみると release(tarで固めて/releaseに配置する)的なものもあるのでそのうち実装されそう。