stow/dot-local/share/doc/stow/manual-split/Compile_002dtime-vs-Install_002dtime.html

163 lines
8.4 KiB
HTML

<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual describes GNU Stow version 2.3.2-fixbug56727
(2 November 2023), a program for managing farms of symbolic links.
Software and documentation is copyrighted by the following:
© 1993, 1994, 1995, 1996 Bob Glickstein <bobg+stow@zanshin.com>
© 2000, 2001 Guillaume Morin <gmorin@gnu.org>
© 2007 Kahlil (Kal) Hodgson <kahlil@internode.on.net>
© 2011 Adam Spiers <stow@adamspiers.org>
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled "GNU General Public License" is included with the
modified manual, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the Free Software Foundation. -->
<title>Compile-time vs Install-time (Stow)</title>
<meta name="description" content="Compile-time vs Install-time (Stow)">
<meta name="keywords" content="Compile-time vs Install-time (Stow)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Index.html" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html" rel="up" title="Top">
<link href="Bootstrapping.html" rel="next" title="Bootstrapping">
<link href="Resource-Files.html" rel="prev" title="Resource Files">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span.r {font-family: initial; font-weight: normal; font-style: normal}
span:hover a.copiable-link {visibility: visible}
-->
</style>
</head>
<body lang="en">
<div class="chapter-level-extent" id="Compile_002dtime-vs-Install_002dtime">
<div class="nav-panel">
<p>
Next: <a href="Bootstrapping.html" accesskey="n" rel="next">Bootstrapping</a>, Previous: <a href="Resource-Files.html" accesskey="p" rel="prev">Resource Files</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h2 class="chapter" id="Compile_002dtime-vs-Install_002dtime-1"><span>12 Compile-time vs Install-time<a class="copiable-link" href="#Compile_002dtime-vs-Install_002dtime-1"> &para;</a></span></h2>
<p>Software whose installation is managed with Stow needs to be installed
in one place (the package directory, e.g. <samp class="file">/usr/local/stow/perl</samp>)
but needs to appear to run in another place (the target tree, e.g.,
<samp class="file">/usr/local</samp>). Why is this important? What&rsquo;s wrong with Perl, for
instance, looking for its files in <samp class="file">/usr/local/stow/perl</samp> instead
of in <samp class="file">/usr/local</samp>?
</p>
<p>The answer is that there may be another package, e.g.,
<samp class="file">/usr/local/stow/perl-extras</samp>, stowed under <samp class="file">/usr/local</samp>. If
Perl is configured to find its files in <samp class="file">/usr/local/stow/perl</samp>, it
will never find the extra files in the &lsquo;<samp class="samp">perl-extras</samp>&rsquo; package, even
though they&rsquo;re intended to be found by Perl. On the other hand, if Perl
looks for its files in <samp class="file">/usr/local</samp>, then it will find the
intermingled Perl and &lsquo;<samp class="samp">perl-extras</samp>&rsquo; files.
</p>
<p>This means that when you compile a package, you must tell it the
location of the run-time, or target tree; but when you install it, you
must place it in the stow tree.
</p>
<ul class="mini-toc">
<li><a href="#Advice-on-changing-compilation-and-installation-parameters" accesskey="1">Advice on changing compilation and installation parameters</a></li>
<li><a href="GNU-Emacs.html" accesskey="2">GNU Emacs</a></li>
<li><a href="Other-FSF-Software.html" accesskey="3">Other FSF Software</a></li>
<li><a href="Cygnus-Software.html" accesskey="4">Cygnus Software</a></li>
<li><a href="Perl-and-Perl-5-Modules.html" accesskey="5">Perl and Perl 5 Modules</a></li>
</ul>
<div class="section-level-extent" id="Advice-on-changing-compilation-and-installation-parameters">
<h3 class="section"><span>12.1 Advice on changing compilation and installation parameters<a class="copiable-link" href="#Advice-on-changing-compilation-and-installation-parameters"> &para;</a></span></h3>
<p>Some software packages allow you to specify, at compile-time, separate
locations for installation and for run-time. Perl is one such package;
see <a class="ref" href="Perl-and-Perl-5-Modules.html">Perl and Perl 5 Modules</a>. Others allow you to compile the
package, then give a different destination in the &lsquo;<samp class="samp">make install</samp>&rsquo;
step without causing the binaries or other files to get rebuilt. Most
GNU software falls into this category; Emacs is a notable exception.
See <a class="xref" href="GNU-Emacs.html">GNU Emacs</a>, and <a class="ref" href="Other-FSF-Software.html">Other FSF Software</a>.
</p>
<p>Still other software packages cannot abide the idea of separate
installation and run-time locations at all. If you try to &lsquo;<samp class="samp">make
install prefix=/usr/local/stow/<var class="var">foo</var></samp>&rsquo;, then first the whole package
will be recompiled to hardwire the <samp class="file">/usr/local/stow/<var class="var">foo</var></samp>
path. With these packages, it is best to compile normally, then run
&lsquo;<samp class="samp">make -n install</samp>&rsquo;, which should report all the steps needed to
install the just-built software. Place this output into a file, edit
the commands in the file to remove recompilation steps and to reflect
the Stow-based installation location, and execute the edited file as a
shell script in place of &lsquo;<samp class="samp">make install</samp>&rsquo;. Be sure to execute the
script using the same shell that &lsquo;<samp class="samp">make install</samp>&rsquo; would have used.
</p>
<p>(If you use GNU Make and a shell [such as GNU bash] that understands
<code class="command">pushd</code> and <code class="command">popd</code>, you can do the following:
</p>
<ol class="enumerate">
<li> Replace all lines matching &lsquo;<samp class="samp">make[<var class="var">n</var>]: Entering directory
<var class="var">dir</var></samp>&rsquo; with &lsquo;<samp class="samp">pushd <var class="var">dir</var></samp>&rsquo;.
</li><li> Replace all lines matching &lsquo;<samp class="samp">make[<var class="var">n</var>]: Leaving directory
<var class="var">dir</var></samp>&rsquo; with &lsquo;<samp class="samp">popd</samp>&rsquo;.
</li><li> Delete all lines matching &lsquo;<samp class="samp">make[<var class="var">n</var>]: Nothing to be done for
<var class="var">rule</var></samp>&rsquo;.
</li></ol>
<p>Then find other lines in the output containing <code class="command">cd</code> or <code class="command">make</code>
commands and rewrite or delete them. In particular, you should be able
to delete sections of the script that resemble this:
</p>
<div class="example">
<pre class="example-preformatted">for i in <var class="var">dir_1</var> <var class="var">dir_2</var> <span class="r">...</span>; do \
(cd $i; make <var class="var">args</var> <span class="r">...</span>) \
done
</pre></div>
<p>Note, that&rsquo;s &ldquo;should be able to,&rdquo; not &ldquo;can.&rdquo; Be sure to modulate
these guidelines with plenty of your own intelligence.
</p>
<p>The details of stowing some specific packages are described in the
following sections.
</p>
</div>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Bootstrapping.html">Bootstrapping</a>, Previous: <a href="Resource-Files.html">Resource Files</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>