diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index f3e9974..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,6 +0,0 @@ -[build] -# Without this flag, when linking static libruby, the linker removes symbols -# (such as `_rb_ext_ractor_safe`) which it thinks are dead code... but they are -# not, and they need to be included for the `embed` feature to work with static -# Ruby. -rustflags = ["-C", "link-dead-code=on", "-C", "link-arg=-lz"] diff --git a/Cargo.toml b/Cargo.toml index 8c7712c..56e7372 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ categories = ["game-development"] description = "Plugin for Bevy engine that allows you to write some of your game logic in a scripting language" repository = "https://github.com/jarkonik/bevy_scriptum" keywords = ["bevy", "rhai", "scripting", "game", "gamedev"] +links = "lz" # TODO: conditional, probably will need a crate for ruby [features] lua = ["dep:mlua", "mlua/luajit"] @@ -33,6 +34,7 @@ mlua = { version = "0.9.8", features = [ ], optional = true } magnus = { version = "0.7.1", optional = true } rb-sys = { version = "*", default-features = false, features = ["link-ruby", "ruby-static"], optional = true } +libz-sys = { version = "1.1", default-features = false, features = ["static"] } crossbeam-channel = "0.5.15" [[example]] diff --git a/build.rs b/build.rs index c2bbcc5..989fef5 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,8 @@ -use std::{env, path::PathBuf, process::Command}; - fn main() { - println!("cargo:rustc-link-arg=-rdynamic"); - println!("cargo:rustc-link-lib=z"); // TODO: if features Ruby + #[cfg(feature = "ruby")] + { + println!("cargo:rustc-link-arg=-rdynamic"); + println!("cargo:rustc-link-arg=-lz"); + println!("cargo:rustc-link-lib=z"); + } } diff --git a/tests/tests.rs b/tests/tests.rs index 53b1416..411c4a6 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -676,5 +676,17 @@ mod ruby_tests { } } + #[test] + fn test_symbol_inspection() { + let mut app = build_test_app(); + + app.add_scripting::(|_| {}); + let runtime = app.world().get_resource::().unwrap(); + runtime.with_engine_thread(|engine| { + let symbol_string: String = engine.eval(":test_symbol.inspect").unwrap(); + assert_eq!(symbol_string, ":test_symbol") + }); + } + scripting_tests!(RubyRuntime, "ruby", "rb", BevyEntity, BevyVec3); }