The pkgsrc guide

Documentation on the NetBSD packages system

Alistair Crooks

Hubert Feyrer

The pkgsrc Developers

$NetBSD: pkgsrc.xml,v 1.12 2006/02/18 01:46:43 rillig Exp $

Abstract

Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages.


Table of Contents

1. What is pkgsrc?
1.1. Introduction
1.2. Overview
1.3. Terminology
1.4. Typography
I. The pkgsrc user's guide
2. Where to get pkgsrc and how to keep it up-to-date
2.1. As tar file
2.2. Via SUP
2.3. Via CVS
2.4. Keeping pkgsrc up-to-date via CVS
3. Using pkgsrc on systems other than NetBSD
3.1. Bootstrapping pkgsrc
3.2. Platform-specific notes
3.2.1. Darwin (Mac OS X)
3.2.2. FreeBSD
3.2.3. Interix
3.2.4. IRIX
3.2.5. Linux
3.2.6. OpenBSD
3.2.7. Solaris
4. Using pkgsrc
4.1. Using binary packages
4.1.1. Finding binary packages
4.1.2. Installing binary packages
4.1.3. A word of warning
4.2. Building packages from source
4.2.1. Requirements
4.2.2. Fetching distfiles
4.2.3. How to build and install
4.2.4. Selecting the compiler
5. Configuring pkgsrc
5.1. General configuration
5.2. Variables affecting the build process
5.3. Developer/advanced settings
5.4. Selecting Build Options
6. Creating binary packages
6.1. Building a single binary package
6.2. Settings for creation of binary packages
6.3. Doing a bulk build of all packages
6.3.1. Configuration
6.3.2. Other environmental considerations
6.3.3. Operation
6.3.4. What it does
6.3.5. Disk space requirements
6.3.6. Setting up a sandbox for chrooted builds
6.3.7. Building a partial set of packages
6.3.8. Uploading results of a bulk build
6.4. Creating a multiple CD-ROM packages collection
6.4.1. Example of cdpack
7. Frequently Asked Questions
7.1. Are there any mailing lists for pkg-related discussion?
7.2. Where's the pkgviews documentation?
7.3. Utilities for package management (pkgtools)
7.4. How to use pkgsrc as non-root
7.5. How to resume transfers when fetching distfiles?
7.6. How can I install/use XFree86 from pkgsrc?
7.7. How can I install/use X.org from pkgsrc?
7.8. How to fetch files from behind a firewall
7.9. How do I tell make fetch to do passive FTP?
7.10. How to fetch all distfiles at once
7.11. What does “Don't know how to make /usr/share/tmac/tmac.andoc” mean?
7.12. What does “Could not find bsd.own.mk” mean?
7.13. Using 'sudo' with pkgsrc
7.14. How do I change the location of configuration files?
7.15. Automated security checks
II. The pkgsrc developer's guide
8. Package components - files, directories and contents
8.1. Makefile
8.2. distinfo
8.3. patches/*
8.4. Other mandatory files
8.5. Optional files
8.6. work*
8.7. files/*
9. Programming in Makefiles
9.1. Makefile variables
9.1.1. Naming conventions
9.2. Code snippets
9.2.1. Adding things to a list
9.2.2. Converting an internal list into an external list
9.2.3. Passing variables to a shell command
9.2.4. Quoting guideline
9.2.5. Workaround for a bug in BSD Make
10. PLIST issues
10.1. RCS ID
10.2. Semi-automatic PLIST generation
10.3. Tweaking output of make print-PLIST
10.4. Variable substitution in PLIST
10.5. Man page compression
10.6. Changing PLIST source with PLIST_SRC
10.7. Platform-specific and differing PLISTs
10.8. Sharing directories between packages
11. Buildlink methodology
11.1. Converting packages to use buildlink3
11.2. Writing buildlink3.mk files
11.2.1. Anatomy of a buildlink3.mk file
11.2.2. Updating BUILDLINK_DEPENDS.pkg in buildlink3.mk files
11.3. Writing builtin.mk files
11.3.1. Anatomy of a builtin.mk file
11.3.2. Global preferences for native or pkgsrc software
12. The pkginstall framework
12.1. Files and directories outside the installation prefix
12.1.1. Directory manipulation
12.1.2. File manipulation
12.2. Configuration files
12.2.1. How PKG_SYSCONFDIR is set
12.2.2. Telling the software where configuration files are
12.2.3. Patching installations
12.2.4. Disabling handling of configuration files
12.3. System startup scripts
12.3.1. Disabling handling of system startup scripts
12.4. System users and groups
12.5. System shells
12.5.1. Disabling shell registration
12.6. Fonts
12.6.1. Disabling automatic update of the fonts databases
13. Options handling
13.1. Global default options
13.2. Converting packages to use bsd.options.mk
13.3. Option Names
14. The build process
14.1. Introduction
14.2. Program location
14.3. Directories used during the build process
14.4. Running a phase
14.5. The fetch phase
14.6. The checksum phase
14.7. The extract phase
14.8. The patch phase
14.9. The tools phase
14.10. The wrapper phase
14.11. The configure phase
14.12. The build phase
14.13. The test phase
14.14. The install phase
14.15. The package phase
14.16. Other helpful targets
15. Tools needed for building or running
15.1. Tools for pkgsrc builds
15.2. Tools needed by packages
15.3. Tools provided by platforms
16. Making your package work
16.1. General operation
16.1.1. How to pull in variables from /etc/mk.conf
16.1.2. Where to install documentation
16.1.3. Restricted packages
16.1.4. Handling dependencies
16.1.5. Handling conflicts with other packages
16.1.6. Packages that cannot or should not be built
16.1.7. Packages which should not be deleted, once installed
16.1.8. Handling packages with security problems
16.1.9. How to handle compiler bugs
16.1.10. How to handle incrementing versions when fixing an existing package
16.1.11. Portability of packages
16.2. Possible downloading issues
16.2.1. Packages whose distfiles aren't available for plain downloading
16.2.2. How to handle modified distfiles with the 'old' name
16.3. Configuration gotchas
16.3.1. Shared libraries - libtool
16.3.2. Using libtool on GNU packages that already support libtool
16.3.3. GNU Autoconf/Automake
16.4. Building the package
16.4.1. CPP defines
16.4.2. Examples of CPP defines for some platforms
16.4.3. Getting a list of CPP defines
16.5. Package specific actions
16.5.1. User interaction
16.5.2. Handling licenses
16.5.3. Installing score files
16.5.4. Packages containing perl scripts
16.5.5. Packages with hardcoded paths to other interpreters
16.5.6. Packages installing perl modules
16.5.7. Packages installing info files
16.5.8. Packages installing man pages
16.5.9. Packages installing GConf2 data files
16.5.10. Packages installing scrollkeeper data files
16.5.11. Packages installing X11 fonts
16.5.12. Packages installing GTK2 modules
16.5.13. Packages installing SGML or XML data
16.5.14. Packages installing extensions to the MIME database
16.5.15. Packages using intltool
16.5.16. Packages installing startup scripts
16.5.17. Packages installing TeX modules
16.6. Feedback to the author
17. Debugging
18. Submitting and Committing
18.1. Submitting your packages
18.2. General notes when adding, updating, or removing packages
18.3. Committing: Importing a package into CVS
18.4. Updating a package to a newer version
18.5. Moving a package in pkgsrc
19. Porting pkgsrc
19.1. Porting pkgsrc to a new operating system
19.2. Adding support for a new compiler
A. A simple example package: bison
A.1. files
A.1.1. Makefile
A.1.2. DESCR
A.1.3. PLIST
A.1.4. Checking a package with pkglint
A.2. Steps for building, installing, packaging
B. Build logs
B.1. Building figlet
B.2. Packaging figlet
C. Layout of the FTP server's package archive
D. Editing guidelines for the pkgsrc guide
D.1. Targets
D.2. Procedure