Brian Robert Callahan

submited by
Style Pass
2021-06-28 06:30:06

Let's write an OpenBSD port together. Earlier today, I became aware of the TIC-80 tiny computer/fantasy video game console. That sounds incredibly cool and I have been hoping for something like this ever since I learned about the PICO-8 fantasy console. Unfortunately, the PICO-8 is not open source but the TIC-80 is.

Follow along with me as I write an OpenBSD port for the TIC-80. What appears to be a simple port ended up being a quite interesting challenge.

If you do not already have the ports tree set up, follow the Porter's Handbook for setup instructions. I am going to presume that you already have the ports tree set up, or are going to set it up with help from the documentation.

Once you're set up, we will need to create a working directory for our new port. Fortunately, OpenBSD ports has a workspace that allows the creation of new ports while keeping the official ports tree clean of the new ports we are working on. We'll make a new directory: /usr/ports/mystuff. Anything under this directory will be treated as if it was in the real ports tree. It helps us keep things organized while these ports are not yet in the real ports tree.

The work-in-progress ports under /usr/ports/mystuff need to be organized like the real ports tree. I have decided that our new TIC-80 port should live in the games category and the port name should be tic80, as that is the way the final binary is written and I think it is generally a good idea to name the port and package the same as the binary that the user will run after installing the package. So let's create our new port's working directory: /usr/ports/mystuff/games/tic80. We'll be working from within that directory, so cd into the newly created directory. Finally, we will need a starting Makefile. There is a template in /usr/ports/infrastructure/templates/Makefile.template that you can copy into our new directory. I start off by copying the Makefile of another port, but that might not be the best approach if you are new to porting. In any case, once you have a starting Makefile, our setup is complete.

Leave a Comment