8.5. Automated Package List Creation

First, make sure the port is almost complete, with only pkg-plist missing. Running make makeplist will show an example for pkg-plist. The output of makeplist must be double checked for correctness as it tries to automatically guess a few things, and can get it wrong.

User configuration files should be installed as filename.sample, as it is described in Section 8.3, “Configuration Files”. info/dir must not be listed and appropriate install-info lines must be added as noted in the info files section. Any libraries installed by the port must be listed as specified in the shared libraries section.

8.5.1. Expanding PLIST_SUB with Regular Expressions

Strings to be replaced sometimes need to be very specific to avoid undesired replacements. This is a common problem with shorter values.

To address this problem, for each PLACEHOLDER=value, a PLACEHOLDER_regex=regex can be set, with the regex part matching value more precisely.

Example 8.1. Using PLIST_SUB with Regular Expressions

Perl ports can install architecture dependent files in a specific tree. On FreeBSD to ease porting, this tree is called mach. For example, a port that installs a file whose path contains mach could have that part of the path string replaced with the wrong values. Consider this Makefile:

PORTNAME=	Machine-Build
CATEGORIES=	devel perl5

MAINTAINER=	perl@FreeBSD.org
COMMENT=	Building machine

USES=		perl5
USE_PERL5=	configure


The files installed by the port are:


Running make makeplist wrongly generates:


Change the PLIST_SUB line from the Makefile to:


Now make makeplist correctly generates:


All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.