NPC on Solaris developer HOWTO

Author: Solarpack Project Team
Revision: 1.7
Date: 2003-05-15

This document explains how to install the NetBSD package collection tools (NPCT) on a Solaris machine from the sources. It's probably better to read the basic, binaries installation HOWTO before.

Each section details one compilation step. Hopefully they are independent from each other, so you can skip the specific sections where you prefer to use available binaries.

Please note that (almost) everything related to building stuff from pkgsrc can easily be performed only with root privileges: hence, it shouldn't be used on production machines.

1   Compiling the NPCT bootstrap kit


The binary kit is just a somewhat strange synonym for the compiled bootstrap kit.

Download the bootstrap-pkgsrc.tar.gz source code, preferably from the solarpack site. The tarball from the solarpack site is generally more up-to-date, slightly patched by us, and well tested on Solaris.

TODO: release our bootstrap patches properly.

Then you need a working C compile chain. We recommend to install the linker ld from Solaris, GCC from the Solaris Companion CD and its dependencies, as detailed below, but you may succeed in alternate ways. For instance, you can use the linker from SFWgbin instead of SUNWtoo's ld if you are not afraid by fiddling with symbolic links. Or you can follow the instructions in bootstrap-pkgsrc/README.Solaris.

package name description
SUNWtoo Programming Tools (ld)
SFWgcc GNU Compiler Collection
SFWgcmn Common GNU package
SUNWsprot Solaris Bundled tools (make, as,...)
SUNWarc Archive Libraries
SUNWbtool CCS tools bundled with SunOS (nm, ar,...)
SUNWhea SunOS Header Files

The SUNWxxx names identify packages from your base Solaris distribution. SFWxxx packages are located on the Companion CD. Companion CD packages can also be conveniently downloaded from most Sunfreeware's mirrors, in the companioncd subdirectory.

GCC from the Companion CD sits in /opt/sfw/bin:

# PATH=${PATH}:/opt/sfw/bin

Then follow the bootstrap instructions at NetBSD, using the following arguments to the bootstrap command:

# ./bootstrap --prefix=/usr/pkg --pkgdbdir=/usr/pkg/var/pkg


If you decide to have your software be installed elsewhere (e.g., --prefix=/opt) then you will neither be able to install binaries from our repositories, nor to submit your binaries to Solarpack.

If something failed, you will have to run ./cleanup before ./bootstrap again. If you want to save this bootstrap kit to use it on other machines, do create a binary kit like this:

# cd /; tar cf /tmp/npct-SunOS-5.N-arch-date.tar /usr/pkg

After going through the following section, you'll have to start by building GCC from pkgsrc (because you don't want binaries to link with the bootstrap GCC's libraries), so that everything you build is built with the version of GCC that's inside the sandbox.

2   Getting pkgsrc

To build software, you will need those packages:

package name description
SUNWbash GNU Bourne-Again shell (bash)
SUNWgpch The GNU Patch utility
SUNWsrh Source Compatibility Header Files
# pkginfo SUNWbash SUNWgpch SUNWsrh

pkgsrc is a tree of Makefiles and patches that allow one to build a variety of packages from source, on many different platforms.

It's developed by the NetBSD team; we've branched off it because we need to modify it slightly in some places to make it work better on Solaris.

In the future, we will release pkgsrc tarballs here. For the moment, you'll have to fetch pkgsrc from Solarpack's CVS repository:

# cd <wherever>
# export CVSROOT
# cvs login
# cvs -z3 co solarpkgsrc
# ln -s <wherever>/solarpkgsrc /usr/solarpkgsrc

To understand pkgsrc, please read this NetBSD introduction or the lengthy pkgsrc reference (also available in /usr/solarpkgsrc/Packages.txt).


Read bmake everywhere the documentation says make -- under NetBSD, the BSD make utility is installed as make, whereas make on Solaris is different.

Once you've understood how things work, you can get started: an important step is to add the global bmake configuration file:

# ln -s /usr/solarpkgsrc/mk.conf /etc/mk.conf

Then, move to a package directory, and build it!

3   Hacks

Some shell scripts (including some of those in pkgsrc) use functionnality that doesn't exist in the POSIX flavor of the Bourne sheel, e.g. some of the nuts and bolts specific to GNU bash. Moreover, Sun's /bin/sh is not fully POSIX compliant -- the POSIX shell is located in /usr/xpg4/bin/sh. For this reason, you should probably replace /bin/sh with /bin/bash or with /usr/xpg4/bin/sh either by linking or by replacing /bin/sh.

Sometimes even this doesn't work; for instance, we had to compile the gnome-vfs package with bmake SH=/bin/ksh...

Solaris and Sun are trademarks of Sun Microsystems, inc