1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="unpacking">
|
---|
9 | <?dbhtml filename="unpacking.html"?>
|
---|
10 |
|
---|
11 | <sect1info>
|
---|
12 | <othername>$LastChangedBy$</othername>
|
---|
13 | <date>$Date$</date>
|
---|
14 | </sect1info>
|
---|
15 |
|
---|
16 | <title>Notes on Building Software</title>
|
---|
17 |
|
---|
18 | <para>Those people who have built an LFS system may be aware
|
---|
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>
|
---|
22 |
|
---|
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
|
---|
25 | available via HTTP. These are referenced as needed in the installation
|
---|
26 | instructions.</para>
|
---|
27 |
|
---|
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>
|
---|
33 |
|
---|
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
|
---|
36 | you have had an error during configuration or compilation, it's usually
|
---|
37 | best to delete the source tree and
|
---|
38 | re-unpack it <emphasis>before</emphasis> trying again. This obviously
|
---|
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>
|
---|
42 |
|
---|
43 | <sect2>
|
---|
44 | <title>Building Software as an Unprivileged (non-root) User</title>
|
---|
45 |
|
---|
46 | <para>The golden rule of Unix System Administration is to use your
|
---|
47 | superpowers only when necessary. Hence, BLFS recommends that you
|
---|
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>
|
---|
54 |
|
---|
55 | </sect2>
|
---|
56 |
|
---|
57 | <sect2>
|
---|
58 | <title>Unpacking the Software</title>
|
---|
59 |
|
---|
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>
|
---|
63 |
|
---|
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>
|
---|
76 |
|
---|
77 | <para>You can also use a slightly different method:</para>
|
---|
78 |
|
---|
79 | <screen><userinput>bzcat filename.tar.bz2 | tar -xv</userinput></screen>
|
---|
80 |
|
---|
81 | <para>Finally, you sometimes need to be able to unpack patches which are
|
---|
82 | generally not in <filename class='extension'>.tar</filename> format. The
|
---|
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>
|
---|
87 |
|
---|
88 | <screen><userinput>gunzip -v patchname.gz
|
---|
89 | bunzip2 -v patchname.bz2</userinput></screen>
|
---|
90 |
|
---|
91 | </sect2>
|
---|
92 |
|
---|
93 | <sect2>
|
---|
94 | <title>Verifying File Integrity Using 'md5sum'</title>
|
---|
95 |
|
---|
96 | <para>Generally, to verify that the downloaded file is genuine and complete,
|
---|
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
|
---|
99 | corresponding md5sum file to the same directory (preferably from different
|
---|
100 | on-line locations), and (assuming <filename>file.md5sum</filename> is the
|
---|
101 | md5sum file downloaded) run the following command:</para>
|
---|
102 |
|
---|
103 | <screen><userinput>md5sum -c file.md5sum</userinput></screen>
|
---|
104 |
|
---|
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>
|
---|
114 |
|
---|
115 | </sect2>
|
---|
116 |
|
---|
117 | <sect2>
|
---|
118 | <title>Creating Log Files During Installation</title>
|
---|
119 |
|
---|
120 | <para>For larger packages, it is convenient to create log files instead of
|
---|
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>
|
---|
125 |
|
---|
126 | <screen><userinput>( <replaceable>[command]</replaceable> 2>&1 | tee compile.log && exit $PIPESTATUS )</userinput></screen>
|
---|
127 |
|
---|
128 | <para><option>2>&1</option> redirects error messages to the same
|
---|
129 | location as standard output. The <command>tee</command> command allows
|
---|
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
|
---|
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>
|
---|
135 |
|
---|
136 | </sect2>
|
---|
137 |
|
---|
138 | <sect2>
|
---|
139 | <title>Dependencies</title>
|
---|
140 |
|
---|
141 | <para>For each package described, BLFS lists the known dependencies.
|
---|
142 | These are listed under several headings, whose meaning is as follows:</para>
|
---|
143 |
|
---|
144 | <itemizedlist>
|
---|
145 | <listitem>
|
---|
146 | <para><emphasis>Required</emphasis> means that the target package
|
---|
147 | cannot be correctly built without the dependency having first been
|
---|
148 | installed.</para>
|
---|
149 | </listitem>
|
---|
150 | <listitem>
|
---|
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>
|
---|
155 | </listitem>
|
---|
156 | <listitem>
|
---|
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>
|
---|
160 | </listitem>
|
---|
161 | </itemizedlist>
|
---|
162 |
|
---|
163 | </sect2>
|
---|
164 |
|
---|
165 | </sect1>
|
---|