Rubinius のコンパイル & インストール

Rubinis のコンパイル手順はここに書かれてある。
http://rubinius.lighthouseapp.com/projects/5089/installation

まず以下のものが必要なので、これらをインストールする。


FreeBSD, OpenBSD では次も必要。


Ubuntu を使ってるなら次も必要。

  • libglib2.0-dev
  • zlib1g-dev


続いて、Rubinius のリポジトリを取ってくる。
Rubinius のリポジトリは git で管理されているので、git をインストールしたあと、次のようにしてリポジトリをコピーする。
(追記: http:// ではなく git:// を使う。)

$ git clone git://git.rubini.us/code rubinius.code


なおリポジトリのアップデートは次のようにする。
(追記: git pull よりも rake git:update のほうがいいみたいだ。)

$ cd rubinius.code/
$ git pull          # ← やめ
$ rake git:update


あとはコンパイルしてインストールするだけ。

$ cd rubinius.code/
$ rake build
$ sudo rake install


デフォルトではバイナリが /usr/local/bin 以下に、ライブラリが /usr/local/lib/rubinius 以下にインストールされるはず。

実行して確認してみる。

$ /usr/local/bin/rbx -v
rubinius 0.8.0 (ruby 1.8.6 compatible) (2ffa558ee) (02/08/2008) [i686-apple-darwin8.11.1]
$ /usr/local/bin/rbx -h
Usage: rubinius [options] [file]
  File may be any valid Ruby source file (.rb) or a compiled Ruby file (.rbc).

Options:
  -d             Enable debugging output and set $DEBUG to true.
  -dc            Display debugging information for the compiler.
  -dl            Display debugging information for the loader.
  -e 'code'      Directly compile and execute code (no file provided).
  -Idir1[:dir2]  Add directories to $LOAD_PATH.
  -p             Run the profiler.
  -rlibrary      Require library before execution.
  -w             Enable warnings. (currently does nothing--compatibility)
  -v             Display the version and set $VERBOSE to true.

なんか、サポートしているオプションが MRI よりもずっと少ない。。。'-s' とかすごく便利なのにな。


追記:/usr/local/bin/rbx よりも、rubinius.code/shotgun/rubinius を使う方がいいみたい。詳しくはこちらで。