Use different Ruby command-line arguments in libretro builds

I've decided to stop gambling with ways to make `-e` not crash Ruby on
startup in libretro builds (see commit
1473416a5a for context). Making Ruby load
a dummy script seems to work better.
This commit is contained in:
刘皓 2025-01-19 11:56:47 -05:00
parent d7d460d6b0
commit 835795a0c6
No known key found for this signature in database
GPG key ID: 7901753DB465B711
3 changed files with 3 additions and 4 deletions

View file

@ -70,8 +70,7 @@ sandbox::sandbox(const char *game_path) : ruby(new struct w2c_ruby), wasi(new wa
// Determine Ruby command-line arguments
std::vector<std::string> args{"mkxp-z"};
args.push_back("-v");
args.push_back("-e ");
args.push_back("/mkxp-retro-dist/bin/mkxp-z");
if (MJIT_ENABLED) {
std::string verboseLevel("--mjit-verbose=");
std::string maxCache("--mjit-max-cache=");

View file

@ -1184,7 +1184,6 @@ static void mriBindingExecute() {
ruby_init();
std::vector<const char*> rubyArgsC{"mkxp-z"};
rubyArgsC.push_back("-v");
rubyArgsC.push_back("-e ");
void *node;
if (conf.jit.enabled) {

View file

@ -58,7 +58,7 @@ clean: clean-ruby-dist clean-ruby-bindings clean-deps
clean-ruby-dist:
rm -f $(OUTDIR)/mkxp-retro-dist.zip.c
rm -rf $(OUTDIR)/mkxp-retro-ruby
rm -rf $(LIBDIR)/mkxp-retro-ruby
clean-ruby-bindings:
rm -f $(OUTDIR)/mkxp-sandbox-bindgen.cpp
@ -97,6 +97,7 @@ $(LIBDIR)/mkxp-retro-dist.zip: $(LIBDIR)/mkxp-retro-dist/bin/ruby $(P7ZIP)
rm -r $(LIBDIR)/_mkxp-retro-dist/include
rm -r $(LIBDIR)/_mkxp-retro-dist/share
rm -r $(LIBDIR)/_mkxp-retro-dist/lib/ruby/gems/$(RUBY_VERSION).0/cache/*
echo '# This is a Ruby script that does nothing. We make Ruby load this file on startup just because Ruby needs to load a script on startup for some reason. No, we cannot just use `-e`: for some reason that sometimes causes the Ruby VM to crash on startup.' > $(LIBDIR)/_mkxp-retro-dist/bin/mkxp-z
rm -f $(LIBDIR)/mkxp-retro-dist.zip
cd $(LIBDIR)/_mkxp-retro-dist && $(P7ZIP) a -bb3 -mm=zstd -mx=19 $(LIBDIR)/mkxp-retro-dist.zip *
rm -r $(LIBDIR)/_mkxp-retro-dist