Using Ruby for Sega Dreamcast development: Difference between revisions
(→Draft) |
(Major upgrade as mruby is now officially supported as kos-port.) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
It | It is possible to develop in [https://www.ruby-lang.org Ruby] for the Sega Dreamcast system using the [https://mruby.org/ mruby implementation]. This support was originally introduced by [[Yuji Yokoo]] in 2019. | ||
Like most Sega Dreamcast software, this project uses [[KallistiOS]] (KOS) as its base. | |||
'''Note:''' Debugging support has not been tested as of 2025. | |||
== Prerequisites == | == Prerequisites == | ||
* A working [[KallistiOS]] environment must be set up, including all necessary dependencies for building KallistiOS; | |||
* You must build the [[KallistiOS]] library; | |||
* You must have both ''ruby'' and ''bison'' installed (see the sections below). | |||
=== Installing prerequisites on Cygwin === | |||
Launch the Cygwin setup utility, search for the ''ruby'' and ''bison'' packages, and install them. | |||
=== Installing prerequisites on DreamSDK === | |||
Depending on the underlying environment installed with [[DreamSDK]], there are 2 possible cases: | |||
==== If you are using the modern MinGW-w64/MSYS2 foundation ==== | |||
No additional prerequisites are required — both Ruby and Bison are already preinstalled. | |||
==== If you are using the legacy MinGW/MSYS foundation ==== | |||
Install manually the prerequisites: | |||
* Install [https://rubyinstaller.org/ RubyInstaller], and ensure that the ''ruby'' command is available in your system ''PATH''; | |||
* Use the '''MinGW Installation Manager''' to install the ''msys-bison-bin'' package. | |||
'''Note:''' If you are using DreamSDK on Windows XP, you should install Ruby version 2.0.0 from [https://rubyinstaller.org/ RubyInstaller], as it is the last version compatible with that operating system. | |||
=== Installing prerequisites on GNU/Linux === | |||
Use your distribution’s package manager to install the ''ruby'' and ''bison'' packages (e.g., run ''apt install ruby bison'' on Debian/Ubuntu). | |||
=== Installing prerequisites on | === Installing prerequisites on macOS === | ||
Install | Install the ''ruby'' and ''bison'' packages using your preferred package manager (e.g., ''brew''). | ||
=== Installing prerequisites on MinGW-w64/MSYS2 === | === Installing prerequisites on MinGW-w64/MSYS2 === | ||
Run the following command in the MSYS2 shell: | |||
pacman -S ruby bison | |||
== Setting up mruby == | == Setting up mruby == | ||
The recommended way to use mruby on Dreamcast is to install the '''mruby''' port from the [https://github.com/KallistiOS/kos-ports KallistiOS Ports repository]. | |||
First of all, make sure to clone the kos-ports repository: | |||
cd /opt/toolchains/dc | |||
git clone https://github.com/KallistiOS/kos-ports.git . | |||
Then, run the following commands: | |||
cd /opt/toolchains/dc/kos-ports/mruby | |||
make install clean | |||
This will build the embedded mruby library (''libmruby.a'') along with the required host tools (mainly ''/opt/toolchains/dc/bin/mrbc'') for the Dreamcast platform. | |||
'''Note:''' The configuration file is stored in ''build_config/dreamcast_shelf.rb'' in the [https://github.com/mruby/mruby mruby] official repository. | |||
== Using mruby in a Sega Dreamcast project == | |||
Two example projects are included with [[KallistiOS]] in the ''/examples/dreamcast/mruby'' directory: | |||
* '''dreampresent''' – A simple presentation tool (this needs the ''libpng'' port as well); | |||
* '''mrbtris''' – A sample game. | |||
These examples were originally developed by [[Yuji Yokoo]] and correspond to the earlier stand-alone repositories. You can build them using the standard ''make'' command (assuming '''mruby''' and any additional required ports are properly installed via kos-ports). |
Latest revision as of 21:09, 7 August 2025
It is possible to develop in Ruby for the Sega Dreamcast system using the mruby implementation. This support was originally introduced by Yuji Yokoo in 2019.
Like most Sega Dreamcast software, this project uses KallistiOS (KOS) as its base.
Note: Debugging support has not been tested as of 2025.
Prerequisites
- A working KallistiOS environment must be set up, including all necessary dependencies for building KallistiOS;
- You must build the KallistiOS library;
- You must have both ruby and bison installed (see the sections below).
Installing prerequisites on Cygwin
Launch the Cygwin setup utility, search for the ruby and bison packages, and install them.
Installing prerequisites on DreamSDK
Depending on the underlying environment installed with DreamSDK, there are 2 possible cases:
If you are using the modern MinGW-w64/MSYS2 foundation
No additional prerequisites are required — both Ruby and Bison are already preinstalled.
If you are using the legacy MinGW/MSYS foundation
Install manually the prerequisites:
- Install RubyInstaller, and ensure that the ruby command is available in your system PATH;
- Use the MinGW Installation Manager to install the msys-bison-bin package.
Note: If you are using DreamSDK on Windows XP, you should install Ruby version 2.0.0 from RubyInstaller, as it is the last version compatible with that operating system.
Installing prerequisites on GNU/Linux
Use your distribution’s package manager to install the ruby and bison packages (e.g., run apt install ruby bison on Debian/Ubuntu).
Installing prerequisites on macOS
Install the ruby and bison packages using your preferred package manager (e.g., brew).
Installing prerequisites on MinGW-w64/MSYS2
Run the following command in the MSYS2 shell:
pacman -S ruby bison
Setting up mruby
The recommended way to use mruby on Dreamcast is to install the mruby port from the KallistiOS Ports repository.
First of all, make sure to clone the kos-ports repository:
cd /opt/toolchains/dc git clone https://github.com/KallistiOS/kos-ports.git .
Then, run the following commands:
cd /opt/toolchains/dc/kos-ports/mruby make install clean
This will build the embedded mruby library (libmruby.a) along with the required host tools (mainly /opt/toolchains/dc/bin/mrbc) for the Dreamcast platform.
Note: The configuration file is stored in build_config/dreamcast_shelf.rb in the mruby official repository.
Using mruby in a Sega Dreamcast project
Two example projects are included with KallistiOS in the /examples/dreamcast/mruby directory:
- dreampresent – A simple presentation tool (this needs the libpng port as well);
- mrbtris – A sample game.
These examples were originally developed by Yuji Yokoo and correspond to the earlier stand-alone repositories. You can build them using the standard make command (assuming mruby and any additional required ports are properly installed via kos-ports).