#!/bin/sh # First argument of this script is the package name # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list ZLIB_VERSION=$(get_pkg_ver ${1}) # Zlib is known to build its shared library incorrectly if CFLAGS is # specified in the environment. We need to add the -fPIC directive to CFLAGS # for the duration of the below configure command, then remove it afterwards. export CFLAGS="${CFLAGS} -fPIC" # Applying patches (if any) apply_patches ${1} && cd ${LFS_TMP}/${1} && ./configure \ --prefix=/usr \ --shared \ --libdir=/lib && make -j ${MAKEJOBS} && # Installing the shared library make install && # The previous command installed a .so file in /lib. We will remove # it and relink it into /usr/lib: rm -v /lib/libz.so && ln -sfv ../../lib/libz.so.${ZLIB_VERSION} /usr/lib/libz.so && # Now also build the non-shared (static) library: make clean && ./configure \ --prefix=/usr && make -j ${MAKEJOBS} && make install && # Fix the permissions on the static library: chmod 644 /usr/lib/libz.a # Return last error exit $?