* Fixed problem when BASEDIR paths were given without a trailing '/'.
[linux_from_scratch.git] / newxml / chapter06 / zlib.xml
blob9059de6511a356d3c3ae5879cc617d5c23329e85
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3   <!ENTITY % general-entities SYSTEM "../general.ent">
4   %general-entities;
5 ]>
6 <sect1 id="ch-system-zlib" xreflabel="Zlib">
7 <title>Zlib-&zlib-version;</title>
8 <?dbhtml filename="zlib.html"?>
10 <indexterm zone="ch-system-zlib"><primary sortas="a-Zlib">Zlib</primary></indexterm>
12 <para>The Zlib package contains compression and un-compression routines used by
13 some programs.</para>
15 <screen>&buildtime; 0.1 SBU
16 &diskspace; 1.5 MB</screen>
18 <para>Zlib installation depends on: Binutils, Coreutils, GCC, Glibc, Make, Sed.</para>
22 <sect2>
23 <title>Installation of Zlib</title>
25 <note><para>Zlib is known to build its shared library incorrectly if CFLAGS is
26 specified in the environment. If you are using your own CFLAGS variable, be
27 sure to add the <emphasis>-fPIC</emphasis> directive to your CFLAGS for the
28 duration of the below <command>configure</command> command, then remove it
29 afterwards.</para></note>
31 <para>Prepare Zlib for compilation:</para>
33 <screen><userinput>./configure --prefix=/usr --shared</userinput></screen>
35 <para>Compile the package:</para>
37 <screen><userinput>make</userinput></screen>
39 <para>To test the results, issue:
40 <userinput>make check</userinput>.</para>
42 <para>Install the shared library:</para>
44 <screen><userinput>make install</userinput></screen>
46 <para>Now also build the non-shared (static) library:</para>
47 <screen><userinput>make clean
48 ./configure --prefix=/usr
49 make</userinput></screen>
51 <para>To again test the results, issue:
52 <userinput>make check</userinput>.</para>
54 <para>Install the static library:</para>
56 <screen><userinput>make install</userinput></screen>
58 <para>And fix the permissions on the static library:</para>
60 <screen><userinput>chmod 644 /usr/lib/libz.a</userinput></screen>
62 <para>It is good policy and common practice to place important libraries into
63 the <filename class="directory">/lib</filename> directory. This matters most
64 in scenarios where <filename class="directory">/usr</filename> is on a
65 separate partition. Essentially, the run-time components of any libraries that
66 are used by programs in <filename class="directory">/bin</filename> or
67 <filename class="directory">/sbin</filename> should reside in
68 <filename class="directory">/lib</filename> so that they are on the root
69 partition and available in the event of
70 <filename class="directory">/usr</filename> being inaccessible.</para>
72 <para>For the above reason we move the run-time components of the shared Zlib
73 into <filename class="directory">/lib</filename>:</para>
75 <screen><userinput>mv /usr/lib/libz.so.* /lib</userinput></screen>
77 <para>Now we need to fix the <filename>/usr/lib/libz.so</filename> symlink
78 because we just moved the file it points to:</para>
80 <screen><userinput>ln -sf ../../lib/libz.so.1 /usr/lib/libz.so</userinput></screen>
82 </sect2>
85 <sect2 id="contents-zlib"><title>Contents of Zlib</title>
87 <para><emphasis>Installed libraries</emphasis>: libz[a,so]</para>
89 </sect2>
92 <sect2><title>Short description</title>
94 <indexterm zone="ch-system-zlib libz"><primary sortas="c-libz*">libz*</primary></indexterm>
95 <para id="libz"><command>libz*</command> contains compression and un-compression
96 functions used by some programs.</para>
98 </sect2>
102 </sect1>