Building RGBDS from source
RGBDS is open-source, which means you can always compile it yourself, for example if no pre-built solution is available to you, or if you want a specific version.
RGBDS aims to be relatively painless to compile, keeping its dependencies to a minimum:
- A C11-compatible compiler
libpng(optional, only required for RGBGFX)
Some of the build steps vary between systems, so the instructions provided here are somewhat generic. Windows works largely differently from everything else, so some expertise is expected if attempting this on Windows.
1. Get the source code
You first need to get the source files to be compiled, using one of the methods below.
- Downloading source snapshots
- Using Git
- Pick a release.
- Under the "GitHub links" heading, follow the
- Go to "Assets" at the bottom of that page.
- Download any of the last three listed files (
rgbds-<version>.tar.gz, "Source code (
zip)", or "Source code (
- Extract ("unzip") the file.
- Clone the repository.
- Then, run
git checkout <version>(e.g.
git checkout v0.4.1).
- You're set!
The following are required to build RGBDS; most of those should already be installed on your system.
cmake, depending on what method you choose below
- A C compiler, typically
byaccprior to RGBDS 0.5.0)
If you are building RGBGFX, the following are also required:
- A C++ compiler, typically
libpng's development headers. For Linux users: the package is typically called
libpng-devel, or sometimes plainly
libpng. Additionally, a
1.6may be present after
Two build systems are supported: plain old
make, and CMake.
Both can be used on most systems, but Windows users will almost certainly be unable to use
Make sure to run all of the following commands from the root directory of the sources!
That directory should contain a file called
Makefile, another called
CMakeLists.txt, and a few more.
Simply run the following two commands:
sudo make install
The second command is optional if you don't want to install RGBDS system-wide.
The following variables can be defined to control installation, like so:
make install PREFIX=~/.local
PREFIX: Location where RGBDS will be installed. Defaults to
bindir: Location where the binaries will be installed. Defaults to
mandir: Location where the manpages will be installed. Defaults to
DESTDIR: This is prepended to all paths during the installation. It is mainly used for packaging.
Q: Whether to quiet the build or not. To make the build more verbose, clear this variable. Defaults to
STRIP: Whether to strip the installed binaries of debug symbols or not. Defaults to
BINMODE: Permissions of the installed binaries. Defaults to
MANMODE: Permissions of the installed man pages. Defaults to
Building RGBDS with CMake requires CMake 3.9 or later.
Run CMake on the project:
- CMake 3.13 and later
- CMake 3.12.4 and earlier
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build build
You can install RGBDS. You are not required to, you can do whatever with the four binaries in
build/srcat this point.
- CMake 3.15 and later
- CMake 3.14 and earlier
sudo cmake --install build
sudo make install