Part II. The pkgsrc developer's guide

This part of the book deals with creating and modifying packages. It starts with a HOWTO-like guide on creating a new package. The remaining chapters are more like a reference manual for pkgsrc.

Table of Contents

10. Creating a new pkgsrc package from scratch
10.1. Common types of packages
10.1.1. Perl modules
10.1.2. KDE3 applications
10.1.3. Python modules and programs
10.2. Examples
10.2.1. How the www/nvu package came into pkgsrc
11. Package components - files, directories and contents
11.1. Makefile
11.2. distinfo
11.3. patches/*
11.3.1. Structure of a single patch file
11.3.2. Creating patch files
11.3.3. Sources where the patch files come from
11.3.4. Patching guidelines
11.3.5. Feedback to the author
11.4. Other mandatory files
11.5. Optional files
11.5.1. Files affecting the binary package
11.5.2. Files affecting the build process
11.5.3. Files affecting nothing at all
11.6. work*
11.7. files/*
12. Programming in Makefiles
12.1. Caveats
12.2. Makefile variables
12.2.1. Naming conventions
12.3. Code snippets
12.3.1. Adding things to a list
12.3.2. Converting an internal list into an external list
12.3.3. Passing variables to a shell command
12.3.4. Quoting guideline
12.3.5. Workaround for a bug in BSD Make
13. PLIST issues
13.1. RCS ID
13.2. Semi-automatic PLIST generation
13.3. Tweaking output of make print-PLIST
13.4. Variable substitution in PLIST
13.5. Man page compression
13.6. Changing PLIST source with PLIST_SRC
13.7. Platform-specific and differing PLISTs
13.8. Build-specific PLISTs
13.9. Sharing directories between packages
14. Buildlink methodology
14.1. Converting packages to use buildlink3
14.2. Writing buildlink3.mk files
14.2.1. Anatomy of a buildlink3.mk file
14.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
14.3. Writing builtin.mk files
14.3.1. Anatomy of a builtin.mk file
14.3.2. Global preferences for native or pkgsrc software
15. The pkginstall framework
15.1. Files and directories outside the installation prefix
15.1.1. Directory manipulation
15.1.2. File manipulation
15.2. Configuration files
15.2.1. How PKG_SYSCONFDIR is set
15.2.2. Telling the software where configuration files are
15.2.3. Patching installations
15.2.4. Disabling handling of configuration files
15.3. System startup scripts
15.3.1. Disabling handling of system startup scripts
15.4. System users and groups
15.5. System shells
15.5.1. Disabling shell registration
15.6. Fonts
15.6.1. Disabling automatic update of the fonts databases
16. Options handling
16.1. Global default options
16.2. Converting packages to use bsd.options.mk
16.3. Option Names
16.4. Determining the options of dependencies
17. The build process
17.1. Introduction
17.2. Program location
17.3. Directories used during the build process
17.4. Running a phase
17.5. The fetch phase
17.5.1. What to fetch and where to get it from
17.5.2. How are the files fetched?
17.6. The checksum phase
17.7. The extract phase
17.8. The patch phase
17.9. The tools phase
17.10. The wrapper phase
17.11. The configure phase
17.12. The build phase
17.13. The test phase
17.14. The install phase
17.15. The package phase
17.16. Cleaning up
17.17. Other helpful targets
18. Tools needed for building or running
18.1. Tools for pkgsrc builds
18.2. Tools needed by packages
18.3. Tools provided by platforms
18.4. Questions regarding the tools
19. Making your package work
19.1. General operation
19.1.1. Portability of packages
19.1.2. How to pull in user-settable variables from mk.conf
19.1.3. User interaction
19.1.4. Handling licenses
19.1.5. Restricted packages
19.1.6. Handling dependencies
19.1.7. Handling conflicts with other packages
19.1.8. Packages that cannot or should not be built
19.1.9. Packages which should not be deleted, once installed
19.1.10. Handling packages with security problems
19.1.11. How to handle incrementing versions when fixing an existing package
19.1.12. Substituting variable text in the package files (the SUBST framework)
19.2. Fixing problems in the fetch phase
19.2.1. Packages whose distfiles aren't available for plain downloading
19.2.2. How to handle modified distfiles with the 'old' name
19.2.3. Packages hosted on github.com
19.3. Fixing problems in the configure phase
19.3.1. Shared libraries - libtool
19.3.2. Using libtool on GNU packages that already support libtool
19.3.3. GNU Autoconf/Automake
19.4. Programming languages
19.4.1. C, C++, and Fortran
19.4.2. Java
19.4.3. Packages containing perl scripts
19.4.4. Packages containing shell scripts
19.4.5. Other programming languages
19.5. Fixing problems in the build phase
19.5.1. Compiling C and C++ code conditionally
19.5.2. How to handle compiler bugs
19.5.3. Undefined reference to ...
19.5.4. Running out of memory
19.6. Fixing problems in the install phase
19.6.1. Creating needed directories
19.6.2. Where to install documentation
19.6.3. Installing highscore files
19.6.4. Adding DESTDIR support to packages
19.6.5. Packages with hardcoded paths to other interpreters
19.6.6. Packages installing perl modules
19.6.7. Packages installing info files
19.6.8. Packages installing man pages
19.6.9. Packages installing GConf data files
19.6.10. Packages installing scrollkeeper/rarian data files
19.6.11. Packages installing X11 fonts
19.6.12. Packages installing GTK2 modules
19.6.13. Packages installing SGML or XML data
19.6.14. Packages installing extensions to the MIME database
19.6.15. Packages using intltool
19.6.16. Packages installing startup scripts
19.6.17. Packages installing TeX modules
19.6.18. Packages supporting running binaries in emulation
19.6.19. Packages installing hicolor theme icons
19.6.20. Packages installing desktop files
19.7. Marking packages as having problems
20. Debugging
21. Submitting and Committing
21.1. Submitting binary packages
21.2. Submitting source packages (for non-NetBSD-developers)
21.3. General notes when adding, updating, or removing packages
21.4. Committing: Adding a package to CVS
21.5. Updating a package to a newer version
21.6. Renaming a package in pkgsrc
21.7. Moving a package in pkgsrc
22. Frequently Asked Questions
23. GNOME packaging and porting
23.1. Meta packages
23.2. Packaging a GNOME application
23.3. Updating GNOME to a newer version
23.4. Patching guidelines