8.5. Making Use of SUB_FILES and SUB_LIST

SUB_FILES and SUB_LIST are useful for dynamic values in port files, such as the installation PREFIX in pkg-message.

SUB_FILES specifies a list of files to be automatically modified. Each file in the SUB_FILES list must have a corresponding file.in present in FILESDIR. A modified version will be created as ${WRKDIR}/file. Files defined as a value of USE_RC_SUBR (or the deprecated USE_RCORDER) are automatically added to SUB_FILES. For the files pkg-message, pkg-install, and pkg-deinstall, the corresponding Makefile variable is automatically set to point to the processed version.

SUB_LIST is a list of VAR=VALUE pairs. For each pair, %%VAR%% will be replaced with VALUE in each file listed in SUB_FILES. Several common pairs are automatically defined: PREFIX, LOCALBASE, DATADIR, DOCSDIR, EXAMPLESDIR, WWWDIR, and ETCDIR. Any line beginning with @comment will be deleted from resulting files after a variable substitution.

This example replaces %%ARCH%% with the system architecture in a pkg-message:

SUB_FILES=	pkg-message
SUB_LIST=	ARCH=${ARCH}

Note that for this example, pkg-message.in must exist in FILESDIR.

Example of a good pkg-message.in:

Now it is time to configure this package.
Copy %%PREFIX%%/share/examples/putsy/%%ARCH%%.conf into your home directory
as .putsy.conf and edit it.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <[email protected]>.
Send questions about this document to <[email protected]>.