PLIST issues The PLIST file contains a package's packing list, i.e. a list of files that belong to the package (relative to the ${PREFIX} directory it's been installed in) plus some additional statements - see the &man.pkg.create.1; man page for a full list. This chapter addresses some issues that need attention when dealing with the PLIST file (or files, see below!). RCS ID Be sure to add a RCS ID line as the first thing in any PLIST file you write: @comment $NetBSD$ Semi-automatic <filename>PLIST</filename> generation You can use the make print-PLIST command to output a PLIST that matches any new files since the package was extracted. See for more information on this target. Tweaking output of <command>make print-PLIST</command> If you have used any of the *-dirs packages, as explained in , you may have noticed that make print-PLIST outputs a set of @comments instead of real @dirrm lines. You can also do this for specific directories and files, so that the results of that command are very close to reality. This helps a lot during the update of packages. The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are used to filter the output of print-PLIST. You can append any chunk of AWK scripting you like to it, but be careful with quoting. For example, to get all files inside the libdata/foo directory removed from the resulting PLIST: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; } And to get all the @dirrm lines referring to a specific (shared) directory converted to @comments: PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; } Variable substitution in PLIST A number of variables are substituted automatically in PLISTs when a package is installed on a system. This includes the following variables: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH} Some packages like emacs and perl embed information about which architecture they were built on into the pathnames where they install their files. To handle this case, PLIST will be preprocessed before actually used, and the symbol ${MACHINE_ARCH} will be replaced by what uname -p gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in PLIST somewhere - use this on packages that have GNU autoconf-created configure scripts. Legacy note There used to be a symbol $ARCH that was replaced by the output of uname -m, but that's no longer supported and has been removed. ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION} Some packages want to embed the OS name and version into some paths. To do this, use these variables in the PLIST: ${OPSYS} - output of uname -s ${LOWER_OPSYS} - lowercase common name (eg. solaris) ${OS_VERSION} - uname -r For a complete list of values which are replaced by default, please look in bsd.pkg.mk (and search for PLIST_SUBST). If you want to change other variables not listed above, you can add variables and their expansions to this variable in the following way, similar to MESSAGE_SUBST (see ): PLIST_SUBST+= SOMEVAR="somevalue" This replaces all occurrences of ${SOMEVAR} in the PLIST with somevalue. The PLIST_VARS variable can be used to simplify the common case of conditionally including some PLIST entries. It can be done by adding PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the entry should be included. This will substitute ${PLIST.foo} in the PLIST with either "" or "@comment ". For example, in Makefile: PLIST_VARS+= foo .if condition PLIST.foo= yes .else And then in PLIST: @comment $NetBSD$ bin/bar man/man1/bar.1 ${PLIST.foo}bin/foo ${PLIST.foo}man/man1/foo.1 ${PLIST.foo}share/bar/foo.data ${PLIST.foo}@dirrm share/bar Man page compression Man pages should be installed in compressed form if MANZ is set (in bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the suffix .gz is appended/removed automatically for man pages according to MANZ and MANCOMPRESSED being set or not, see above for details. This modification of the PLIST file is done on a copy of it, not PLIST itself. Changing PLIST source with <varname>PLIST_SRC</varname> To use one or more files as source for the PLIST used in generating the binary package, set the variable PLIST_SRC to the names of that file(s). The files are later concatenated using &man.cat.1;, and the order of things is important. The default for PLIST_SRC is ${PKGDIR}/PLIST. Platform-specific and differing PLISTs Some packages decide to install a different set of files based on the operating system being used. These differences can be automatically handled by using the following files: PLIST.common PLIST.${OPSYS} PLIST.${MACHINE_ARCH} PLIST.${OPSYS}-${MACHINE_ARCH} PLIST.common_end Sharing directories between packages A shared directory is a directory where multiple (and unrelated) packages install files. These directories were problematic because you had to add special tricks in the PLIST to conditionally remove them, or have some centralized package handle them. In pkgsrc, it is now easy: Each package should create directories and install files as needed; pkg_delete will remove any directories left empty after uninstalling a package. If a package needs an empty directory to work, create the directory during installation as usual, and also add an entry to the PLIST: @pkgdir path/to/empty/directory