Installation
Ruby is currently only supported on Linux ana MacOS.
Ruby
To build bevy_scriptum with Ruby support a Ruby installation is needed to be
present on your development machine.
The easiest way to produce a compatible Ruby installation is to use rbenv.
After installing rbenv along with its ruby-build plugin you can build and
install a Ruby installation that will work with bevy_scriptum by executing:
CC=clang RUBY_CONFIGURE_OPTS="--disable-shared" rbenv install 3.4.4
Before building make sure you are using the correct Ruby version.
It can be done for example by executing which ruby.
Output should be similar to /home/$USER/.rbenv/shims/ruby.
If the version is not correct then refer to rbenv manual or documentation
relevant for your method of installation to switch to correct Ruby.
To set Ruby version for current shell for example rbenv shell 3.4.4 can be
used.
If ruby-static installation can’t be found its advisable to run cargo clean
before building as rb-sys may have cached an incorrect Ruby version.
Above assumes that you also have clang installed on your system.
For clang installation instruction consult your
OS vendor provided documentation or clang official webiste.
If you rather not use rbenv you are free to supply your own installation of
Ruby provided the following is true about it:
- it is compiled with
clang - it is compiled as a static library
- it is accessible as
rubywithinPATHorRUBYenvironment variable is set to path of desiredrubybinary.
Main Library
Add the following to your Cargo.toml:
[dependencies]
bevy = "0.18"
bevy_scriptum = { version = "0.11", features = ["ruby"] }
If you need a different version of bevy you need to use a matching bevy_scriptum version according to the bevy support matrix
Ruby also needs dynamic symbol resolution and since bevy_scriptum links Ruby
statically the following build.rs file is needed to be present in project
root directory.
fn main() {
println!("cargo:rustc-link-arg=-rdynamic");
}