pkgsrc logo

Portable Package Management

pkgsrc is a framework for building over 17,000 open source software packages. It is the native package manager on SmartOS, NetBSD, and Minix, and is portable across 23 different operating systems. Use one package manager across all of your systems!

Joyent provide binary packages for SmartOS/illumos, Mac OS X, and Linux.


Package Building Setup

Our goal at Joyent is that our binary packages fulfill all of our users' needs. This isn't always possible, however - users may want packages we do not yet provide, or need to build with different options enabled. We also want users to get involved in package development.

To satisfy those demands, it should instead be reasonably straight-forward for users to build and develop their own packages, and this guide hopefully provides all the information for them to do just that.

Host Setup

Follow the section below for your target OS, then head to the Overview section for a description of pkgbuild.

For SmartOS users we provide a `pkgbuild` image. This contains everything you need to get going. The most recent is the `16.1.0` release:
imgadm update
imgadm import 4183fce6-49b2-11e6-a1ca-4f007e77f9d5
Create a zone using that image uuid, giving it plenty of RAM if you are planning to build large packages.
Ensure you have the latest trunk bootstrap installed. Fetch pkgbuild and pkgsrc. `/data` is somewhat hardcoded at this point, though with some work you can use a different prefix if necessary (though currently undocumented).
mkdir /data; cd /data
git clone git://github.com/joyent/pkgbuild.git
git clone git://github.com/joyent/pkgsrc.git
For OS X you will want to track the `joyent/osx/trunk` branch, i.e.:
cd /data/pkgsrc
git checkout joyent/osx/trunk
git submodule init
git submodule update
While for Linux you don't need to do anything and can use the default `trunk`. Finally, add the `pkgbuild/scripts` directory to your path.
PATH=$PATH:/data/pkgbuild/scripts

Overview

The pkgbuild repository aims to recreate the same environment that produces the official Joyent binaries. The run-sandbox script prepares a chroot environment with everything set up ready to build packages. It takes a single argument which is the pkgbuild configuration to use, based on one of the directories under /data/pkgbuild/conf.

Some examples:

run-sandbox 2016Q2-x86_64   # Create a 64-bit SmartOS sandbox
run-sandbox 2016Q2-i386        # Create a 32-bit SmartOS sandbox
run-sandbox osx-trunk-x86_64   # Create a 64-bit OS X sandbox
run-sandbox linux-trunk-i386   # Create a 32-bit Linux sandbox