[OpenBSD]

The Ports & Packages collection


Index


Motivation

OpenBSD is a fairly complete system of its own, but still there is a lot of software that one might want to see added. However, there is the problem of where to draw the line as to what to include, as well as the occasional licensing and export restriction problems. As OpenBSD is supposed to be a small stand-alone UNIX-like operating system, some things just can't be shipped with the system.

The ports & packages collection does NOT go through the thorough security audit that OpenBSD follows. Although we strive to keep the quality of the packages collection high, we just do not have enough human resources to ensure the same level of robustness and security.

The port collection, originally borrowed from FreeBSD, fills this gap. The concept is to have, for each third-party software, a Makefile that controls

This information is kept in a directory hierarchy under the /usr/ports directory.

Packages are the binary equivalent of ports. A compiled port becomes a package that can be registered into the system using pkg_add(1)

Packages look like simple .tgz bundles, but they should always be added using pkg_add(1), as there might be some extra information that only pkg_add(1) knows how to handle. Tip: you can distinguish between packages and .tgz bundles using pkg_info(1).

Getting Packages

A large collection of pre-compiled packages is available for most common architectures. Adding a package is as easy as pkg_add pkgname.tgz. If you are grabbing packages off a single source (a package repository), set PKG_PATH to that repository URL, in order to grab dependencies.

For instance, to install the Gimp package for the 3.0 release on an i386 machine off the ftp site (including dependencies), do:

    # setenv PKG_PATH ftp://ftp.openbsd.org/pub/OpenBSD/3.0/packages/i386/
    # pkg_add ${PKG_PATH}gimp-1.2.2.tgz

Ports and Packages Update for an OpenBSD Release

The 2.7 release saw the introduction of a stable branch for the ports tree.

For instance, to grab the stable branch for the 3.0 release:

    $ cd /usr/ports
    $ cvs -q -d anoncvs@some.anon.server:/cvs up -r OPENBSD_3_0 -Pd

Starting with the 2.8 release, selected binary packages are also made available. Thanks to Christian Weisgerber for handling the hard work of coordinating the stable branch changes. Please refer to the stable packages page to find out about updated packages and important updates to the stable branch.

Package names are always changed in case of a package update, to avoid any risk of confusion between a package from the release and a bug-fixed package.

Managing Installed Packages

The packages(7) manual page holds useful information about ways to manage installed packages, solve conflicts (files that already exist) and handle dependencies.

As of OpenBSD 2.8, to update a package you must:

This is slightly inconvenient, as packages may trigger dependencies, and you may have to remove a large subset of packages for an update.

Using Ports

If a given package does not exist for your architecture, you may still be able to compile the port. Besides, some users will want to compile everything from source for various reasons.

You can ftp the release version from the pub/OpenBSD/[version] (where [version] is the release number) directory on any of the ftp mirror sites. The release versions are the ones we ship on our CDROM, and have gone through more testing than any snapshot. Further information is available in the ports(7) man page.

Life Cycle of the Ports Tree

The ports tree, like the rest of OpenBSD, is constantly changing.

The current ports tree may not be used with the previous release. This is due to changes, typically with the port make process, that require code based upon the OpenBSD-current source tree.

The ports tree works as a single entity. Updating a single directory is not guaranteed to work, as package dependencies may force you to update and recompile vast portions of the ports tree. It is strongly suggested that people don't track ports-current unless they're prepared to deal with various problems. Mailing lists such as ports-changes@openbsd.org or tech@openbsd.org will probably be invaluable.

You are advised to track ports-stable on a production machine: we will try to keep the stable ports tree up-to-par with respect to problems, and to provide timely binary updates as well.

Note that vanishing distfiles is not an issue, as ftp.openbsd.org holds the complete repository. Even changing checksums is not an issue: you can issue the command

	make checksum REFETCH=true 
to make sure you are grabbing the correct distfile for your ports tree. For definitions of current and stable, see the Upgrade Mini-FAQ.

A list of daily changes to ports and ports-current is available.

