What is pkgsrc?IntroductionThere is a lot of software freely available for Unix-based
systems, which is usually available in form of the source code. Before
such software can be used, it needs to be configured to the local
system, compiled and installed, and this is exactly what The NetBSD
Packages Collection (pkgsrc) does. pkgsrc also has some basic commands
to handle binary packages, so that not every user has to build the
packages for himself, which is a time-costly task.pkgsrc currently contains several thousand packages,
including:www/apache - The Apache
web serverwww/firefox - The Firefox
web browsermeta-pkgs/gnome - The GNOME
Desktop Environmentmeta-pkgs/kde3 - The K
Desktop Environment...just to name a few.pkgsrc has built-in support for handling varying dependencies,
such as pthreads and X11, and extended features such as IPv6 support on
a range of platforms.Why pkgsrc?
pkgsrc provides the following key features:
Easy building of software from source as well as the creation
and installation of binary packages. The source and latest
patches are retrieved from a master or mirror download site, checksum
verified, then built on your system. Support for binary-only
distributions is available for both native platforms and NetBSD
emulated platforms.All packages are installed in a consistent directory tree,
including binaries, libraries, man pages and other
documentation.Package dependencies, including when performing package updates,
are handled automatically. The configuration files of various
packages are handled automatically during updates, so local changes
are preserved.Like NetBSD, pkgsrc is designed with portability in mind and
consists of highly portable code. This allows the greatest speed of
development when porting to new a platform. This portability also
ensures that pkgsrc is consistent across all
platforms.The installation prefix, acceptable software licenses,
international encryption requirements and build-time options for a
large number of packages are all set in a simple, central
configuration file.The entire source (not including the distribution files) is
freely available under a BSD license, so you may extend and adapt
pkgsrc to your needs. Support for local packages and patches is
available right out of the box, so you can configure it specifically
for your environment.The following principles are basic to pkgsrc:It should only work if it's right.
— That means, if a package contains bugs, it's better to find
them and to complain about them rather than to just install the package
and hope that it works. There are numerous checks in pkgsrc that try to
find such bugs: Static analysis tools (pkgtools/pkglint), build-time checks (portability
of shell scripts), and post-installation checks (installed files,
references to shared libraries, script interpreters).If it works, it should work everywhere
— Like NetBSD has been ported to many hardware architectures,
pkgsrc has been ported to many operating systems. Care is taken that
packages behave the same on all platforms.Supported platformspkgsrc consists of both a source distribution and a binary
distribution for these operating systems. After retrieving the required
source or binaries, you can be up and running with pkgsrc in just
minutes!pkgsrc was derived from FreeBSD's ports system, and
initially developed for NetBSD only. Since then, pkgsrc has
grown a lot, and now supports the following platforms:
Platforms supported by pkgsrcPlatformDate Support AddedNetBSDAug 1997SolarisMar 1999LinuxJun 1999Darwin
(Mac OS X)
Oct 2001FreeBSDNov 2002OpenBSDNov 2002IRIXDec 2002BSD/OSDec 2003AIXDec 2003Interix
(Microsoft Windows Services for Unix)
Mar 2004DragonFlyBSDOct 2004OSF/1Nov 2004HP-UXApr 2007
OverviewThis document is divided into three parts. The first,
,
describes how one can use one of the packages in the Package
Collection, either by installing a precompiled binary package,
or by building one's own copy using the &os; package system.
The second part, , explains how to prepare a
package so it can be easily built by other &os; users without
knowing about the package's building details. The third part,
is intended for those who want to understand how pkgsrc is
implemented.This document is available in various formats:
HTMLPDFPSTXT.TerminologyThere has been a lot of talk about ports,
packages, etc. so far. Here is a description of all the
terminology used within this document.PackageA set of files and building instructions
that describe what's necessary
to build a certain piece of software using
pkgsrc. Packages are traditionally stored under
/usr/pkgsrc.The &os; package systemThis is the former name of pkgsrc. It
is part of the &os; operating system and can be bootstrapped
to run on non-&os; operating systems as well. It handles
building (compiling), installing, and removing of
packages.DistfileThis term describes the file or files that are
provided by the author of the piece of software to
distribute his work. All the changes necessary to build on
&os; are reflected in the corresponding package. Usually
the distfile is in the form of a compressed tar-archive,
but other types are possible, too. Distfiles are usually
stored below
/usr/pkgsrc/distfiles.PortThis is the term used by FreeBSD and OpenBSD people
for what we call a package.
In &os; terminology, port refers to a different
architecture.Precompiled/binary packageA set of binaries built with pkgsrc from a distfile
and stuffed together in a single .tgz
file so it can be installed on machines of the same
machine architecture without the need to
recompile. Packages are usually generated in
/usr/pkgsrc/packages; there is also
an archive on ftp.NetBSD.org.Sometimes, this is referred to by the term package too,
especially in the context of precompiled packages.ProgramThe piece of software to be installed which will be
constructed from all the files in the distfile by the
actions defined in the corresponding package.Roles involved in pkgsrcpkgsrc usersThe
pkgsrc users are people who use the packages provided by pkgsrc.
Typically they are system administrators. The people using the
software that is inside the packages (maybe called end
users) are not covered by the pkgsrc guide.There are two kinds of pkgsrc users: Some only want to
install pre-built binary packages. Others build the pkgsrc
packages from source, either for installing them directly or for
building binary packages themselves. For pkgsrc users should provide all necessary
documentation.package maintainersA
package maintainer creates packages as described in .infrastructure developersThese people are involved in all those files
that live in the mk/ directory and below.
Only these people should need to read through , though others might be curious,
too.TypographyWhen giving examples for commands, shell prompts are used to
show if the command should/can be issued as root, or if
normal user privileges are sufficient. We use a
&rprompt; for root's shell prompt, and a &cprompt; for users'
shell prompt, assuming they use the C-shell or tcsh.