old-www/HOWTO/Software-Building-HOWTO-2.html

100 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Building and Installing Software Packages for Linux: Unpacking the Files</TITLE>
<LINK HREF="Software-Building-HOWTO-3.html" REL=next>
<LINK HREF="Software-Building-HOWTO-1.html" REL=previous>
<LINK HREF="Software-Building-HOWTO.html#toc2" REL=contents>
</HEAD>
<BODY>
<A HREF="Software-Building-HOWTO-3.html">Next</A>
<A HREF="Software-Building-HOWTO-1.html">Previous</A>
<A HREF="Software-Building-HOWTO.html#toc2">Contents</A>
<HR>
<H2><A NAME="s2">2. Unpacking the Files</A></H2>
<P>You have downloaded or otherwise acquired a software package. Most likely
it is archived (<EM>tarred</EM>) and compressed (<EM>gzipped</EM>),
in <CODE>.tar.gz</CODE> or <CODE>.tgz</CODE> form (familiarly known as a
"tarball"). First copy it to a working directory. Then <EM>untar</EM>
and <EM>gunzip</EM> it. The appropriate command for this is <B>tar
xzvf <EM>filename</EM></B>, where <EM>filename</EM> is the name of the
software file, of course. The de-archiving process will usually install
the appropriate files in subdirectories it will create. Note that if
the package name has a <EM>.Z</EM> suffix, then the above procedure will
serve just as well, though running <B>uncompress</B>, followed by a
<B>tar xvf</B> also works. You may preview this process by a <B>tar
tzvf filename</B>, which lists the files in the archive without actually
unpacking them.
<P>The above method of unpacking "tarballs" is equivalent to either of the following:
<UL>
<LI>gzip -cd filename | tar xvf -</LI>
<LI>gunzip -c filename | tar xvf -</LI>
</UL>
(The '-' causes the <EM>tar</EM> command to take its input from
<CODE>stdin</CODE>.)
<P>Source files in the new <EM>bzip2</EM> (<CODE>.bz2</CODE>) format
can be unarchived by a <B>bzip2 -cd filename | tar xvf -</B>,
or, more simply by a <B>tar xyvf filename</B>, assuming that
<CODE>tar</CODE> has been appropriately patched (refer to the
<A HREF="ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/mini/Bzip">Bzip2 HOWTO</A> for details). Debian Linux uses a different patch for
<CODE>tar</CODE>, one written by Hiroshi Takekawa, so that the <EM>-I,
--bzip2, --bunzip2</EM> options work with that particular <CODE>tar</CODE>
version.
<P>[Many thanks to R. Brock Lynn and Fabrizio Stefani for corrections and
updates on the above information.]
<P>
<P>
<P>Sometimes the archived file must be untarred and installed from the
user's home directory, or perhaps in a certain other directory, such
as <CODE>/</CODE>, <CODE>/usr/src</CODE>, or <CODE>/opt</CODE>, as specified in
the package's config info. Should you get an error message attempting
to untar it, this may be the reason. Read the package docs, especially
the <CODE>README</CODE> and/or <CODE>Install</CODE> files, if present, and edit
the config files and/or <CODE>Makefiles</CODE> as necessary, consistent
with the installation instructions. Note that you would <B>not</B>
ordinarily alter the <CODE>Imake</CODE> file, since this could have unforseen
consequences. Most software packages permit automating this process by
running <B>make install</B> to emplace the binaries in the appropriate
system areas.
<P>
<UL>
<LI>You might encounter <CODE>shar</CODE> files, or <EM>shell archives</EM>,
especially in the source code newsgroups on the Internet. These remain
in use because they are readable to humans, and this permits newsgroup
moderators to sort through them and reject unsuitable ones. They may
be unpacked by the <B>unshar filename.shar</B> command. Otherwise the
procedure for dealing with them is the same as for "tarballs".
</LI>
</UL>
<P>
<P>
<UL>
<LI>Some source archives have been processed using nonstandard DOS,
Mac, or even Amiga compression utilities such <EM>zip</EM>, <EM>arc</EM>,
<EM>lha</EM>, <EM>arj</EM>, <EM>zoo</EM>, <EM>rar</EM>, and <EM>shk</EM>.
Fortunately,
<A HREF="http://metalab.unc.edu">Sunsite</A> and
other places have Linux uncompression utilities that can deal with most
or all of these.
</LI>
</UL>
<P>Occasionally, you may need to update or incorporate bug fixes into the
unarchived source files using a <CODE>patch</CODE> or <CODE>diff</CODE> file
that lists the changes. The doc files and/or <CODE>README</CODE> file will
inform you should this be the case. The normal syntax for invoking Larry
Wall's powerful <EM>patch</EM> utility is <B>patch &lt; patchfile</B>.
<P>You may now proceed to the build stage of the process.
<P>
<P>
<P>
<P>
<HR>
<A HREF="Software-Building-HOWTO-3.html">Next</A>
<A HREF="Software-Building-HOWTO-1.html">Previous</A>
<A HREF="Software-Building-HOWTO.html#toc2">Contents</A>
</BODY>
</HTML>