stow/local/share/doc/stow/manual-split/Compile_002dtime-vs-Install...

145 lines
7.8 KiB
HTML

<html lang="en">
<head>
<title>Compile-time vs Install-time - Stow</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Stow">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Resource-Files.html#Resource-Files" title="Resource Files">
<link rel="next" href="Bootstrapping.html#Bootstrapping" title="Bootstrapping">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This manual describes GNU Stow version 2.2.2
(9 November 2015), a program for managing the installation of software
packages.
Software and documentation is copyrighted by the following:
(C) 1993, 1994, 1995, 1996 Bob Glickstein <bobg+stow@zanshin.com>
(C) 2000, 2001 Guillaume Morin <gmorin@gnu.org>
(C) 2007 Kahlil (Kal) Hodgson <kahlil@internode.on.net>
(C) 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.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Compile-time-vs-Install-time"></a>
<a name="Compile_002dtime-vs-Install_002dtime"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Bootstrapping.html#Bootstrapping">Bootstrapping</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Resource-Files.html#Resource-Files">Resource Files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">12 Compile-time vs Install-time</h2>
<p>Software whose installation is managed with Stow needs to be installed
in one place (the package directory, e.g. <samp><span class="file">/usr/local/stow/perl</span></samp>)
but needs to appear to run in another place (the target tree, e.g.,
<samp><span class="file">/usr/local</span></samp>). Why is this important? What's wrong with Perl, for
instance, looking for its files in <samp><span class="file">/usr/local/stow/perl</span></samp> instead
of in <samp><span class="file">/usr/local</span></samp>?
<p>The answer is that there may be another package, e.g.,
<samp><span class="file">/usr/local/stow/perl-extras</span></samp>, stowed under <samp><span class="file">/usr/local</span></samp>. If
Perl is configured to find its files in <samp><span class="file">/usr/local/stow/perl</span></samp>, it
will never find the extra files in the &lsquo;<samp><span class="samp">perl-extras</span></samp>&rsquo; package, even
though they're intended to be found by Perl. On the other hand, if Perl
looks for its files in <samp><span class="file">/usr/local</span></samp>, then it will find the
intermingled Perl and &lsquo;<samp><span class="samp">perl-extras</span></samp>&rsquo; files.
<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.
<h3 class="section">12.1 Advice on changing compilation and installation parameters</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 href="Perl-and-Perl-5-Modules.html#Perl-and-Perl-5-Modules">Perl and Perl 5 Modules</a>. Others allow you to compile the
package, then give a different destination in the &lsquo;<samp><span class="samp">make install</span></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 href="GNU-Emacs.html#GNU-Emacs">GNU Emacs</a>, and <a href="Other-FSF-Software.html#Other-FSF-Software">Other FSF Software</a>.
<p>Still other software packages cannot abide the idea of separate
installation and run-time locations at all. If you try to &lsquo;<samp><span class="samp">make
install prefix=/usr/local/stow/</span><var>foo</var></samp>&rsquo;, then first the whole package
will be recompiled to hardwire the <samp><span class="file">/usr/local/stow/</span><var>foo</var></samp>
path. With these packages, it is best to compile normally, then run
&lsquo;<samp><span class="samp">make -n install</span></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><span class="samp">make install</span></samp>&rsquo;. Be sure to execute the
script using the same shell that &lsquo;<samp><span class="samp">make install</span></samp>&rsquo; would have used.
<p>(If you use GNU Make and a shell [such as GNU bash] that understands
<samp><span class="command">pushd</span></samp> and <samp><span class="command">popd</span></samp>, you can do the following:
<ol type=1 start=1>
<li>Replace all lines matching &lsquo;<samp><span class="samp">make[</span><var>n</var><span class="samp">]: Entering directory
</span><var>dir</var></samp>&rsquo; with &lsquo;<samp><span class="samp">pushd </span><var>dir</var></samp>&rsquo;.
<li>Replace all lines matching &lsquo;<samp><span class="samp">make[</span><var>n</var><span class="samp">]: Leaving directory
</span><var>dir</var></samp>&rsquo; with &lsquo;<samp><span class="samp">popd</span></samp>&rsquo;.
<li>Delete all lines matching &lsquo;<samp><span class="samp">make[</span><var>n</var><span class="samp">]: Nothing to be done for
</span><var>rule</var></samp>&rsquo;.
</ol>
<p>Then find other lines in the output containing <samp><span class="command">cd</span></samp> or <samp><span class="command">make</span></samp>
commands and rewrite or delete them. In particular, you should be able
to delete sections of the script that resemble this:
<pre class="example"> for i in <var>dir_1</var> <var>dir_2</var> <span class="roman">...</span>; do \
(cd $i; make <var>args</var> <span class="roman">...</span>) \
done
</pre>
<p class="noindent">Note, that's &ldquo;should be able to,&rdquo; not &ldquo;can.&rdquo; Be sure to modulate
these guidelines with plenty of your own intelligence.
<p>The details of stowing some specific packages are described in the
following sections.
<ul class="menu">
<li><a accesskey="1" href="GNU-Emacs.html#GNU-Emacs">GNU Emacs</a>
<li><a accesskey="2" href="Other-FSF-Software.html#Other-FSF-Software">Other FSF Software</a>
<li><a accesskey="3" href="Cygnus-Software.html#Cygnus-Software">Cygnus Software</a>
<li><a accesskey="4" href="Perl-and-Perl-5-Modules.html#Perl-and-Perl-5-Modules">Perl and Perl 5 Modules</a>
</ul>
<!-- -->
</body></html>