The Zlib package contains compression and decompression routines used by some programs.
Prepare Zlib for compilation and set to optimize for size:
CFLAGS="-Os" ./configure --shared
The meaning of the configure options:
--shared
Tells Zlib to build its shared library.
Compile the package:
make
Install the package into the cross-tools:
make prefix=${CLFS}/cross-tools/${CLFS_TARGET} install
Copy only the shared library into the target file system and ensure that its symlink is present so the runtime loader can find it:
cp -v ${CLFS}/cross-tools/${CLFS_TARGET}/lib/libz.so.1.2.8 ${CLFS}/targetfs/lib/ ln -sv libz.so.1.2.8 ${CLFS}/targetfs/lib/libz.so.1