Fruit of the Tree of Ports
Ian Darwin
Of every tree of the garden thou mayest freely eat:
But of the tree of the knowledge of good and evil, thou
shalt not eat of it: for in the day that thou eatest thereof...
...But of the tree of the knowledge accumulated in /usr/ports,
there shouldst thou eat plentifully.
-- The Book of *BSD, Genesis 2.
This column will feature a look
at some of the treasures hidden
in the "ports" tree that is included
with all three BSD distributions
In the good ole days of BSD UNIX, getting others'
free software to compile and run on your system was
a matter of luck, skill and hard work. A lot of
software in those days had hidden dependencies on
a particular hardware architecture, word size, compiler
bug, or operating system variant. Even in the early 1980's
there were enough divergent UNIces that people had begun
to think about software portability within UNIX. In 1984 Geoffrey
Collyer and I wrote a small paper entitled
Can't Happen
or
/* NOTREACHED */
or
Real Programs Dump Core
which I delivered to a room full of techies and a few suits
at the Dallas USENIX Conference on January 21, 1985.
In the paper we urged developers to write clean, portable code,
to use common sense, and to omit needless dependencies.
The paper circulated for many years on the Internet (before this
new-fangled Web thing was even a gleam on TBL's coding form).
Porting code back then, then, took a lot of work. And that work
would often be duplicated at different sites.
What was needed was a standard way of capturing the effort that
one person or group had invested in porting software, so that
others could benefit from it. The solution was the "ports tree".
First invented on FreeBSD, the ports tree is now present in all
three BSD distributions.
A "port" is a set of files containing the minimum amount of information
to retrieve, configure, build and install a given program on a
given BSD distribution. Since there may be platform dependencies,
a port made for OpenBSD may not run on FreeBSD, or vice versa.
However, if a port is made for, let's say, NetBSD, it can usually
be moved to FreeBSD or OpenBSD with minimal effort.
And once someone has made a port for your distribution, you are the
winner. Because once you have the "port" information, you need only change
directory and type "make" to get the software downloaded, configured,
patched, and built. Or you can simply type "sudo make install" to do
all that plus install it on your system. This bears repeating. Once a
port is available for the program you want,
no longer do you need to pore over compiler errors about include file
conflicts and other cryptic messages. You just type "make install"!
This provides the same ease-of-install to the BSD platforms as
"setup.exe" provides on the Microsoft OSes.
And, it provides it in the same way across all three BSD distributions,
and on the dozen or so platforms that NetBSD and OpenBSD run on besides!
That said, this column will feature a look at some of the treasures
that can be found in the ports tree. This month's looks at my favorite
man page viewer, tkman. TkMan was written by Tom Phelps (phelps@acm.org)
when he as at Berkeley in the early 1990s. It has features that go
far beyond the default viewers like the man command and xman.
Tkman understands the structure of manual pages, so you can for example
jump to the FILES section or the DESCRIPTION section of the page you're
viewing. If you go to the SEE ALSO section, in fact, you'll find that
the entries there are formatted as hyperlinks; click on one and tkman
will, just like a Web browser, jump to the appropriate page
(Yes, Virginia, there are hyperlinks everywhere -
neither Netscape founder Marc Andreessen nor Bill Gates invented hyperlinks).
TkMan takes it one step further, though. If you click on an ordinary word
in the text of a page, TkMan will do a keyword search on it and, if
it matches a man page, will jump to that page directly!
In version 2.0 of TkMan, each recognized section heading that has
more than one line will also display a little triangle before the name,
and the number of lines in it. This makes navigating through long
chatty man pages a real breeze.
In short, I really, really recommend tkman. To install it, you need only
cd /usr/ports/misc/tkman
make
sudo make install
and you should have a working tkman. On some versions you may need
to fetch the two adjunct programs rman and glimpse, although this is
supposed to happen automatically. Since TkMan is, as the name implies,
written using John Ousterhout's Tk toolkit, the make process will also
download and install current versions of Tk and Tcl if they're not
already on your system - further proof of how much work
the "ports" tree does for you!
|