Day 1 of 60: Fun and games with pkgsrc

In the years that I've been using Solaris it's support for third party packages has, to my mind, always let it down. The open source community writes and releases software at a phenomenal rate, and systems like FreeBSD and Linux have developed a number of interesting ways to make it as easy as possible to get this software, install it, and (much more importantly) manage it once it's been installed.

As third party applications grow in complexity (especially in terms of the dependencies that they might have on other applications and libraries) this becomes an increasingly difficult challenge.

It's a challenge that the open source community is particularly well suited to meeting. The "many hands makes light work" effect, and the fact that it's possible for an individual to make a contribution without investing a great deal of effort means that thousands upon thousands of open source applications and libraries are now trivial to install on many open source operating systems.

That same has not been true, historically, about Solaris. Sure, there's been sites like Sun Freeware, but the size of that community is dwarfed by the size of the communities packaging applications for the open source operating systems.

Consequently, installing and managing third party software (especially if it has complex dependencies) has always been a bit of a chore on Solaris.

A few years back I attended a talk given by Alistair Crooks at EuroBSDCon 2002. Alistair spoke about a package management system that NetBSD was using, forked from the FreeBSD ports tree. One of the interesting things about this was that following the NetBSD "runs anywhere" mantra, this system, called pkgsrc, could be used to build and manage packages across multiple operating systems, including Solaris.

Fast forward a few years, and pkgsrc has its own website ( and is growing in size. So I put it on my "list of technologies to keep an eye on".

The pkgsrc system is very similar to the FreeBSD Ports system.

Essentially, the acts of downloading a source tarball from the Internet, verifying the file's checksum, extracting it, applying any patches, configuring, building, and installing the resulting files have been automated using make(1). Package dependencies are also tracked, with pkgsrc recording this metadata in its own packaging format and database, independent of the operating systems own package database.

This might seem like needless duplication of effort, but it does mean that if your environment runs multiple operating systems you can use pkgsrc to build and manage packages for all these operating systems using the same tools, instead of pkgadd(1) on Solaris, rpm(1) on Linux, and so on.

This evening has been spent getting pkgsrc to play nicely on Solaris 10. This is a not-quite-supported configuration, so I've had to go round the loop a few times. After playing around with a mixture of packages from Sunfreeware and pre-compiled binaries from elsewhere I eventually figured out the magic incantations. And they are as follows (and assume that Sun Studio 10 is installed).

  1. Download the most recent pkgsrc snapshot from here (note: that link will go stale over time

  2. Download the Solaris 9 pkgsrc bootstrap

  3. Extract both of those in to /

  4. # cd /usr/pkgsrc/bootstrap; ../bootstrap

  5. Copy the generated mk.conf to /usr/pkg/etc/mk.conf.

  6. Add the line "PKGSRC_COMPILER=sunpro" to that mk.conf file.

That, at least, is sufficient to allow the following to work:

# cd /usr/pkgsrc/lang/perl5
# bmake install

Which results in the source for Perl (v5.8.8) being downloaded, patched, configured, built, and installed. Along with any dependencies it might need.

# pkg_info
digest-20060302 Message digest wrapper utility
libiconv-1.10nb3 Character set conversion library
gettext-lib-0.11.5nb6 Internationalized Message Handling Library (libintl)
pkg_install-info-4.5nb3 Standalone GNU info file installation utility
gmake-3.80nb4 GNU version of 'make' utility
perl-5.8.8nb2 Practical Extraction and Report Language
libtool-base-1.5.22nb3 Generic shared library support script (the script itself)

Now to go and try xemacs....

No comments:

Post a Comment