Index: en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml
===================================================================
--- en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml
+++ en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml
@@ -288,6 +288,74 @@
must be listed as specified in the shared libraries
section.
+
+
+ Expanding PLIST_SUB With Regular
+ Expressions
+
+ Sometime, the replaced strings are too generic and get
+ replaced in paths where they do not make sense. It often
+ happens 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.
+
+
+ Using PLIST_SUB With Regular Expressions
+
+ For example, Perl ports can
+ install files in a architecture dependent architecture,
+ which is currently called mach. It is
+ generally not a problem but if the port installs a file
+ whose path contains a word that contains
+ mach, it gets replaced in wrong places.
+ Given this Makefile:
+
+ PORTNAME= Machine-Build
+PORTVERSION= 1
+CATEGORIES= devel perl5
+MASTER_SITES= CPAN
+PKGNAMEPREFIX= p5-
+
+MAINTAINER= perl@FreeBSD.org
+COMMENT= Building machine
+
+USES= perl5
+USE_PERL5= configure
+
+PLIST_SUB= PERL_ARCH=mach
+
+ Runnnig make makeplist will wrongly
+ generate:
+
+ bin/%%PERL_ARCH%%ine-build
+%%PERL5_MAN1%%/%%PERL_ARCH%%ine-build.1.gz
+%%PERL5_MAN3%%/Machine::Build.3.gz
+%%SITE_PERL%%/Machine/Build.pm
+%%SITE_PERL%%/%%PERL_ARCH%%/Machine/Build/Build.so
+
+ Changing the PLIST_SUB line from the
+ Makefile to:
+
+ PLIST_SUB= PERL_ARCH=mach \
+ PERL_ARCH_regex=\bmach\b
+
+ Now make makeplist will correctly
+ generate:
+
+ bin/machine-build
+%%PERL5_MAN1%%/machine-build.1.gz
+%%PERL5_MAN3%%/Machine::Build.3.gz
+%%SITE_PERL%%/Machine/Build.pm
+%%SITE_PERL%%/%%PERL_ARCH%%/Machine/Build/Build.so
+
+