Using Ruby for Sega Dreamcast development: Difference between revisions

From dreamcast.wiki
Jump to navigation Jump to search
 
m (Updating the build instruction for making mruby.)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
It's possible to develop in Ruby for the Sega Dreamcast using the mruby implementation. The proof-of-concept was made by [[Yuji Yokoo]] back in 2019. This is experimental and a lot of features are missing/not working/not tested (e.g. debugging).
It's possible to develop in [https://www.ruby-lang.org Ruby] for the Sega Dreamcast system using the [https://mruby.org/ mruby implementation]. This proof-of-concept was initially made by [[Yuji Yokoo]] back in 2019. This is experimental and a lot of features are missing, not working and/or not tested (e.g. debugging).
 
As almost all Sega Dreamcast software, this uses [[KallistiOS]] (KOS) as base.
   
   
== Prerequisites ==
== Prerequisites ==


You should have a working [[KallistiOS]] environment. Also you need to have rake and bison installed.
* You should have a working [[KallistiOS]] environment and all the dependencies made for compiling KallistiOS installed;
* You need to have [[KallistiOS]] library built;
* The ''/opt/toolchains/dc/kos/kernel/build/newlib_kill.o'' and ''/opt/toolchains/dc/kos/kernel/build/newlib_getpid.o'' object files should be on your disk (they are produced when building KOS) - this is actually an issue that should be fixed later;
* You need to have ''rake'' and ''bison'' installed (see below).
 
=== Installing prerequisites on Cygwin ===
 
Open the Cygwin setup and search for the ''rake'' and ''bison'' packages and install them.
 
=== Installing prerequisites on DreamSDK (MinGW/MSYS) ===
 
If you use the [[DreamSDK]] environment (or your custom [http://mingw.org MinGW/MSYS] environment) you need to install '''Ruby''' for Windows and the additional ''bison'' package.
 
* Install [https://rubyinstaller.org/ RubyInstaller] then verify that the ''rake'' command is available in the ''PATH'' environment variable.
* Install ''msys-bison-bin'' package from the '''MinGW Installation Manager''' program.
 
'''Note:''' If you are using DreamSDK on Windows XP, then you should install [https://rubyinstaller.org/ RubyInstaller] 2.0.0 as it the last version which supports this system.
 
=== Installing prerequisites on GNU/Linux ===
 
Install the ''rake'' and ''bison'' packages with your package manager (e.g. ''apt'' with Debian/Ubuntu).


=== Installing prerequisites on MinGW/MSYS ===
=== Installing prerequisites on macOS ===


Install RubyInstaller (if XP : 2.0.0) then add it to the path.
Install the ''rake'' and ''bison'' packages with your package manager (e.g. ''brew'').
Install bison in the MinGW Get program


=== Installing prerequisites on MinGW-w64/MSYS2 ===
=== Installing prerequisites on MinGW-w64/MSYS2 ===
Line 16: Line 37:
== Setting up mruby ==
== Setting up mruby ==


Open a Shell and type the following:
Open a Terminal and type the following:


  cd /opt
  cd /opt
  git clone https://github.com/mruby/mruby.git
  git clone https://github.com/mruby/mruby.git
  cd /opt/mruby
  cd /opt/mruby
  cp examples/targets/build_config_dreamcast_shelf.rb /opt/mruby/build_config.rb
  make MRUBY_CONFIG=dreamcast_shelf
make
 
This will generate all the required files, i.e. the host tools plus the embedded mruby library (''libmruby.a'') for the Sega Dreamcast.
 
== Using mruby on a Sega Dreamcast project ==
 
Currently, two projects are available as template:
* [https://github.com/yujiyokoo/dreampresent Dreampresent]: A simple presentation tool;
* [https://github.com/yujiyokoo/mrbtris-dreamcast Mrbtris]: A sample game.


This will generate all the required files, the -lmruby is now available
Clone these repositories then build these projects by using the usual ''make'' command (of course, this requires '''mruby''' installed properly!).

Latest revision as of 16:56, 6 January 2023

It's possible to develop in Ruby for the Sega Dreamcast system using the mruby implementation. This proof-of-concept was initially made by Yuji Yokoo back in 2019. This is experimental and a lot of features are missing, not working and/or not tested (e.g. debugging).

As almost all Sega Dreamcast software, this uses KallistiOS (KOS) as base.

Prerequisites

  • You should have a working KallistiOS environment and all the dependencies made for compiling KallistiOS installed;
  • You need to have KallistiOS library built;
  • The /opt/toolchains/dc/kos/kernel/build/newlib_kill.o and /opt/toolchains/dc/kos/kernel/build/newlib_getpid.o object files should be on your disk (they are produced when building KOS) - this is actually an issue that should be fixed later;
  • You need to have rake and bison installed (see below).

Installing prerequisites on Cygwin

Open the Cygwin setup and search for the rake and bison packages and install them.

Installing prerequisites on DreamSDK (MinGW/MSYS)

If you use the DreamSDK environment (or your custom MinGW/MSYS environment) you need to install Ruby for Windows and the additional bison package.

  • Install RubyInstaller then verify that the rake command is available in the PATH environment variable.
  • Install msys-bison-bin package from the MinGW Installation Manager program.

Note: If you are using DreamSDK on Windows XP, then you should install RubyInstaller 2.0.0 as it the last version which supports this system.

Installing prerequisites on GNU/Linux

Install the rake and bison packages with your package manager (e.g. apt with Debian/Ubuntu).

Installing prerequisites on macOS

Install the rake and bison packages with your package manager (e.g. brew).

Installing prerequisites on MinGW-w64/MSYS2

 pacman -S rake bison

Setting up mruby

Open a Terminal and type the following:

cd /opt
git clone https://github.com/mruby/mruby.git
cd /opt/mruby
make MRUBY_CONFIG=dreamcast_shelf

This will generate all the required files, i.e. the host tools plus the embedded mruby library (libmruby.a) for the Sega Dreamcast.

Using mruby on a Sega Dreamcast project

Currently, two projects are available as template:

Clone these repositories then build these projects by using the usual make command (of course, this requires mruby installed properly!).