- Remove obsoleted pieces of info about DESTDIR and add some new

description how it works now

Reviewed by:	linimon
This commit is contained in:
Gabor Kovesdan 2007-09-08 18:47:34 +00:00
parent 8680e4f1ca
commit acce41e322
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=30756

View file

@ -8839,17 +8839,20 @@ as .putsy.conf and edit it.</programlisting>
A port will actually install into
<makevar>DESTDIR</makevar>/<makevar>PREFIX</makevar>, and register
with the package database in <makevar>DESTDIR</makevar>/var/db/pkg.
It is very important to write ports that respect
<makevar>DESTDIR</makevar>.</para>
As <makevar>DESTDIR</makevar> is handled automatically by the
ports infrastructure via calling &man.chroot.8;, you do not
need any modifications or any extra care to write
<makevar>DESTDIR</makevar>-compliant ports.</para>
<para>The value of <makevar>PREFIX</makevar> will be set
to <makevar>LOCALBASE_REL</makevar> (default
to <makevar>LOCALBASE</makevar> (default
<filename>/usr/local</filename>). If
<makevar>USE_X_PREFIX</makevar> or <makevar>USE_IMAKE</makevar> is
set, <makevar>PREFIX</makevar> will be <makevar>X11BASE_REL</makevar> (default
<filename>/usr/X11R6</filename>). If
set, <makevar>PREFIX</makevar> will be <makevar>X11BASE</makevar>
(default <makevar>LOCALBASE</makevar> for compatibility reasons,
but it is going to be completely removed later). If
<makevar>USE_LINUX_PREFIX</makevar> is set, <makevar>PREFIX</makevar>
will be <makevar>LINUXBASE_REL</makevar> (default
will be <makevar>LINUXBASE</makevar> (default
<filename>/compat/linux</filename>).</para>
<para>Avoiding the hard-coding of <filename>/usr/local</filename> or
@ -8900,48 +8903,6 @@ as .putsy.conf and edit it.</programlisting>
<literal>-DPAGER=\"/usr/local/bin/less\"</literal>. This way it will
have a better chance of working if the system administrator has
moved the whole <filename>/usr/local</filename> tree somewhere else.</para>
<para>Note that <makevar>LOCALBASE</makevar>,
<makevar>LINUXBASE</makevar>, <makevar>X11BASE</makevar>,
<makevar>DOCSDIR</makevar>, <makevar>EXAMPLESDIR</makevar>,
<makevar>DATADIR</makevar>, <makevar>DESKTOPDIR</makevar> variables
already contain <makevar>DESTDIR</makevar>. Using
<makevar>DESTDIR</makevar>&nbsp;<makevar>LOCALBASE</makevar> is
wrong. Use <makevar>LOCALBASE_REL</makevar>,
<makevar>LINUXBASE_REL</makevar>, <makevar>X11BASE_REL</makevar>
if you need a variable relative to <makevar>DESTDIR</makevar>.
To keep things terse, <makevar>TARGETDIR</makevar> can be used to
replace <makevar>DESTDIR</makevar>&nbsp;<makevar>PREFIX</makevar>.</para>
<para>Example of correct usage:</para>
<programlisting>post-install:
${INSTALL_PROGRAM} ${WRKSRC}/helper ${TARGETDIR}/bin/helper
${INSTALL_DATA} ${WRKSRC}/guide.txt ${DOCSDIR}</programlisting>
<para>When referencing dependencies in the port, the
<makevar>LOCALBASE</makevar> is used, as we are working with
dependencies inside the target environment. For hardcoding file
paths in the software, <makevar>LOCALBASE_REL</makevar> must
be used, because the software will run inside the target
environment.</para>
<para>Example of correct usage:</para>
<programlisting>RUN_DEPENDS= ${LOCALBASE}/share/gonzo/launch.dat:${PORTSDIR}/games/gonzo
post-patch:
@${REINPLACE_CMD} -e 's|/usr/gonzo/launch.dat|${LOCALBASE_REL}/share/gonzo/launch.dat}' ${WRKSRC}/main.c
@${REINPLACE_CMD} -e 's|/etc/game.conf|${PREFIX}/etc/game.conf|' ${WRKSRC}/loader.c
post-install:
@${INSTALL_DATA} ${WRKSRC}/example/conf ${TARGETDIR}/etc/game.conf</programlisting>
<para>In packing lists and in <filename>pkg-*</filename> scripts,
<literal>%%LOCALBASE%%</literal>, <literal>%%LINUXBASE%%</literal>
and <literal>%%X11BASE%%</literal> expansions will contain paths
stripped of <makevar>DESTDIR</makevar>, as all these files are
processed of a context of target environment.</para>
</sect1>
<sect1 id="testing-tinderbox">