diff --git a/README.md b/README.md index e7f404b..9e54780 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,51 @@ > so thank you early adopters for beïng prepared to encounter and report segfaults and core dumps 😅. +## Getting Started + +1. As betaware, only Windows and [RubyInstaller2](https://rubyinstaller.org) __without Devkit__ is tested currently. + It also needs [MinGW](https://www.mingw-w64.org) in the `PATH`. Things will go unexpected with the MSYS2 Devkit. + * Support for Devkit and Linux are planned, but not for Windows going through WSL + (but Linux support means yes for Godot Engine and Ruby both contained in WSL). + +2. I might publish this project to RubyGems in the future. + For now, download/clone this repo to a consistent place (i.e., not the Downloads folder) and run: + ```sh + gem install mingw-make + gem install rake rake-compiler json + rake + rake clean # optional, delete leftovers + ``` + If you don’t have [symlink permissions][], + consider admin elevation for the `rake` line so the script symlinks Ruby DLLs rather than duplicating them. + +3. Copy-paste or symlink `generated/godot_rb.gdextension` in your Godot Project + (Unlike nearly all GDExtensions, this one uses absolute paths so multiple projects can share the same install.) + +4. Have fun with [_real_ singletons](https://ruby-doc.org/current/syntax/modules_and_classes_rdoc.html#label-Singleton+Classes)! 💎 + (No ideas on exporting projects currently…) + +
+

A couple of reminders for Godot.rb development

+ +* The [`Rakefile`](Rakefile) is for building, not setting up… + +* `bundle install` fails on RubyInstaller no-Devkit because of the `Gemfile` app `steep`’s transitive dependency `ffi`. + Gem insists to use the platform-independent version of the `ffi` gem, which doesn’t know about + `bin/ruby_builtin_dlls/libffi-8.dll` and must compile `libffi` from scratch with `libffi` own `Makefile`. + I’m unable to work around this problem one way or another (`#help-wanted`). + +* RubyInstaller Ruby utilizes the new Universal C Runtime, but Godot Engine still uses the old MS VC++ Runtime, + for they support (on a best-effort basis) the minority who refuse to upgrade their outdated Windows versions. + See [godotengine/godot-proposals#9111][] regarding the situations. Fortunately, while mixing runtimes is unsupported, + the only known issue is that Ruby cannot print to console (only `Godot#print` and etc. can). + +
+ +[symlink permissions]: https://learn.microsoft.com/windows/security/threat-protection/security-policy-settings/create-symbolic-links +[godotengine/godot-proposals#9111]: https://github.com/godotengine/godot-proposals/discussions/9111 + + ## Features ### ☑️️ Current @@ -29,26 +74,15 @@ [TBA] -## Appendix Docs – [`docs/`](docs/) - -* [`Building.md`](docs/dev/Building.md) -* … - - ## License ### [`include/godot/`](include/godot/) Copyright (c) 2014-present Godot Engine contributors. https://godotengine.org/license/ -### Bundled 3rd-party libraries in [`build/`](build/) - -#### “`libruby`” – [Ruby](https://www.ruby-lang.org) (“CRuby”) -Distributing in compliance with [its custom terms](https://github.com/ruby/ruby/blob/HEAD/COPYING#L25-L30) - ### The rest of this project -Copyright 2023 ParadoxV5 +Copyright 2024 ParadoxV5 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/docs/Building.md b/docs/Building.md deleted file mode 100644 index 154a842..0000000 --- a/docs/Building.md +++ /dev/null @@ -1,52 +0,0 @@ -# Building - -## GitHub Actions CI (Coming Soon) - -[The GitHub Actions workflow](../.github/workflows/workflow.yml) -automatically builds and tests relevant commits on all supported platforms and architectures, or you can also -[manually activate the CI](https://docs.github.com/actions/using-workflows/manually-running-a-workflow). - -When it concludes, the CI stores all successive builds in one convenient -[download](https://docs.github.com/actions/managing-workflow-runs/downloading-workflow-artifacts). - -These downloads are distributable (suitable for [publishing](https://github.com/ParadoxV5/Godot.rb/releases)) – -libraries for all platform-architectures (that built successfully) included, -and development-only files (e.g., [C source files](../src/)) are not included. - -## Building locally - -> Note: These instructions were written to be future-proof. -> In practice, only Windows, RubyInstaller no-Devkit + MinGW is currently tested. - -As you may’ve guessed, you need [CRuby Ruby](https://www.ruby-lang.org) and a basic `gcc` set. -Specifically, you need `gcc` to compile `godot_rb.c` to a shared library that links with the Ruby shared library -(i.e., `libruby.so`), which came from building Ruby with `--enable-shared` `./configure`d. -RubyInstaller for Windows includes the Ruby shared library (it’s a `.dll` because Macrohard); -check your contents for other prebuild packages. - -The `Rakefile` has all the building steps. Ruby [bundles](https://github.com/ruby/ruby/blob/HEAD/gems/bundled_gems) -[the `rake` gem](https://github.com/ruby/rake) unless you’ve uninstalled it for whatëver defiance. - -* For most platforms (read: Linux), your building workflow is the same as that of any Rake project. - ```shell - bundle install - bundle exec rake - ``` - -* For Windows, [RubyInstaller2](https://rubyinstaller.org) + Devkit comes with [MSYS2](https://www.msys2.org) - integration, allowing *you* to use the same Linux steps above. - -* RubyInstaller without MSYS2 (neither Devkit nor separately installed) plus a separate `gcc` - (such as [MinGW](https://www.mingw-w64.org)) also do; but without MSYS2, - the Linux/MSYS2 conveniences above will fail, and you also miss out utilities for auxiliary development tasks. - To substitute those Linux/MSYS2 commands: - ```shell - gem list rake json - # Confirm the Rake and JSON versions are suitable as recommended by the `Gemfile` - rake - ``` - -This builds Godot.rb for your device’s platform-architecture – and only that platform-architecture pair. -It also (if necessary) symlinks `libruby` and additional dependencies instead of duplicating them. -(As such, you need admin elevation on Windows if you don’t have -[symlink permissions](https://learn.microsoft.com/windows/security/threat-protection/security-policy-settings/create-symbolic-links)) diff --git a/lib/godot_rb.rb b/lib/godot_rb.rb new file mode 100644 index 0000000..c5e4b64 --- /dev/null +++ b/lib/godot_rb.rb @@ -0,0 +1,5 @@ +raise NotImplementedError, <<~MSG + Godot.rb loads from Godot Engine, not Ruby. + Refer to `README.md` § Getting Started on how to add Ruby to your Godot project. + Also check out https://github.com/godotengine/godot/pull/72883 on what running Godot Engine from Ruby might look like. +MSG