- Document DESTDIR usage
PR: docs/101365 (loosely based on) Submitted by: gabor
This commit is contained in:
parent
b03d1e5852
commit
9bb4e7052a
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=28425
1 changed files with 62 additions and 7 deletions
|
|
@ -4758,7 +4758,7 @@ PORTVERSION= 1.0</programlisting>
|
|||
<row>
|
||||
<entry><makevar>USE_X_PREFIX</makevar></entry>
|
||||
|
||||
<entry>The port installs in <makevar>X11BASE</makevar>, not
|
||||
<entry>The port installs in <makevar>X11BASE_REL</makevar>, not
|
||||
<makevar>PREFIX</makevar>.</entry>
|
||||
</row>
|
||||
|
||||
|
|
@ -6779,17 +6779,30 @@ as .putsy.conf and edit it.</programlisting>
|
|||
</sect1>
|
||||
|
||||
<sect1 id="porting-prefix">
|
||||
<title><makevar>PREFIX</makevar></title>
|
||||
<title><makevar>PREFIX</makevar> and <makevar>DESTDIR</makevar></title>
|
||||
|
||||
<para>Do try to make your port install relative to
|
||||
<makevar>PREFIX</makevar>. The value of this variable will be set
|
||||
to <makevar>LOCALBASE</makevar> (default
|
||||
<para><makevar>PREFIX</makevar> determines the location where
|
||||
the port will install. It is usually <filename>/usr/local</filename>,
|
||||
or <filename>/opt</filename>. User can set <makevar>PREFIX</makevar>
|
||||
to anything he wants. Your port must respect this variable.</para>
|
||||
|
||||
<para><makevar>DESTDIR</makevar>, if set by user, determines the
|
||||
complete alternative environment, usually a jail, or an installed
|
||||
system mounted elsewhere than <filename>/</filename>.
|
||||
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>
|
||||
|
||||
<para>The value of <makevar>PREFIX</makevar> will be set
|
||||
to <makevar>LOCALBASE_REL</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</makevar> (default
|
||||
set, <makevar>PREFIX</makevar> will be <makevar>X11BASE_REL</makevar> (default
|
||||
<filename>/usr/X11R6</filename>). If
|
||||
<makevar>USE_LINUX_PREFIX</makevar> is set, <makevar>PREFIX</makevar>
|
||||
will be <makevar>LINUXBASE</makevar> (default
|
||||
will be <makevar>LINUXBASE_REL</makevar> (default
|
||||
<filename>/compat/linux</filename>).</para>
|
||||
|
||||
<para>Avoiding the hard-coding of <filename>/usr/local</filename> or
|
||||
|
|
@ -6840,6 +6853,48 @@ 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>/<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>/<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 wil 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>
|
||||
</chapter>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue