ZoomTen / rgbenv

RGBDS version manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rgbenv

This is a version manager for RGBDS that's a pure shell script.* Inspired by pyenv and rbenv, it lets you easily switch between multiple versions of the RGBDS suite to suit different projects.

* Bash script, at the moment. Compatibility with other shells is not guaranteed.

What does it do?

  • Installs or uninstalls a specific version of the RGBDS suite.
  • Lets you configure the default version to use.
  • Lets you specify a version to be used with a specific project.

How does it do that?

PATH is the variable used by the system to determine where to find some program. It contains a list of directories, separated by a colon each:

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin

Left-most directories take priority. If a program isn't found there, it will search the directory next to it.

As an example, if you installed RGBDS 0.6.0 through your package manager, it would place the suite programs in /usr/bin. If you compiled, say, version 0.4.1 of RGBDS manually and placed it in /usr/local/bin, then that version would take precedence over 0.6.0.

What rgbenv does is override this variable so that its managed folder takes precedence over that of the system. In Unix-like systems, you can check which directory a program is to be run from (for example, rgbasm) using this command:

$ which rgbasm

What do I need?

  • A Unix-like environment with GNU coreutils
    • Linux or BSD preferable
    • On Windows, you may use WSL with a distro of choice or MSYS2 (Cygwin may work?)
  • git
  • curl
  • RGBDS build dependencies

You can use these commands to get them:

  • Debian:
    # apt update
    # apt install libpng-dev pkg-config build-essential bison git curl
    
  • Alpine Linux:
    # apk add findutils coreutils grep git curl make pkgconfig gcc libc-dev libpng-dev bison
    

How do I set it up?

  1. Install whatever dependencies it needs, through the above section.
  2. Download the rgbenv script, and place it in /usr/local/bin/ (or any directory listed when you run echo $PATH)
  3. Ensure the script is executable:
    # chmod +x /usr/local/bin/rgbenv
    
    (replace /usr/local/bin/rgbenv with where you put the rgbenv script)
  4. Install the version you want, say 0.6.0:
    $ rgbenv install 0.6.0
    
  5. When prompted to add export PATH=... to .bash_profile, do so, then run:
    $ source ~/.bash_profile
    
    Note: in some shells, you may need to specify .profile instead of .bash_profile.
  6. Set your version as the default:
    $ rgbenv use 0.6.0
    
  7. Verify that RGBDS really is the version you picked:
    $ rgbasm -V
    

How to set a project-specified version

On the current working directory, make a file named .rgbds-version. This shall be a text file containing only the version number to be used. For example:

$ cat .rgbds-version
0.6.0

Quick commands

  • rgbenv use 0.5.1 - set default RGBDS version to 0.5.1
  • rgbenv no-use - clear the defaults and use the system-provided RGBDS, if any
  • rgbenv exec -v 0.4.2 make - run make using RGBDS 0.4.2
  • rgbenv exec make - run make with the project-specified RGBDS version.

About

RGBDS version manager

License:MIT License


Languages

Language:Shell 100.0%