View | Details | Raw Unified | Return to bug 76688
Collapse All | Expand All

(-)book.sgml (+50 lines)
Lines 5377-5382 Link Here
5377
	  installed in <filename>/var/db/pkg</filename> upon install from a
5377
	  installed in <filename>/var/db/pkg</filename> upon install from a
5378
	  port.</para>
5378
	  port.</para>
5379
      </sect1>
5379
      </sect1>
5380
5381
      <sect1 id="using-sub-files">
5382
	<title>Making use of <makevar>SUB_FILES</makevar> and
5383
	  <makevar>SUB_LIST</makevar></title>
5384
5385
	<para>If your port wants to modify some of your files (that means not
5386
	  included in the original distribution) according to some values, you
5387
	  can use <makevar>SUB_FILES</makevar> and <makevar>SUB_LIST</makevar>
5388
	  variables.</para>
5389
5390
	<para><makevar>SUB_FILES</makevar> specifies a list of files to be
5391
	  automatically modified.  Each <replaceable>file</replaceable> in
5392
	  <makevar>SUB_FILES</makevar> must have a corresponding
5393
	  <filename><replaceable>file</replaceable>.in</filename> in
5394
	  <makevar>FILESDIR</makevar>.  If you add some special files
5395
	  (<filename>pkg-message</filename>, <filename>pkg-install</filename>,
5396
	  <filename>pkg-deinstall</filename> or <filename>pkg-reg</filename>),
5397
	  <makevar>PKG-<replaceable>FILE</replaceable></makevar> associated
5398
	  variables will be set to
5399
	  <filename><makevar>WRKDIR</makevar>/pkg-<replaceable>file</replaceable></filename>.</para>
5400
5401
	<para><makevar>SUB_LIST</makevar> is a list of <literal>VAR=VALUE</literal>
5402
	  pairs.  The modified version of each file will be created in
5403
	  <makevar>WRKDIR</makevar>.  For each <literal>VAR=VALUE</literal> in
5404
	  <makevar>SUB_LIST</makevar>, <literal>%%VAR%%</literal> gets replaced
5405
	  by <literal>VALUE</literal> in each file in <makevar>SUB_FILES</makevar>.
5406
	  Some usual pairs are automatically added to <makevar>SUB_LIST</makevar>,
5407
	  so you don't have to worry about them : <literal>PREFIX=&dollar;{PREFIX}
5408
	  DOCSDIR=&dollar;{DOCSDIR}</literal>, etc. (see
5409
	  <filename>bsd.port.mk</filename> for the entire list).</para>
5410
	  
5411
	<para> The substition process is almost the same as with
5412
	  <makevar>PLIST_SUB</makevar>.  Note that any line beginning with
5413
	  <literal>@comment</literal> after variables substitution are deleted from
5414
	  resulting files.</para>
5415
	  
5416
	<para>The following example can be enough for a port wanting to display a
5417
	  custom <filename>pkg-message</filename> (using <literal>%%PREFIX%%</literal>)
5418
	  and to install a rcNG startup script (using
5419
	  <literal>%%RC_SUBR%%</literal>).</para>
5420
	  
5421
	<programlisting>SUB_FILES= pkg-message myport.sh
5422
SUB_LIST= RC_SUBR=${RC_SUBR}
5423
5424
USE_RC_SUBR=  yes</programlisting>
5425
5426
	<para>Note that you must have (in this case) at least
5427
	  <filename>pkg-message.in</filename> and <filename>myport.sh.in</filename>
5428
	  in <makevar>FILESDIR</makevar>.</para>
5429
      </sect1>
5380
    </chapter>
5430
    </chapter>
5381
5431
5382
  <chapter id="testing">
5432
  <chapter id="testing">

Return to bug 76688