mruby-vala

April 21, 2016 ยท View on GitHub

MRuby bindings to Vala (and with gobject-introspection, any language that supports it)

Provides a .vapi file at ./vapi/mruby.vapi to bind mruby to Vala (can be re-generated from tools/gen_vapi.rb)

Provides a Shared Library exposing a more intuitive API to mruby (and to bind to other languages via GObjectIntospection)

Dependencies

Ubuntu:

Install gobject-introspection sudo apt-get install libgirepository1.0-dev

Example

using MRuby;

void main() {
  var mrb = new Context();
  mrb.define_method(mrb.object_class, "hello", (mrb, self)=>{ return "world!";}); 
  mrb.load_string("puts hello()");
  mrb.close();
}

INSTALL

# clones and builds mruby into ./vender/mruby
# installs mruby to prefix /usr
sudo make mruby

#
# builds library, gir, typelib
make

# installs mruby-vala to prefix /usr
make install

alternatively mruby-vala .debs provided here

USING

valac *.vala --pkg mruby-vala --pkg mruby