[4122007] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[4122007] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[4afc2603] | 8 | <sect1 id="unpacking">
|
---|
[b92d4b3] | 9 | <?dbhtml filename="unpacking.html"?>
|
---|
[c269038] | 10 |
|
---|
[b92d4b3] | 11 | <sect1info>
|
---|
| 12 | <othername>$LastChangedBy$</othername>
|
---|
| 13 | <date>$Date$</date>
|
---|
| 14 | </sect1info>
|
---|
[f45b1953] | 15 |
|
---|
[b92d4b3] | 16 | <title>Notes on Building Software</title>
|
---|
[f45b1953] | 17 |
|
---|
[4afc2603] | 18 | <para>Those people who have built an LFS system may be aware
|
---|
[b92d4b3] | 19 | of the general principles of downloading and unpacking software. We will
|
---|
| 20 | however repeat some of that information here for those new to building
|
---|
| 21 | their own software.</para>
|
---|
[f45b1953] | 22 |
|
---|
[3ba3f58] | 23 | <para>Each set of installation instructions contains a URL from which you
|
---|
| 24 | can download the package. We do however keep a selection of patches
|
---|
[cbadf6b] | 25 | available via HTTP. These are referenced as needed in the installation
|
---|
[b92d4b3] | 26 | instructions.</para>
|
---|
[f45b1953] | 27 |
|
---|
[c40a9d0] | 28 | <para>While you can keep the source files anywhere you like, we assume that
|
---|
| 29 | you have unpacked the package and changed into the directory created by the
|
---|
| 30 | unpacking process (the 'build' directory). We also assume you have
|
---|
| 31 | uncompressed any required patches and they are in the directory immediately
|
---|
| 32 | above the 'build' directory.</para>
|
---|
[f45b1953] | 33 |
|
---|
[b92d4b3] | 34 | <para>We can not emphasize strongly enough that you should start from a
|
---|
| 35 | <emphasis>clean source tree</emphasis> each time. This means that if
|
---|
[4afc2603] | 36 | you have had an error during configuration or compilation, it's usually
|
---|
| 37 | best to delete the source tree and
|
---|
[b92d4b3] | 38 | re-unpack it <emphasis>before</emphasis> trying again. This obviously
|
---|
[cbadf6b] | 39 | doesn't apply if you're an advanced user used to hacking
|
---|
| 40 | <filename>Makefile</filename>s and C code, but if in doubt, start from a
|
---|
| 41 | clean tree.</para>
|
---|
[f45b1953] | 42 |
|
---|
[ecd7945d] | 43 | <sect2>
|
---|
[a7e0ec7] | 44 | <title>Building Software as an Unprivileged (non-root) User</title>
|
---|
[ecd7945d] | 45 |
|
---|
| 46 | <para>The golden rule of Unix System Administration is to use your
|
---|
[919683dc] | 47 | superpowers only when necessary. Hence, BLFS recommends that you
|
---|
[cbadf6b] | 48 | build software as an unprivileged user and only become the
|
---|
| 49 | <systemitem class='username'>root</systemitem> user when installing the
|
---|
| 50 | software. This philosophy is followed in all the packages in this book.
|
---|
| 51 | Unless otherwise specified, all instructions should be executed as an
|
---|
| 52 | unprivileged user. The book will advise you on instructions that need
|
---|
| 53 | <systemitem class='username'>root</systemitem> privileges.</para>
|
---|
[ecd7945d] | 54 |
|
---|
| 55 | </sect2>
|
---|
| 56 |
|
---|
[b92d4b3] | 57 | <sect2>
|
---|
| 58 | <title>Unpacking the Software</title>
|
---|
[f45b1953] | 59 |
|
---|
[cbadf6b] | 60 | <para>If a file is in <filename class='extension'>.tar</filename> format
|
---|
| 61 | and compressed, it is unpacked by running one of the following
|
---|
| 62 | commands:</para>
|
---|
[f45b1953] | 63 |
|
---|
[cbadf6b] | 64 | <screen><userinput>tar -xvf filename.tar.gz
|
---|
| 65 | tar -xvf filename.tgz
|
---|
| 66 | tar -xvf filename.tar.Z
|
---|
| 67 | tar -xvf filename.tar.bz2</userinput></screen>
|
---|
| 68 |
|
---|
| 69 | <note>
|
---|
| 70 | <para>You may omit using the <option>v</option> parameter in the commands
|
---|
| 71 | shown above and below if you wish to suppress the verbose listing of all
|
---|
| 72 | the files in the archive as they are extracted. This can help speed up the
|
---|
| 73 | extraction as well as make any errors produced during the extraction
|
---|
| 74 | more obvious to you.</para>
|
---|
| 75 | </note>
|
---|
[b92d4b3] | 76 |
|
---|
| 77 | <para>You can also use a slightly different method:</para>
|
---|
[f45b1953] | 78 |
|
---|
[3ba3f58] | 79 | <screen><userinput>bzcat filename.tar.bz2 | tar -xv</userinput></screen>
|
---|
[f45b1953] | 80 |
|
---|
[b92d4b3] | 81 | <para>Finally, you sometimes need to be able to unpack patches which are
|
---|
[cbadf6b] | 82 | generally not in <filename class='extension'>.tar</filename> format. The
|
---|
[c40a9d0] | 83 | best way to do this is to copy the patch file to parent of the 'build'
|
---|
| 84 | directory and then run one of the following commands depending on whether
|
---|
| 85 | the file is a <filename class='extension'>.gz</filename> or <filename
|
---|
| 86 | class='extension'>.bz2</filename> file:</para>
|
---|
[f45b1953] | 87 |
|
---|
[3ba3f58] | 88 | <screen><userinput>gunzip -v patchname.gz
|
---|
| 89 | bunzip2 -v patchname.bz2</userinput></screen>
|
---|
[f45b1953] | 90 |
|
---|
[b92d4b3] | 91 | </sect2>
|
---|
[f45b1953] | 92 |
|
---|
[b92d4b3] | 93 | <sect2>
|
---|
| 94 | <title>Verifying File Integrity Using 'md5sum'</title>
|
---|
[0c603671] | 95 |
|
---|
[b92d4b3] | 96 | <para>Generally, to verify that the downloaded file is genuine and complete,
|
---|
[cbadf6b] | 97 | many package maintainers also distribute md5sums of the files. To verify the
|
---|
| 98 | md5sum of the downloaded files, download both the file and the
|
---|
[b92d4b3] | 99 | corresponding md5sum file to the same directory (preferably from different
|
---|
[cbadf6b] | 100 | on-line locations), and (assuming <filename>file.md5sum</filename> is the
|
---|
| 101 | md5sum file downloaded) run the following command:</para>
|
---|
[0c603671] | 102 |
|
---|
[3ba3f58] | 103 | <screen><userinput>md5sum -c file.md5sum</userinput></screen>
|
---|
[0c603671] | 104 |
|
---|
[cbadf6b] | 105 | <para>If there are any errors, they will be reported. Note that the BLFS
|
---|
| 106 | book includes md5sums for all the source files also. To use the BLFS
|
---|
| 107 | supplied md5sums, you can create a <filename>file.md5sum</filename> (place
|
---|
| 108 | the md5sum data and the exact name of the downloaded file on the same
|
---|
| 109 | line of a file, separated by white space) and run the command shown above.
|
---|
| 110 | Alternately, simply run the command shown below and compare the output
|
---|
| 111 | to the md5sum data shown in the BLFS book.</para>
|
---|
| 112 |
|
---|
| 113 | <screen><userinput>md5sum <replaceable>[name_of_downloaded_file]</replaceable></userinput></screen>
|
---|
[0c603671] | 114 |
|
---|
[b92d4b3] | 115 | </sect2>
|
---|
[0c603671] | 116 |
|
---|
[b92d4b3] | 117 | <sect2>
|
---|
| 118 | <title>Creating Log Files During Installation</title>
|
---|
[0c603671] | 119 |
|
---|
[b92d4b3] | 120 | <para>For larger packages, it is convenient to create log files instead of
|
---|
[cbadf6b] | 121 | staring at the screen hoping to catch a particular error or warning. Log
|
---|
| 122 | files are also useful for debugging and keeping records. The following
|
---|
| 123 | command allows you to create an installation log. Replace
|
---|
| 124 | <replaceable>[command]</replaceable> with the command you intend to execute.</para>
|
---|
[0c603671] | 125 |
|
---|
[cbadf6b] | 126 | <screen><userinput>( <replaceable>[command]</replaceable> 2>&1 | tee compile.log && exit $PIPESTATUS )</userinput></screen>
|
---|
[0c603671] | 127 |
|
---|
[3ba3f58] | 128 | <para><option>2>&1</option> redirects error messages to the same
|
---|
| 129 | location as standard output. The <command>tee</command> command allows
|
---|
[b92d4b3] | 130 | viewing of the output while logging the results to a file. The parentheses
|
---|
| 131 | around the command run the entire command in a subshell and finally the
|
---|
[cbadf6b] | 132 | <command>exit $PIPESTATUS</command> command ensures the result of the
|
---|
| 133 | <replaceable>[command]</replaceable> is returned as the result and not the
|
---|
| 134 | result of the <command>tee</command> command.</para>
|
---|
[0c603671] | 135 |
|
---|
[b92d4b3] | 136 | </sect2>
|
---|
[bccbdaea] | 137 |
|
---|
[7245ba2] | 138 | <sect2>
|
---|
| 139 | <title>Dependencies</title>
|
---|
[bccbdaea] | 140 |
|
---|
[7245ba2] | 141 | <para>For each package described, BLFS lists the known dependencies.
|
---|
| 142 | These are listed under several headings, whose meaning is as follows:</para>
|
---|
[bccbdaea] | 143 |
|
---|
[7245ba2] | 144 | <itemizedlist>
|
---|
| 145 | <listitem>
|
---|
[4afc2603] | 146 | <para><emphasis>Required</emphasis> means that the target package
|
---|
| 147 | cannot be correctly built without the dependency having first been
|
---|
| 148 | installed.</para>
|
---|
[7245ba2] | 149 | </listitem>
|
---|
| 150 | <listitem>
|
---|
[4afc2603] | 151 | <para><emphasis>Recommended</emphasis> means that BLFS strongly
|
---|
| 152 | suggests this package is installed first for a clean and trouble-free
|
---|
| 153 | build, that won't have issues either during the build process, or at
|
---|
| 154 | run-time.</para>
|
---|
[7245ba2] | 155 | </listitem>
|
---|
| 156 | <listitem>
|
---|
[4afc2603] | 157 | <para><emphasis>Optional</emphasis> means that this package might be
|
---|
| 158 | installed for added functionality. Often BLFS will describe the
|
---|
| 159 | dependency to explain the added functionality that will result.</para>
|
---|
[7245ba2] | 160 | </listitem>
|
---|
| 161 | </itemizedlist>
|
---|
[bccbdaea] | 162 |
|
---|
[7245ba2] | 163 | </sect2>
|
---|
[0c603671] | 164 |
|
---|
[f45b1953] | 165 | </sect1>
|
---|