Installed libraries: libz[a,so]
The Zlib package contains compression and un-compression routines used by some programs.
Approximate build time: 0.1 SBU
Required disk space: 1.5 MB
Zlib installation depends on: Binutils, Coreutils, GCC, Glibc, Make, and Sed
The following patch fixes a Denial of Service vulnerability in the Zlib compression library:
patch -Np1 -i ../zlib-1.2.1-security-1.patch
Zlib is known to build its shared library incorrectly if CFLAGS is specified in the environment. If using a specified CFLAGS variable, be sure to add the -fPIC directive to the CFLAGS variable for the duration of the configure command below, then remove it afterwards.
Prepare Zlib for compilation:
./configure --prefix=/usr --shared
Compile the package:
make
To test the results, issue: make check.
Install the shared library:
make install
Build the static library:
make clean ./configure --prefix=/usr make
To test the results again, issue: make check.
Install the static library:
make install
Fix the permissions on the static library:
chmod 644 /usr/lib/libz.a
It is good policy and common practice to place important libraries into the /lib directory. This is most important in scenarios where /usr is on a separate partition. Essentially, the run-time components of any libraries that are used by programs in /bin or /sbin should reside in /lib so that they are on the root partition and available in the event of /usr being inaccessible.
For the above reason, move the run-time components of the shared Zlib into /lib:
mv /usr/lib/libz.so.* /lib
Fix the /usr/lib/libz.so symlink:
ln -sf ../../lib/libz.so.1 /usr/lib/libz.so