Building Individual Packages

To build an individual package, you will need buildtools from the cvs repository, and the latest packages needed for building the package you wish to build. That's a bit confusing, so just get the entire directory of packages.

There are two ways to build packages, you can build one from an existing source directory on your local disk, or you can build straight from the cvs repository. I'll cover both of these methods, starting with building from an existing source directory. For these examples it will be assumed that your existing packages are in /src/in and the directory where you wish the new packages to be deposited is /src/out. One important thing to note is that if a required package for building exists in the out directory, it will be used instead of the package in the in directory. This way, you can leave your in directory intact, and use your most recent packages for building.

When building the package, the default build location is /tmp/roots/packagename-version. This is where the required packages will be installed, and the new package will be built. If you wish to change the build location, set the BUILDIT_DIR environment variable to your desired build location. For (t)csh:

setenv BUILDIT_DIR /src/buildit

For Bourne shell:

export BUILDIT_DIR=/src/buildit

Building a Package from a local directory

For this example, it will be assumed that the source directory you're trying to build is /src/package. To build the package, execute the following as root:

darwin-buildpackage --dir /src/package /src/in /src/out

You have to execute the command as root, since the script will be creating a chrooted environment, installing the necessary tools, building the package, installing it into the chrooted environment, and then packaging it all up.

Building a Package from cvs

The first thing you'll have to do for this is to setup your anonymous cvs environment. You'll have to get your anonymous cvs login from Apple, set your CVSROOT environment variable, and login to the cvs server. There are instructions to do that on the Apple anoncvs site, http://www.opensource.apple.com/tools/cvs.

Once you've got your anonymous cvs account and environment setup, you can start building by running the following command as root:

darwin-buildpackage --cvs package-tag /src/in /src/out

The package-tag is the cvs tag for the project you want to build. For example, xnu-3.1.