13.7 Making use of SUB_FILES and SUB_LIST

In some cases, it may be necessary to modify port files, i.e.: files not included in the original distribution, to set values; the SUB_FILES and SUB_LIST variables are available.

The SUB_FILES variable specifies a list of files to be automatically modified. Each file in the SUB_FILES list must have a corresponding file.in listed in FILESDIR. If you add some files, such as pkg-message, pkg-install, pkg-deinstall or pkg-reg, PKG-FILE associated variables will be set to WRKDIR/pkg-file.

The SUB_LIST variable is a list of VAR=VALUE pairs. The modified version of each file will be created in WRKDIR. For each VAR=VALUE in SUB_LIST, %%VAR%% will get replaced with VALUE in each file listed in SUB_FILES. Some usual pairs are automatically added to SUB_LIST, so you are not required to worry about them : PREFIX=${PREFIX}DOCSDIR=${DOCSDIR}, etc. (see bsd.port.mk for the entire list).

The substitution process is almost the same as the PLIST_SUB variable. Any line beginning with @comment after variable substitution will be deleted from resulting files.

The following example should be enough for a port to display a custom pkg-message, using %%PREFIX%%, and to install an rcNG startup script using %%RC_SUBR%%.

SUB_FILES= pkg-message myport.sh


Note that for this example, the pkg-message.in and myport.sh.in files must exist in FILESDIR.

For questions about the FreeBSD ports system, e-mail <ports@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:41