I recently gained access to a number of diverse systems: OpenBSD
on sparc64, some Linux machines (Debian,
Ubuntu), NetBSD,
FreeBSD, OmniOS,
Mac OS X,
and Solaris.
The mission?
Port the BSD.lv tools to all of these systems. These articles
describe the steps, tools, and methods I used along the way.
The mission of these articles isn't so much to explain the nitty-gritty of header file and
function portability—though there'll be plenty of that—but to explore the process
required if you plan on doing the same.
introduction
The tools (e.g.,
lowdown,
kcgi,
openrsync, and the others listed
here)
are all in the C language.
All use Makefiles (BSD make), and all
have similar make rules.
Instead of writing for a portability library that may have its own dodgy quirks, I write
software for OpenBSD first.
So the mission is to make OpenBSD software available on non-OpenBSD systems.
In other words, the source code should run natively on OpenBSD, with portability glue
added in for other systems.
All tools already used oconfigure for
minimum portability of OpenBSD to Linux and (some) FreeBSD.
(The next section, configuration, covers this system in
detail.)
Source repositories were all mirrored on GitHub.
(This is significant for testing, which I cover in part 3.)
In general, mirroring on GitHub is useful because it's easy for folks to submit pull requests
and submit issues.
It's also not useful because it's easy for folks to submit pull requests and submit issues.
But that's a different story entirely.
Prior to all the documented work, portability was on an as-needed basis.
Some systems were ported to Linux (Debian) and some to
FreeBSD.
The freshness of this portability was non-uniform across BSD.lv tools.
That about describes the lay of the land: C code, a simple configuration script, Makefiles, and
heavy OpenBSD dependence.
After logging in to the new systems and configuring them, I started by downloading then
expanding the configuration tools as-needed.
Read on for this work!
acknowledgements
Especial thanks to Michael Dexter for making his
laboratory available for system portability work.
Also thanks to Stefan Sperling for making space on a SPARC64
for alignment portability.
For the system itself, I used the
portable OpenSSH software as both a
reference and in some cases for the compatibility functions themselves.
This tool is the gold standard for clean, readable portability!
I also used mandoc as a basis for a lot of this work, as
Ingo's approach to the portability worked well for my needs.