Building Binary PC-BSD Packages

FreeBSD is starting to make waves in the desktop arena, and not just as the Darwin core of the popular Mac OS X operating system. Several FreeBSD-based desktop projects have emerged in the past few years and have matured to the point where a nontechnical user can easily install a system fully configured for sound, a network, and applications. In addition to ease of use, benefits include no cost, the BSD license, and the stability and security inherent in FreeBSD.

One of these projects is PC-BSD, which provides two additional features that will make it a strong contender in the desktop market. The first is the Online Update Manager, which with a click of the mouse allows a user either to schedule or to manually check for updates to the operating system and installed applications. If necessary updates exist, the system automatically downloads and applies them, making it a trivial task to keep the system patched.

The second feature is a GUI application installer and uninstaller. While advanced users can still use the FreeBSD ports and packages collection, casual users can simply download a PBI (PC-BSD package) from the PBI application directory, double-click on it, and watch as the GUI installer performs its magic.

PBIs have the advantage of being entirely self-contained. That means casual users won't inadvertently overwrite existing libraries or files by installing and uninstalling applications.

This article shows how to create your own PBI, using Digikam as an example of a rather complex package with many library dependencies. While most PBIs will be easier to generate, I want to demonstrate most of the gotchas you may run across when generating your own PBIs.

While casual users won't be making their own PBIs, you don't have to be a programmer to do so. If you have basic Unix skills, are comfortable with the FreeBSD packages collection, and have a meticulous nature, you can easily create your first PBI in the space of an afternoon. This article assumes that you are working on an existing PC-BSD system.

Step 1: Create Your Staging Area

Also, double-check that there is an existing FreeBSD package in the
packages/All/ subdirectory at the FreeBSD ftp site for your FreeBSD
release.

Note: at the time of this writing, 6.0-RELEASE had just come out, so there weren't that many packages in 6.0-RELEASE/packages/. Check 6.0-RELEASE/packages first, as it will contain the most up-to-date packages; if yours isn't there, use the one in 5.4-RELEASE/packages/.

Next, become the superuser and create a directory for the application in your regular user account's home directory:

Step 2: Download the FreeBSD Package and Any Required Libraries

Next, install the package to make sure you don't have any missing dependencies. If you're lucky, it will just install and you'll get your prompt back. If you instead get error messages, you will have to fetch the missing dependencies: