From owner-svn-doc-all@freebsd.org Wed Aug 24 09:14:08 2016 Return-Path: Delivered-To: svn-doc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9A13BC1008; Wed, 24 Aug 2016 09:14:08 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 803501B13; Wed, 24 Aug 2016 09:14:08 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O9E720046107; Wed, 24 Aug 2016 09:14:07 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O9E7uL046106; Wed, 24 Aug 2016 09:14:07 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201608240914.u7O9E7uL046106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Wed, 24 Aug 2016 09:14:07 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r49328 - head/en_US.ISO8859-1/books/porters-handbook/plist X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 09:14:08 -0000 Author: mat Date: Wed Aug 24 09:14:07 2016 New Revision: 49328 URL: https://svnweb.freebsd.org/changeset/doc/49328 Log: Document the PLIST_SUB regex new feature. Reviewed by: wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D7545 Modified: head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml Modified: head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml Wed Aug 24 04:41:50 2016 (r49327) +++ head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml Wed Aug 24 09:14:07 2016 (r49328) @@ -288,6 +288,82 @@ PLIST_SUB+= X11I386="@comment " must be listed as specified in the shared libraries section. + + + Expanding <varname>PLIST_SUB</varname> 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. + + + Using PLIST_SUB With Regular Expressions + + Perl ports can install + architecture dependant files in a specific tree. On &os; 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 +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 + + The files installed by the port are: + + /usr/local/bin/machine-build +/usr/local/lib/perl5/site_perl/man/man1/machine-build.1.gz +/usr/local/lib/perl5/site_perl/man/man3/Machine::Build.3.gz +/usr/local/lib/perl5/site_perl/Machine/Build.pm +/usr/local/lib/perl5/site_perl/mach/5.20/Machine/Build/Build.so + + Runnig make makeplist wrongly + generates: + + 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%%/%%PERL_VER%%/Machine/Build/Build.so + + Change the PLIST_SUB line from the + Makefile to: + + PLIST_SUB= PERL_ARCH=mach \ + PERL_ARCH_regex=\bmach\b + + Now make makeplist correctly + generates: + + bin/machine-build +%%PERL5_MAN1%%/machine-build.1.gz +%%PERL5_MAN3%%/Machine::Build.3.gz +%%SITE_PERL%%/Machine/Build.pm +%%SITE_PERL%%/%%PERL_ARCH%%/%%PERL_VER%%/Machine/Build/Build.so + +