BSD DevCenter
oreilly.comSafari Books Online.Conferences.


FreeBSD Basics

Building Binary PC-BSD Packages

by Dru Lavigne

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:

% pwd
% su

# mkdir -p pbi/digikam
# cd pbi/digikam

Step 2: Download the FreeBSD Package and Any Required Libraries

Using the exact name of the package, you can fetch it directly:

# fetch

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:

# pkg_add digikam-0.7.2.tbz
pkg_add: could not find package libltdl-1.5.10 !
pkg_add: could not find package libexif-0.6.10 !
<snip 9 other missing packages>

# fetch
# fetch
<snip 9 other fetches>

Then try to install the package again:

# pkg_add digikam-0.7.2.tbz

Don't worry if you receive warnings indicating that some software has a greater revision number than is required. You can double-check the install was successful with:

# pkg_info | grep digikam
digikam-0.7.2    Photo album manager for KDE with gphoto2 backend
BSD Hacks

Related Reading

BSD Hacks
100 Industrial Tip & Tools
By Dru Lavigne

Pages: 1, 2, 3, 4, 5

Next Pagearrow

Sponsored by: