Next: Preparing Distributions, Previous: Renaming Programs at Install Time, Up: Use Cases for the GNU Build System [Contents][Index]
The GNU Build System’s make install
and make uninstall
interface does not exactly fit the needs of a system administrator
who has to deploy and upgrade packages on lots of hosts. In other
words, the GNU Build System does not replace a package manager.
Such package managers usually need to know which files have been
installed by a package, so a mere make install
is
inappropriate.
The DESTDIR
variable can be used to perform a staged
installation. The package should be configured as if it was going to
be installed in its final location (e.g., --prefix /usr
), but
when running make install
, the DESTDIR
should be set to
the absolute name of a directory into which the installation will be
diverted. From this directory it is easy to review which files are
being installed where, and finally copy them to their final location
by some means.
For instance here is how we could create a binary package containing a snapshot of all the files to be installed.
~/amhello-1.0 % ./configure --prefix /usr … ~/amhello-1.0 % make … ~/amhello-1.0 % make DESTDIR=$HOME/inst install … ~/amhello-1.0 % cd ~/inst ~/inst % find . -type f -print > ../files.lst ~/inst % tar zcvf ~/amhello-1.0-i686.tar.gz `cat ../file.lst` ./usr/bin/hello ./usr/share/doc/amhello/README
After this example, amhello-1.0-i686.tar.gz
is ready to be
uncompressed in / on many hosts. (Using `cat ../file.lst`
instead of ‘.’ as argument for tar
avoids entries for
each subdirectory in the archive: we would not like tar
to
restore the modification time of /, /usr/, etc.)
Note that when building packages for several architectures, it might
be convenient to use make install-data
and make
install-exec
(see Two-Part Installation) to gather
architecture-independent files in a single package.
See What Gets Installed, for more information.
Next: Preparing Distributions, Previous: Renaming Programs at Install Time, Up: Use Cases for the GNU Build System [Contents][Index]