6.9. Zlib-1.2.3

The Zlib package contains compression and decompression routines used by some programs.

6.9.1. Environment Settings

This package requires compiler variables to be set for the target in the environment.

export CC="${CLFS_TARGET}-gcc"
export CXX="${CLFS_TARGET}-g++"
export AR="${CLFS_TARGET}-ar"
export AS="${CLFS_TARGET}-as"
export RANLIB="${CLFS_TARGET}-ranlib"
export LD="${CLFS_TARGET}-ld"
export STRIP="${CLFS_TARGET}-strip"

6.9.2. Installation of Zlib

This patch will add -fPIC to our build and allow us to build a static and shared library at the same time:

patch -Np1 -i ../zlib-1.2.3-fPIC-2.patch

Prepare Zlib for compilation:

./configure --prefix=/usr --shared

Compile the package:

make

Install the package:

make prefix=${CLFS}/usr install

The previous command installed a .so file in ${CLFS}/usr/lib. We will move it into ${CLFS}/lib and then relink it to ${CLFS}/usr/lib:

mv -v ${CLFS}/usr/lib/libz.so.* ${CLFS}/lib
ln -sfv ../../lib/libz.so.1 ${CLFS}/usr/lib/libz.so

Now we fix the permissions on the static library:

chmod -v 644 ${CLFS}/usr/lib/libz.a

6.9.3. Contents of Zlib

Installed libraries: libz.[a,so]

Short Descriptions

libz

Contains compression and decompression functions used by some programs