Skip to content

Compiling On MacOS

Chadow edited this page Mar 21, 2024 · 9 revisions

Contents

  1. Requirements
  2. Building Gosu
  3. Building The Wrapper
  4. Distributing

Requirements

For Gosu, check this out. You'll also need a working installation of Ruby, Git and CMake.

Building Gosu

Get the source code from the releases page then extract it on some place. And run the following commands there:

mkdir build
cd build
cmake ..
make

Note the generated libgosu.dylib and ffi/libgosu-ffi.dylib, we'll need them later.

Building The Wrapper

Get the source code from the releases page and extract it, on the vendor directory, create a directory named gosu, then move the ffi directory of Gosu there, and make another directory named lib64, place the .dylib files there. Your final directory structure should look like this:

.
├── assets
├── include
├── scripts
│   └── mruby
├── src
└── vendor
    ├── gosu
    │   ├── ffi
    │   │   └── Various headers needed for compilation...
    │   └── lib64
    │       ├── libgosu-ffi.dylib
    │       └── libgosu.dylib
    ├── mruby
    ├── physfs
    └── whereami

Then proceed to build the project as usual.

mkdir build
cd build
cmake ..
make

And that's it!

Distributing

Since we can't expect every person to ever run the compiled binary to have Gosu installed on their system, we'll need to bundle the .dylib files with the binary, using install_name_tool we can tell the executable to look for the dynamic libraries in its directory.

install_name_tool -add_rpath @executable_path/. gosu-mruby

Then, just bundle the .dylibs and you're done.

Clone this wiki locally