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

11. Getting help
12. Package components - files, directories and contents
12.1. Makefile
12.2. distinfo
12.3. patches/*
12.3.1. Structure of a single patch file
12.3.2. Creating patch files
12.3.3. Sources where the patch files come from
12.3.4. Patching guidelines
12.3.5. Feedback to the author
12.4. Other mandatory files
12.5. Optional files
12.5.1. Files affecting the binary package
12.5.2. Files affecting the build process
12.5.3. Files affecting nothing at all
12.6. work*
12.7. files/*
13. The build process
13.1. Introduction
13.2. Program location
13.3. Directories used during the build process
13.4. Running a phase
13.5. The fetch phase
13.5.1. What to fetch and where to get it from
13.5.2. How are the files fetched?
13.6. The checksum phase
13.7. The extract phase
13.8. The patch phase
13.9. The tools phase
13.10. The wrapper phase
13.11. The configure phase
13.12. The build phase
13.13. The test phase
13.14. The install phase
13.15. The package phase
13.16. Cleaning up
13.17. Other helpful targets
14. Creating a new pkgsrc package from scratch
14.1. Common types of packages
14.1.1. Python modules and programs
14.1.2. R packages
14.1.3. TeXlive packages
14.2. Examples
14.2.1. How the www/nvu package came into pkgsrc
15. Programming in Makefiles
15.1. Caveats
15.2. Makefile variables
15.2.1. Naming conventions
15.3. Code snippets
15.3.1. Adding things to a list
15.3.2. Echoing a string exactly as-is
15.3.3. Passing CFLAGS to GNU configure scripts
15.3.4. Handling possibly empty variables
15.3.5. Testing yes/no variables in conditions
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. Tools needed for building or running
17.1. Tools for pkgsrc builds
17.2. Tools needed by packages
17.3. Tools provided by platforms
18. Buildlink methodology
18.1. Converting packages to use buildlink3
18.2. Writing buildlink3.mk files
18.2.1. Anatomy of a buildlink3.mk file
18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
18.3. Writing builtin.mk files
18.3.1. Anatomy of a builtin.mk file
19. PLIST issues
19.1. RCS ID
19.2. Semi-automatic PLIST generation
19.3. Tweaking output of make print-PLIST
19.4. Variable substitution in PLIST
19.5. Man page compression
19.6. Changing PLIST source with PLIST_SRC
19.7. Platform-specific and differing PLISTs
19.8. Build-specific PLISTs
19.9. Sharing directories between packages
20. The pkginstall framework
20.1. Files and directories outside the installation prefix
20.1.1. Directory manipulation
20.1.2. File manipulation
20.2. Configuration files
20.2.1. How PKG_SYSCONFDIR is set
20.2.2. Telling the software where configuration files are
20.2.3. Patching installation
20.2.4. Declaring configuration files
20.2.5. Disabling handling of configuration files
20.3. System startup scripts
20.3.1. Disabling handling of system startup scripts
20.4. System users and groups
20.5. System shells
20.5.1. Disabling shell registration
20.6. Fonts
20.6.1. Disabling automatic update of the fonts databases
21. Making your package work
21.1. General operation
21.1.1. How to pull in user-settable variables from mk.conf
21.1.2. User interaction
21.1.3. Handling licenses
21.1.4. Restricted packages
21.1.5. Handling dependencies
21.1.6. Handling conflicts with other packages
21.1.7. Packages that cannot or should not be built
21.1.8. Packages which should not be deleted, once installed
21.1.9. Handling packages with security problems
21.1.10. How to handle incrementing versions when fixing an existing package
21.1.11. Substituting variable text in the package files (the SUBST framework)
21.2. The fetch phase
21.2.1. Packages whose distfiles aren't available for plain downloading
21.2.2. How to handle modified distfiles with the 'old' name
21.2.3. Packages hosted on github.com
21.3. The configure phase
21.3.1. Shared libraries - libtool
21.3.2. Using libtool on GNU packages that already support libtool
21.3.3. GNU Autoconf/Automake
21.3.4. Meson / ninja
21.4. Programming languages
21.4.1. C, C++, and Fortran
21.4.2. Java
21.4.3. Go
21.4.4. Rust
21.4.5. Packages containing Perl scripts
21.4.6. Packages containing shell scripts
21.4.7. Other programming languages
21.5. The build phase
21.5.1. Compiling C and C++ code conditionally
21.5.2. How to handle compiler bugs
21.5.3. No such file or directory
21.5.4. Undefined reference to ...
21.5.5. Running out of memory
21.6. The install phase
21.6.1. Creating needed directories
21.6.2. Where to install documentation
21.6.3. Installing highscore files
21.6.4. Adding DESTDIR support to packages
21.6.5. Packages with hardcoded paths to other interpreters
21.6.6. Packages installing Perl modules
21.6.7. Packages installing pkg-config files
21.6.8. Packages installing info files
21.6.9. Packages installing man pages
21.6.10. Packages installing X11 fonts
21.6.11. Packages installing SGML or XML data
21.6.12. Packages installing extensions to the MIME database
21.6.13. Packages using intltool
21.6.14. Packages installing startup scripts
21.6.15. Packages installing TeX modules
21.6.16. Packages supporting running binaries in emulation
21.6.17. Packages installing hicolor icons
21.6.18. Packages installing desktop files
21.7. Marking packages as having problems
22. GNOME packaging and porting
22.1. Meta packages
22.2. Packaging a GNOME application
22.3. Updating GNOME to a newer version
22.4. Patching guidelines
23. Submitting and Committing
23.1. Submitting binary packages
23.2. Submitting source packages (for non-NetBSD-developers)
23.3. General notes when adding, updating, or removing packages
23.4. Commit Messages
23.5. Committing: Adding a package to CVS
23.6. Updating a package to a newer version
23.7. Renaming a package in pkgsrc
23.8. Moving a package in pkgsrc
24. Frequently Asked Questions