My game framework a2x is a Linux project, and last year I wanted to build it on FreeBSD 10.3. I only had to make very few changes to get it running, according to Git 18 additions and 9 deletions. This was also the first time I played with a BSD system, so I thought I'd write a few lines about it here.
I installed the
virtualbox-ext packages for my OS, and grabbed the i386 VHD of FreeBSD 10.3. I had to run
dhclient em0 after booting to get network access, so I could install packages and clone my projects' git repos.
pkg install xorg gnome3 from the terminal and restart the system. There is a
gnome3-lite package that I wanted to use instead, but it wouldn't start so I moved on.
Install GNU Make and Git with
pkg install git gmake. Running
make on a GNU/Linux system will likely call GNU Make, but on FreeBSD it calls BSD Make which expects makefiles with a slightly different syntax.
SDL 1.2 and libpng are pre-installed, but a2x uses SDL 2 on desktop platforms that support it so
pkg install devel/sdl20 audio/sdl2_mixer. All the available SDL packages are conveniently listed here.
Git was set to use colored text by default, but that seems broken in both Xterm and Gnome Terminal. Run
git config --global color.ui false to disable it and get clean output.
mkdirdoes not accept the long form
--parentsflag, so I changed all calls to use
-pinstead. I like using verbose flags in my scripts because the meaning is easier to decipher when I go over them later.
sys.platformstarts with "linux" or "freebsd", based on which it calls
$(shell sdl2-config --libs)to the linker flags, which is good practice anyway.
Since a2x cross-compiles for several different platforms, the Makefile uses the
$(CC) variable to call the C compiler instead of a hardcoded name like
gcc. On FreeBSD this had the unintended but welcome effect of using Clang, which I hadn't tested a2x with before.
I had to add
#include <zlib.h> to the PNG support module, because
png.h does not include this header like it does on Linux. It's needed for the level argument passed to
And that was it! Granted this is a C project ported from one Unix-like to another, but I still thought I'd need to do a lot more to get my games running on FreeBSD!
Back to top