The ports-current tree can be retrieved via:

Ports and XFree86

There is some special magic in the OpenBSD XFree86 configuration files that allows the ports tree to install imake-based applications under /usr/local.

As of 2.9, OpenBSD ships with XFree86 4.0.3. If you are using a previous distribution, together with XFree86 binaries from the XFree86 project, you may need to apply the patch in /usr/ports/infrastructure/patches/patch-xfree-4.0 to a default binary XFree86 4.0.x distribution for it to work with the OpenBSD ports tree.

Example Use of the Ports Tree

Let's say you managed to get a ports tree and you want to compile and install the archiving utility unzip. You should be able to do something like this:

    % cd /usr/ports/archivers/unzip
    % su
    # make
    # make install
    # exit
Easy, huh ? Especially considering all that happened in the background:

With OpenBSD 3.0, almost all ports automatically build packages when installing.

As ports get built, the /usr/ports/distfiles directory gets filled with program sources, and /usr/ports/packages gets filled with binary packages. Users with low connectivity may refer to mirroring-ports(7) for an efficient way to grab all distfiles at once. In OpenBSD-current, you can use the script /usr/ports/infrastructure/fetch/clean-old to track old distfiles. Note that the OpenBSD CD only include the ports tree and selected packages. If you wish to have the distfiles, you will have to get them through an independent way.

Advanced Usage of the Ports Tree

Ports tree has many features for the advanced user that make it a valuable tool beyond basic installation. Advanced users may wish to tamper with the makefiles (you should read the make(1) manual page first) or set various variables from the make commandline or in /etc/mk.conf. These variables are described in detail in the bsd.port.mk(5) manual page, and the porting documents below.

Creating New Ports

If you are interested in helping to expand the OpenBSD ports tree you should first read porting.html. That page references the FreeBSD Porter's Handbook as well as OpenBSD specific policies and hints.

When a Port Is Lagging Behind the Mainstream Version

The ports collection is a volunteer project. Sometimes the project simply doesn't have the developer resources to keep everything up-to-date. Developers pretty much pick up what they consider interesting and can test in their environment. Your donations count for what platforms the ports can be tested on.

Some individual ports may lag behind the mainstream versions because of this. The ports collection may have a version back of a program from January while a new version of the program has been released by its developers in May three months ago. Often this is a conscious decision; the new version may have problems in it on OpenBSD that the maintainer is trying to solve, or that have simply made the application worse than the old version: OpenBSD may have different goals than the mainstream developers in other projects, which sometimes results in features and design or implementation choices that are undesirable from OpenBSD developers' point of view. The update may also be postponed because the new version is not considered a crucial update.

If you really need a new version of a port, you should ask the MAINTAINER of the port to update the port (see below on how to find out who the maintainer is); if you can send patches for this, all the better. To create proper patches, you should refer to the documentation on building ports.

Problems and Contacts

If you have trouble with an existing port, please send e-mail to the port maintainer. To see who is the maintainer of the port, type, for example:

       % cd /usr/ports/archivers/unzip
       % make show VARNAME=MAINTAINER
Alternatively, if there is no maintainer, or you can't reach him/her, send mail to the OpenBSD ports mailing list, ports@openbsd.org. Please don't use the misc@openbsd.org mailing list for questions about ports. Corrections are always welcome, but in any case do please provide: For ports that don't build correctly, a complete build transcript is almost always required. You can use the portslogger script, found in /usr/ports/infrastructure/build, for this. A sample run of portslogger might be:
       % cd /usr/ports/archivers/unzip
       % su
       # mkdir -p ~/portslogs
       # make clean install 2>&1 | /usr/ports/infrastructure/build/portslogger \
               ~/portslogs
After this, you should have a logfile of the build in your ~/portslogs directory that you can send to the port maintainer. Also, make sure you are not using any special options in your build, for example in /etc/mk.conf.

Alternatively, you can


OpenBSD www@openbsd.org
$OpenBSD: ports.html,v 1.66 2002/05/20 09:11:15 jufi Exp $