zlib.xml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <sect1 id="ch06-zlib">
  2. <title>Installing Zlib-&zlib-version;</title>
  3. <?dbhtml filename="zlib.html" dir="chapter06"?>
  4. <screen>Estimated build time: &zlib-time;
  5. Estimated required disk space: &zlib-compsize;</screen>
  6. &aa-zlib-shortdesc;
  7. &aa-zlib-dep;
  8. <sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
  9. <sect2>
  10. <title>Installation of Zlib</title>
  11. <para>Prepare Zlib for compilation:</para>
  12. <screen><userinput>./configure --prefix=/usr --shared</userinput></screen>
  13. <note><para>Zlib is known to build its shared library incorrectly if CFLAGS is
  14. specified in the environment. If you are using your own CFLAGS variable, be
  15. sure to add the <emphasis role="strong">-fPIC</emphasis> directive to your
  16. CFLAGS for the duration of the above command, then remove it
  17. afterwards.</para></note>
  18. <para>Compile the package:</para>
  19. <screen><userinput>make</userinput></screen>
  20. <para>This package has a test suite available which can perform a number of
  21. checks to ensure it built correctly. The test suite for Zlib is quick and
  22. painless so we recommend it be run. The following command will test the shared
  23. library:</para>
  24. <screen><userinput>make check</userinput></screen>
  25. <para>Install the shared library:</para>
  26. <screen><userinput>make install</userinput></screen>
  27. <para>Now also build the non-shared (static) library:</para>
  28. <screen><userinput>make clean
  29. ./configure --prefix=/usr
  30. make</userinput></screen>
  31. <para>The following command will test the static library:</para>
  32. <screen><userinput>make check</userinput></screen>
  33. <para>Install the static library:</para>
  34. <screen><userinput>make install</userinput></screen>
  35. <para>And fix the permissions on the static library:</para>
  36. <screen><userinput>chmod 644 /usr/lib/libz.a</userinput></screen>
  37. <para>It is good policy and common practice to place important libraries into
  38. the <filename class="directory">/lib</filename> directory. This matters most
  39. in scenarios where <filename class="directory">/usr</filename> is on a
  40. separate partition. Essentially, the run-time components of any libraries
  41. depended upon by programs in <filename class="directory">/bin</filename> or
  42. <filename class="directory">/sbin</filename> should reside in
  43. <filename class="directory">/lib</filename> so that they are on the root
  44. partition and available in the event of
  45. <filename class="directory">/usr</filename> being inaccessible.</para>
  46. <para>Therefore we move the run-time components of the shared Zlib into
  47. <filename class="directory">/lib</filename> by issuing the following
  48. command:</para>
  49. <screen><userinput>mv /usr/lib/libz.so.* /lib</userinput></screen>
  50. <para>Now we need to fix up the <filename>/usr/lib/libz.so</filename> symlink
  51. because we just moved the location of the file it points to:</para>
  52. <screen><userinput>ln -sf ../../lib/libz.so.1 /usr/lib/libz.so</userinput></screen>
  53. </sect2>
  54. </sect1>